1
/* This file is part of the KDE project
2
Copyright (C) 2006 Jarosław Staniek <staniek@kde.org>
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.
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.
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.
20
#ifndef WIDGETWITHSUBPROPERTIESINTERFACE_H
21
#define WIDGETWITHSUBPROPERTIESINTERFACE_H
23
#include "kformdesigner_export.h"
29
namespace KFormDesigner
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
40
WidgetWithSubpropertiesInterface();
41
virtual ~WidgetWithSubpropertiesInterface();
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);
47
//! \return the assigned subwidget.
48
QWidget* subwidget() const;
50
//! \return a set of subproperties available for this widget.
51
QSet<QByteArray> subproperties() const;
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;
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;
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);