diff options
Diffstat (limited to 'src/controls')
-rw-r--r-- | src/controls/Private/qquickcontrolsettings.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
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 <qquickitem.h> #include <qcoreapplication.h> #include <qqmlengine.h> +#include <qlibrary.h> #include <qdir.h> #include <QTouchDevice> #include <QGuiApplication> @@ -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())); |