From 3f3c938ac860ed4c0d18d601a4d0f97f9b1b35af Mon Sep 17 00:00:00 2001 From: John Tapsell Date: Wed, 1 Sep 2010 16:16:32 +0900 Subject: Changes: MAbstractLayoutPolicy - Rename from setObjectName to setStyleName, to mimic MWidgetController RevBy: Stanislav --- src/corelib/layout/mabstractlayoutpolicy.cpp | 16 ++++++++++++---- src/corelib/layout/mabstractlayoutpolicy.h | 24 +++++++++++++++--------- src/corelib/layout/mabstractlayoutpolicy_p.h | 4 ++-- 3 files changed, 29 insertions(+), 15 deletions(-) (limited to 'src/corelib/layout') diff --git a/src/corelib/layout/mabstractlayoutpolicy.cpp b/src/corelib/layout/mabstractlayoutpolicy.cpp index 8b1c0bdd..c5246df6 100644 --- a/src/corelib/layout/mabstractlayoutpolicy.cpp +++ b/src/corelib/layout/mabstractlayoutpolicy.cpp @@ -139,7 +139,7 @@ void MAbstractLayoutPolicy::updateStyle() const MAbstractLayoutPolicyStyle *style = static_cast(MTheme::style( - "MAbstractLayoutPolicyStyle", d->objectName, "", "", + "MAbstractLayoutPolicyStyle", d->styleName, "", "", orientation)); if (d->style != style) { @@ -189,17 +189,25 @@ void MAbstractLayoutPolicy::applyStyle() } void MAbstractLayoutPolicy::setObjectName(const QString &name) +{ + setStyleName(name); +} +void MAbstractLayoutPolicy::setStyleName(const QString &name) { Q_D(MAbstractLayoutPolicy); - if (name == d->objectName) + if (name == d->styleName) return; - d->objectName = name; + d->styleName = name; updateStyle(); } QString MAbstractLayoutPolicy::objectName() const +{ + return styleName(); +} +QString MAbstractLayoutPolicy::styleName() const { Q_D(const MAbstractLayoutPolicy); - return d->objectName; + return d->styleName; } const MAbstractLayoutPolicyStyle *MAbstractLayoutPolicy::style() const diff --git a/src/corelib/layout/mabstractlayoutpolicy.h b/src/corelib/layout/mabstractlayoutpolicy.h index d7ce6b73..1fccd3eb 100644 --- a/src/corelib/layout/mabstractlayoutpolicy.h +++ b/src/corelib/layout/mabstractlayoutpolicy.h @@ -58,14 +58,14 @@ class QGraphicsLayoutItem; * \section styling_policy CSS Styling of Policies * * Policies can be styled in the CSS stylesheet files, however the class name is always - * MAbstractLayoutPolicy. Their object name can be set with setObjectName() and they + * MAbstractLayoutPolicy. Their object name can be set with setStyleName() and they * can be styled different depending on the current device orientation. * * For example: * * \code * MLinearLayoutPolicy mypolicy(mylayout); - * mypolicy.setObjectName("address"); + * mypolicy.setStyleName("address"); * \endcode * could then be styled in the .css file with * \code @@ -260,12 +260,12 @@ public: /*! \brief Sets the name of this policy, for CSS styling. * - * This is similar to QObject::setObjectName() and is used as + * This is similar to MWidgetController::setStyleName() and is used as * the object name for the MStyle object name. * For example: * \code * MLinearLayoutPolicy mypolicy(mylayout); - * mypolicy.setObjectName("address"); + * mypolicy.setStyleName("address"); * \endcode * could then be styled in the .css file with * \code @@ -278,15 +278,21 @@ public: * * \param name object name */ - void setObjectName(const QString &name); + void setStyleName(const QString &name); - /*! \brief Return the name of this policy, for CSS styling + /*! \brief Return the name of this policy, for CSS styling. * - * This is similar in functionality and usage to QObject::objectName() + * This is similar in functionality and usage to MWidgetController::styleName() * - * \sa setObjectName(const QString &) + * \sa setStyleName(const QString &) */ - QString objectName() const; + QString styleName() const; + + /*! \internal + * For backwards compatibility - these just call setStyleName and styleName */ + void Q_DECL_DEPRECATED setObjectName(const QString &name); + QString Q_DECL_DEPRECATED objectName() const; + /*! \internal_end */ /*! * \brief Set the horizontal spacing. diff --git a/src/corelib/layout/mabstractlayoutpolicy_p.h b/src/corelib/layout/mabstractlayoutpolicy_p.h index f3006e0c..11196e13 100644 --- a/src/corelib/layout/mabstractlayoutpolicy_p.h +++ b/src/corelib/layout/mabstractlayoutpolicy_p.h @@ -72,8 +72,8 @@ public: /** Style for the abstract policy, but can be also used for inheriting policies */ const MAbstractLayoutPolicyStyle *style; - /** Name for this policy for MStyle. Similar to the QObject::objectName() property */ - QString objectName; + /** Name for this policy for MStyle. Similar to the MWidgetController::styleName() property */ + QString styleName; /** List of items in this policy, as an index of layout */ QList items; -- cgit v1.2.3