From 5abfd7c00bc7ebfec2f059adc9bc22eb989ae10d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 4 Dec 2014 15:53:35 +0100 Subject: Let style plugins bundle resources Add internal hooks that get called for style plugins that implement them. The hooks allow standalone style bundles to initialize their resources (to make them visible to controls) and to specify the QRC location of its QML files, eg. qrc:/path/to/Style. Change-Id: I29c4e337e893f7aa65af7b05ff467e15bc84bf43 Reviewed-by: Gatis Paeglis Reviewed-by: Mitch Curtis --- src/controls/Private/qquickcontrolsettings.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/controls/Private/qquickcontrolsettings.cpp b/src/controls/Private/qquickcontrolsettings.cpp index eca533d7..ca57f394 100644 --- a/src/controls/Private/qquickcontrolsettings.cpp +++ b/src/controls/Private/qquickcontrolsettings.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -128,11 +129,29 @@ QQuickControlSettings::QQuickControlSettings(QQmlEngine *engine) if (fromResource(path)) path = path.remove(0, 3); // remove qrc from the path - if (!QDir(path).exists()) { + QDir dir(path); + if (!dir.exists()) { QString unknownStyle = m_name; m_name = defaultStyleName(); m_path = styleImportPath(engine, m_name); qWarning() << "WARNING: Cannot find style" << unknownStyle << "- fallback:" << styleFilePath(); + } else { + typedef bool (*StyleInitFunc)(); + typedef const char *(*StylePathFunc)(); + + foreach (const QString &fileName, dir.entryList()) { + if (QLibrary::isLibrary(fileName)) { + QLibrary lib(dir.absoluteFilePath(fileName)); + StyleInitFunc initFunc = (StyleInitFunc) lib.resolve("qt_quick_controls_style_init"); + if (initFunc) + initFunc(); + StylePathFunc pathFunc = (StylePathFunc) lib.resolve("qt_quick_controls_style_path"); + if (pathFunc) + m_path = QString::fromLocal8Bit(pathFunc()); + if (initFunc || pathFunc) + break; + } + } } connect(this, SIGNAL(styleNameChanged()), SIGNAL(styleChanged())); -- cgit v1.2.1 From 1ce34aa1c88d98120c3f632caffac19c2a834deb Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 14 Jan 2015 10:30:55 +0100 Subject: Doc: link issues qtquickcontrols Change-Id: I42b98f9394267cf56930edc13d9942bda6ebfcda Task-number: QTBUG-43810 Reviewed-by: Martin Smith --- src/controls/Styles/Base/MenuBarStyle.qml | 2 +- src/controls/Styles/Base/MenuStyle.qml | 2 +- src/controls/qquickmenuitem.cpp | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/controls/Styles/Base/MenuBarStyle.qml b/src/controls/Styles/Base/MenuBarStyle.qml index 40e6ea5d..c49dbb1d 100644 --- a/src/controls/Styles/Base/MenuBarStyle.qml +++ b/src/controls/Styles/Base/MenuBarStyle.qml @@ -65,7 +65,7 @@ Style { for \c underline will return the plain text form (e.g., \c formatMnemonic("&File", false) will return \c "File"). - \sa label + \sa Label */ function formatMnemonic(text, underline) { return underline ? StyleHelpers.stylizeMnemonics(text) : StyleHelpers.removeMnemonics(text) diff --git a/src/controls/Styles/Base/MenuStyle.qml b/src/controls/Styles/Base/MenuStyle.qml index 61202bae..a63fd358 100644 --- a/src/controls/Styles/Base/MenuStyle.qml +++ b/src/controls/Styles/Base/MenuStyle.qml @@ -106,7 +106,7 @@ Style { for \c underline will return the plain text form (e.g., \c formatMnemonic("&Open...", false) will return \c "Open..."). - \sa label + \sa Label */ function formatMnemonic(text, underline) { return underline ? StyleHelpers.stylizeMnemonics(text) : StyleHelpers.removeMnemonics(text) diff --git a/src/controls/qquickmenuitem.cpp b/src/controls/qquickmenuitem.cpp index 275a6fa7..447db00c 100644 --- a/src/controls/qquickmenuitem.cpp +++ b/src/controls/qquickmenuitem.cpp @@ -177,8 +177,9 @@ void QQuickMenuBase::setVisualItem(QQuickItem *item) /*! \qmlproperty enumeration MenuSeparator::type + \readonly - This property is read-only and constant, and its value is \l MenuItemType.Separator. + This property is read-only and constant, and its value is \c MenuItemType.Separator. */ QQuickMenuSeparator::QQuickMenuSeparator(QObject *parent) @@ -320,8 +321,9 @@ void QQuickMenuText::updateIcon() /*! \qmlproperty enumeration MenuItem::type + \readonly - This property is read-only and constant, and its value is \l MenuItemType.Item. + This property is read-only and constant, and its value is \c MenuItemType.Item. */ /*! -- cgit v1.2.1