mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
generic: prepare for Katie changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
01d1de126a
commit
956cfc5a59
10 changed files with 23 additions and 66 deletions
|
@ -35,7 +35,7 @@ class KColorButtonPrivate;
|
|||
class KDEUI_EXPORT KColorButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( QColor color READ color WRITE setColor NOTIFY changed USER true )
|
||||
Q_PROPERTY( QColor color READ color WRITE setColor NOTIFY changed )
|
||||
Q_PROPERTY( QColor defaultColor READ defaultColor WRITE setDefaultColor )
|
||||
Q_PROPERTY( bool alphaChannelEnabled READ isAlphaChannelEnabled WRITE setAlphaChannelEnabled )
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class KColorComboPrivate;
|
|||
class KDEUI_EXPORT KColorCombo : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY activated USER true)
|
||||
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY activated)
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -398,35 +398,6 @@ void KConfigDialogManager::updateSettings()
|
|||
}
|
||||
}
|
||||
|
||||
QByteArray KConfigDialogManager::getUserProperty(const QWidget *widget) const
|
||||
{
|
||||
if (!s_propertyMap->contains(widget->metaObject()->className())) {
|
||||
const QMetaObject *metaObject = widget->metaObject();
|
||||
const QMetaProperty user = metaObject->userProperty();
|
||||
if ( user.isValid() ) {
|
||||
s_propertyMap->insert( widget->metaObject()->className(), user.name() );
|
||||
//kDebug(s_kconfigdialogmanagerarea) << "class name: '" << widget->metaObject()->className()
|
||||
//<< " 's USER property: " << metaProperty.name();
|
||||
}
|
||||
else {
|
||||
return QByteArray(); //no USER property
|
||||
}
|
||||
}
|
||||
const QComboBox *cb = qobject_cast<const QComboBox *>(widget);
|
||||
if (cb) {
|
||||
const char *qcomboUserPropertyName = cb->QComboBox::metaObject()->userProperty().name();
|
||||
const int qcomboUserPropertyIndex = qcomboUserPropertyName ? cb->QComboBox::metaObject()->indexOfProperty(qcomboUserPropertyName) : -1;
|
||||
const char *widgetUserPropertyName = widget->metaObject()->userProperty().name();
|
||||
const int widgetUserPropertyIndex = widgetUserPropertyName ? cb->metaObject()->indexOfProperty(widgetUserPropertyName) : -1;
|
||||
|
||||
if (qcomboUserPropertyIndex == widgetUserPropertyIndex) {
|
||||
return QByteArray(); // use the q/kcombobox special code
|
||||
}
|
||||
}
|
||||
|
||||
return s_propertyMap->value( widget->metaObject()->className() );
|
||||
}
|
||||
|
||||
QByteArray KConfigDialogManager::getCustomProperty(const QWidget *widget) const
|
||||
{
|
||||
QVariant prop(widget->property("kcfg_property"));
|
||||
|
@ -452,11 +423,8 @@ void KConfigDialogManager::setProperty(QWidget *w, const QVariant &v)
|
|||
return;
|
||||
}*/
|
||||
|
||||
QByteArray userproperty = getCustomProperty(w);
|
||||
if (userproperty.isEmpty()) {
|
||||
userproperty = getUserProperty(w);
|
||||
}
|
||||
if (userproperty.isEmpty()) {
|
||||
QByteArray customproperty = getCustomProperty(w);
|
||||
if (customproperty.isEmpty()) {
|
||||
QComboBox *cb = qobject_cast<QComboBox *>(w);
|
||||
if (cb) {
|
||||
if (cb->isEditable()) {
|
||||
|
@ -472,12 +440,12 @@ void KConfigDialogManager::setProperty(QWidget *w, const QVariant &v)
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (userproperty.isEmpty()) {
|
||||
if (customproperty.isEmpty()) {
|
||||
kWarning(s_kconfigdialogmanagerarea) << w->metaObject()->className() << " widget not handled!";
|
||||
return;
|
||||
}
|
||||
|
||||
w->setProperty(userproperty, v);
|
||||
w->setProperty(customproperty, v);
|
||||
}
|
||||
|
||||
QVariant KConfigDialogManager::property(QWidget *w) const
|
||||
|
@ -486,11 +454,8 @@ QVariant KConfigDialogManager::property(QWidget *w) const
|
|||
if (bg && bg->checkedButton())
|
||||
return QVariant(bg->id(bg->checkedButton()));*/
|
||||
|
||||
QByteArray userproperty = getCustomProperty(w);
|
||||
if (userproperty.isEmpty()) {
|
||||
userproperty = getUserProperty(w);
|
||||
}
|
||||
if (userproperty.isEmpty()) {
|
||||
QByteArray customproperty = getCustomProperty(w);
|
||||
if (customproperty.isEmpty()) {
|
||||
QComboBox *cb = qobject_cast<QComboBox *>(w);
|
||||
if (cb) {
|
||||
if (cb->isEditable()) {
|
||||
|
@ -500,12 +465,12 @@ QVariant KConfigDialogManager::property(QWidget *w) const
|
|||
}
|
||||
}
|
||||
}
|
||||
if (userproperty.isEmpty()) {
|
||||
if (customproperty.isEmpty()) {
|
||||
kWarning(s_kconfigdialogmanagerarea) << w->metaObject()->className() << " widget not handled!";
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
return w->property(userproperty);
|
||||
return w->property(customproperty);
|
||||
}
|
||||
|
||||
bool KConfigDialogManager::hasChanged() const
|
||||
|
|
|
@ -49,7 +49,7 @@ class KConfigSkeletonItem;
|
|||
* New widgets can be added to the map using the static functions propertyMap() and
|
||||
* changedMap(). Note that you can't just add any class. The class must have a
|
||||
* matching Q_PROPERTY(...) macro defined, and a signal which emitted when the
|
||||
* property changed. Note: by default, the property which defined as "USER true"
|
||||
* property changed. Note: by default, the property which defined as "kcfg_property"
|
||||
* is used.
|
||||
*
|
||||
* For example (note that KColorButton is already added and it doesn't need to
|
||||
|
@ -57,7 +57,7 @@ class KConfigSkeletonItem;
|
|||
*
|
||||
* kcolorbutton.h defines the following property:
|
||||
* \code
|
||||
* Q_PROPERTY( QColor color READ color WRITE setColor USER true )
|
||||
* Q_PROPERTY( QColor color READ color WRITE setColor )
|
||||
* \endcode
|
||||
* and signal:
|
||||
* \code
|
||||
|
@ -70,8 +70,8 @@ class KConfigSkeletonItem;
|
|||
* KConfigDialogManager::changedMap()->insert("KColorButton", SIGNAL(changed(const QColor &)));
|
||||
* \endcode
|
||||
*
|
||||
* If you want to use a widget's property that is not the USER property,
|
||||
* you can define which property to use in the widget's kcfg_property:
|
||||
* If you want to use a widget's property define which property to use in the widget's
|
||||
* kcfg_property:
|
||||
* \code
|
||||
* KUrlRequester *myWidget = new KUrlRequester;
|
||||
* myWidget->setProperty("kcfg_property", QByteArray("text"));
|
||||
|
@ -208,18 +208,10 @@ protected:
|
|||
* widget that are known.
|
||||
* @return bool - If a widget was set to something other than its default.
|
||||
*/
|
||||
bool parseChildren(const QWidget *widget, bool trackChanges);
|
||||
|
||||
/**
|
||||
* Finds the USER property name using Qt's MetaProperty system, and caches
|
||||
* it in the property map (the cache could be retrieved by propertyMap() ).
|
||||
*/
|
||||
QByteArray getUserProperty(const QWidget *widget) const;
|
||||
|
||||
/**
|
||||
* Find the property to use for a widget by querying the kcfg_property
|
||||
* property of the widget. Like a widget can use a property other than the
|
||||
* USER property.
|
||||
* property of the widget.
|
||||
* @since 4.3
|
||||
*/
|
||||
QByteArray getCustomProperty(const QWidget *widget) const;
|
||||
|
|
|
@ -46,7 +46,7 @@ class KDEUI_EXPORT KFontRequester : public QWidget
|
|||
Q_OBJECT
|
||||
Q_PROPERTY(QString title READ title WRITE setTitle)
|
||||
Q_PROPERTY(QString sampleText READ sampleText WRITE setSampleText)
|
||||
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontSelected USER true)
|
||||
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontSelected)
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,7 @@ class KDEUI_EXPORT KButtonGroup : public QGroupBox
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(int current READ selected WRITE setSelected NOTIFY changed USER true)
|
||||
Q_PROPERTY(int current READ selected WRITE setSelected NOTIFY changed)
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -51,7 +51,7 @@ class KDEUI_EXPORT KEditListWidget : public QWidget
|
|||
|
||||
Q_FLAGS( Buttons )
|
||||
Q_PROPERTY( Buttons buttons READ buttons WRITE setButtons )
|
||||
Q_PROPERTY( QStringList items READ items WRITE setItems NOTIFY changed USER true )
|
||||
Q_PROPERTY( QStringList items READ items WRITE setItems NOTIFY changed )
|
||||
Q_PROPERTY( bool checkAtEntering READ checkAtEntering WRITE setCheckAtEntering )
|
||||
|
||||
public:
|
||||
|
|
|
@ -163,7 +163,7 @@ private:
|
|||
class KDEUI_EXPORT KIntNumInput : public KNumInput
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( int value READ value WRITE setValue NOTIFY valueChanged USER true )
|
||||
Q_PROPERTY( int value READ value WRITE setValue NOTIFY valueChanged )
|
||||
Q_PROPERTY( int minimum READ minimum WRITE setMinimum )
|
||||
Q_PROPERTY( int maximum READ maximum WRITE setMaximum )
|
||||
Q_PROPERTY( int singleStep READ singleStep WRITE setSingleStep )
|
||||
|
@ -410,7 +410,7 @@ private:
|
|||
class KDEUI_EXPORT KDoubleNumInput : public KNumInput
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( double value READ value WRITE setValue NOTIFY valueChanged USER true )
|
||||
Q_PROPERTY( double value READ value WRITE setValue NOTIFY valueChanged )
|
||||
Q_PROPERTY( double minimum READ minimum WRITE setMinimum )
|
||||
Q_PROPERTY( double maximum READ maximum WRITE setMaximum )
|
||||
Q_PROPERTY( double singleStep READ singleStep WRITE setSingleStep )
|
||||
|
|
|
@ -47,8 +47,8 @@
|
|||
class KIO_EXPORT KUrlComboBox : public KComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QStringList urls READ urls WRITE setUrls DESIGNABLE true)
|
||||
Q_PROPERTY(int maxItems READ maxItems WRITE setMaxItems DESIGNABLE true)
|
||||
Q_PROPERTY(QStringList urls READ urls WRITE setUrls)
|
||||
Q_PROPERTY(int maxItems READ maxItems WRITE setMaxItems)
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -55,7 +55,7 @@ class KUrlCompletion;
|
|||
class KIO_EXPORT KUrlRequester : public KHBox
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( KUrl url READ url WRITE setUrl NOTIFY textChanged USER true )
|
||||
Q_PROPERTY( KUrl url READ url WRITE setUrl NOTIFY textChanged )
|
||||
Q_PROPERTY( QString filter READ filter WRITE setFilter )
|
||||
Q_PROPERTY( KFile::Modes mode READ mode WRITE setMode )
|
||||
Q_PROPERTY( QString clickMessage READ clickMessage WRITE setClickMessage )
|
||||
|
|
Loading…
Add table
Reference in a new issue