diff --git a/src/kiwixapp.cpp b/src/kiwixapp.cpp index 19f8f06..f484d19 100644 --- a/src/kiwixapp.cpp +++ b/src/kiwixapp.cpp @@ -15,6 +15,22 @@ #include #include +namespace { +void log_QStyle_class_name(const char *descr, const QStyle *style) +{ + QStringList h; + h << style->metaObject()->className(); + + auto sc = style->metaObject()->superClass(); + while(sc) { + h << sc->className(); + sc = sc->superClass(); + } + + qDebug() << descr << h; +} +} + KiwixApp::KiwixApp(int& argc, char *argv[]) : QtSingleApplication("kiwix-desktop", argc, argv), m_settingsManager(), @@ -69,12 +85,24 @@ void KiwixApp::init() setApplicationName("Kiwix"); setDesktopFileName("kiwix.desktop"); + log_QStyle_class_name("------ QStyle before CSS is set:", qApp->style()); + if (qApp->style() != qApp->style()->proxy()) + log_QStyle_class_name("Its proxy style is:", qApp->style()->proxy()); + QPalette tbp1 = QApplication::palette("QTabBar"); + qDebug() << "tabbar pallete:" << tbp1; + QFile styleFile(":/css/style.css"); styleFile.open(QIODevice::ReadOnly); auto byteContent = styleFile.readAll(); QString style(byteContent); setStyleSheet(style); + log_QStyle_class_name("------ QStyle after CSS was set:", qApp->style()); + if (qApp->style() != qApp->style()->proxy()) + log_QStyle_class_name("Its proxy style is:", qApp->style()->proxy()); + QPalette tbp2 = QApplication::palette("QTabBar"); + qDebug() << "tabbar pallete:" << tbp2; + qDebug() << "-----------------------------"; createAction(); mp_mainWindow = new MainWindow; diff --git a/src/tabbar.cpp b/src/tabbar.cpp index d66df28..6097f09 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -395,7 +395,8 @@ void TabBar::paintEvent(QPaintEvent *e) bool selected = tab.state & QStyle::State_Selected; - QColor c0 = tab.palette.button().color(); + QPalette tabbar_palette = QApplication::palette("QTabBar"); + QColor c0 = tabbar_palette.window().color(); if (selected) { /* We cannot just get back from QStyleSheetStyle (Qt private classes)