~ubuntu-branches/debian/sid/kexi/sid

« back to all changes in this revision

Viewing changes to src/formeditor/widgetwithsubpropertiesinterface.h

  • Committer: Package Import Robot
  • Author(s): Pino Toscano
  • Date: 2017-06-24 20:10:10 UTC
  • Revision ID: package-import@ubuntu.com-20170624201010-5lrzd5r2vwthwifp
Tags: upstream-3.0.1.1
Import upstream version 3.0.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2006 Jarosław Staniek <staniek@kde.org>
 
3
 
 
4
   This program is free software; you can redistribute it and/or
 
5
   modify it under the terms of the GNU Library General Public
 
6
   License as published by the Free Software Foundation; either
 
7
   version 2 of the License, or (at your option) any later version.
 
8
 
 
9
   This program is distributed in the hope that it will be useful,
 
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
   Library General Public License for more details.
 
13
 
 
14
   You should have received a copy of the GNU Library General Public License
 
15
   along with this program; see the file COPYING.  If not, write to
 
16
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
17
 * Boston, MA 02110-1301, USA.
 
18
 */
 
19
 
 
20
#ifndef WIDGETWITHSUBPROPERTIESINTERFACE_H
 
21
#define WIDGETWITHSUBPROPERTIESINTERFACE_H
 
22
 
 
23
#include "kformdesigner_export.h"
 
24
 
 
25
#include <QWidget>
 
26
#include <QVariant>
 
27
#include <QSet>
 
28
 
 
29
namespace KFormDesigner
 
30
{
 
31
 
 
32
//! An interface for declaring form widgets to have subproperties.
 
33
/*! Currently used in KexiDBAutoField to allow editing specific properties
 
34
 of its internal editor. For example, if the autofield is of type Image Box,
 
35
 the Image Box widget has some specific properties like "lineWidth".
 
36
 Such properties are provided by the parent KexiDBAutoField object as subproperties. */
 
37
class KFORMDESIGNER_EXPORT WidgetWithSubpropertiesInterface
 
38
{
 
39
public:
 
40
    WidgetWithSubpropertiesInterface();
 
41
    virtual ~WidgetWithSubpropertiesInterface();
 
42
 
 
43
    //! Sets \a widget subwidget handling subproperties. Setting 0 clears subwidget.
 
44
//! @todo maybe someone wants to add more than one widget here?
 
45
    void setSubwidget(QWidget *widget);
 
46
 
 
47
    //! \return the assigned subwidget.
 
48
    QWidget* subwidget() const;
 
49
 
 
50
    //! \return a set of subproperties available for this widget.
 
51
    QSet<QByteArray> subproperties() const;
 
52
 
 
53
    //! \return a metaproperty for a widget's subproperty
 
54
    //! or invalid metaproperty if there is no such subproperty.
 
55
    QMetaProperty findMetaSubproperty(const char * name) const;
 
56
 
 
57
    //! \return a value of widget's subproperty. \a ok is set to true on success
 
58
    //! and to false on failure.
 
59
    QVariant subproperty(const char * name, bool *ok) const;
 
60
 
 
61
    //! Sets a subproperty value \a value for a subproperty \a name
 
62
    //! \return true on successful setting and false when there
 
63
    //! is no such a subproperty in the subwidget or QObject::setProperty() failed.
 
64
    bool setSubproperty(const char * name, const QVariant & value);
 
65
 
 
66
private:
 
67
    class Private;
 
68
    Private* const d;
 
69
};
 
70
}
 
71
 
 
72
#endif