aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2/qquickstyleselector.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2018-03-13 14:31:25 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2018-03-13 14:33:12 +0000
commit8526714ee51726be76f45309034adfb47ba571a4 (patch)
treec275ad2176411f7f800e0e7e27f905c97841952e /src/quickcontrols2/qquickstyleselector.cpp
parent99f66b6506a512d8b3ff75798e868709ddbf9b38 (diff)
Add "qt.quick.controls.style" logging category for style lookup
Helps to debug where the .qml files are selected from. Especially with the upcoming Qt Quick Compiler and QRC changes, it will be important to be able to verify which files are being used, but this also helps investigating issues with custom styles. Change-Id: I2b2b4f57b3288e0ab204c624ef6d8eb92268698b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quickcontrols2/qquickstyleselector.cpp')
-rw-r--r--src/quickcontrols2/qquickstyleselector.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/quickcontrols2/qquickstyleselector.cpp b/src/quickcontrols2/qquickstyleselector.cpp
index 1dee4dcc..d11a95bd 100644
--- a/src/quickcontrols2/qquickstyleselector.cpp
+++ b/src/quickcontrols2/qquickstyleselector.cpp
@@ -43,10 +43,13 @@
#include <QtCore/qfileinfo.h>
#include <QtCore/qlocale.h>
+#include <QtCore/qloggingcategory.h>
#include <QtCore/private/qfileselector_p.h>
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcQtQuickControlsStyle, "qt.quick.controls.style")
+
static QString ensureSlash(const QString &path)
{
if (path.isEmpty() || path.endsWith(QLatin1Char('/')))
@@ -130,6 +133,7 @@ QUrl QQuickStyleSelector::select(const QString &fileName) const
// 1) requested style (e.g. "MyStyle", included in d->selectors)
// 2) fallback style (e.g. "Material", included in d->selectors)
// 3) default style (empty selector, not in d->selectors)
+ qCDebug(lcQtQuickControlsStyle) << "selecting" << fileName << "from" << d->paths << "with selectors" << d->selectors;
int to = d->selectors.count() - 1;
if (d->selectors.isEmpty() || !d->selectors.first().isEmpty())
@@ -140,8 +144,10 @@ QUrl QQuickStyleSelector::select(const QString &fileName) const
const QString selector = d->selectors.value(i);
for (const QString &path : d->paths) {
const QUrl selectedUrl = d->select(ensureSlash(path) + selector + QLatin1Char('/') + fileName);
- if (selectedUrl.isValid())
+ if (selectedUrl.isValid()) {
+ qCDebug(lcQtQuickControlsStyle) << "==>" << selectedUrl << "from" << path << "with selector" << selector;
return selectedUrl;
+ }
}
}