From 956cfc5a595c1ee3ae60987dd6bfa356489388f4 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 26 Apr 2024 22:38:19 +0300 Subject: [PATCH] generic: prepare for Katie changes Signed-off-by: Ivailo Monev --- kdeui/colors/kcolorbutton.h | 2 +- kdeui/colors/kcolorcombo.h | 2 +- kdeui/dialogs/kconfigdialogmanager.cpp | 51 ++++---------------------- kdeui/dialogs/kconfigdialogmanager.h | 18 +++------ kdeui/fonts/kfontrequester.h | 2 +- kdeui/widgets/kbuttongroup.h | 2 +- kdeui/widgets/keditlistwidget.h | 2 +- kdeui/widgets/knuminput.h | 4 +- kio/kfile/kurlcombobox.h | 4 +- kio/kfile/kurlrequester.h | 2 +- 10 files changed, 23 insertions(+), 66 deletions(-) diff --git a/kdeui/colors/kcolorbutton.h b/kdeui/colors/kcolorbutton.h index 518e4172..d9c9c7f4 100644 --- a/kdeui/colors/kcolorbutton.h +++ b/kdeui/colors/kcolorbutton.h @@ -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 ) diff --git a/kdeui/colors/kcolorcombo.h b/kdeui/colors/kcolorcombo.h index 3ba65eaa..f6534fdb 100644 --- a/kdeui/colors/kcolorcombo.h +++ b/kdeui/colors/kcolorcombo.h @@ -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: /** diff --git a/kdeui/dialogs/kconfigdialogmanager.cpp b/kdeui/dialogs/kconfigdialogmanager.cpp index bfc80885..862bb93e 100644 --- a/kdeui/dialogs/kconfigdialogmanager.cpp +++ b/kdeui/dialogs/kconfigdialogmanager.cpp @@ -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(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(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(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 diff --git a/kdeui/dialogs/kconfigdialogmanager.h b/kdeui/dialogs/kconfigdialogmanager.h index c21d8fa3..75517290 100644 --- a/kdeui/dialogs/kconfigdialogmanager.h +++ b/kdeui/dialogs/kconfigdialogmanager.h @@ -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; diff --git a/kdeui/fonts/kfontrequester.h b/kdeui/fonts/kfontrequester.h index 33f78d85..70b1a7e2 100644 --- a/kdeui/fonts/kfontrequester.h +++ b/kdeui/fonts/kfontrequester.h @@ -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: /** diff --git a/kdeui/widgets/kbuttongroup.h b/kdeui/widgets/kbuttongroup.h index 3ef0ec71..eaae9bfb 100644 --- a/kdeui/widgets/kbuttongroup.h +++ b/kdeui/widgets/kbuttongroup.h @@ -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: /** diff --git a/kdeui/widgets/keditlistwidget.h b/kdeui/widgets/keditlistwidget.h index 4c0dcbfb..f4c87c02 100644 --- a/kdeui/widgets/keditlistwidget.h +++ b/kdeui/widgets/keditlistwidget.h @@ -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: diff --git a/kdeui/widgets/knuminput.h b/kdeui/widgets/knuminput.h index df87ba46..5e2ff113 100644 --- a/kdeui/widgets/knuminput.h +++ b/kdeui/widgets/knuminput.h @@ -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 ) diff --git a/kio/kfile/kurlcombobox.h b/kio/kfile/kurlcombobox.h index b39491d9..77647ed2 100644 --- a/kio/kfile/kurlcombobox.h +++ b/kio/kfile/kurlcombobox.h @@ -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: /** diff --git a/kio/kfile/kurlrequester.h b/kio/kfile/kurlrequester.h index 9e8e9393..531df290 100644 --- a/kio/kfile/kurlrequester.h +++ b/kio/kfile/kurlrequester.h @@ -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 )