diff --git a/.gitignore b/.gitignore index ee4c926..513eaeb 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/test +build +*.kdev4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bb3e57..4123d62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) project(lxqt-qtplugin) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -10,11 +10,7 @@ find_package(Qt5LinguistTools REQUIRED QUIET) find_package(lxqt REQUIRED QUIET) -include(${LXQT_USE_FILE}) - -if(CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -Wl,-no-undefined -Wall") -endif() +include(LXQtCompilerSettings NO_POLICY_SCOPE) add_subdirectory(src) diff --git a/lxqt-qtplugin.kdev4 b/lxqt-qtplugin.kdev4 deleted file mode 100644 index 740812d..0000000 --- a/lxqt-qtplugin.kdev4 +++ /dev/null @@ -1,3 +0,0 @@ -[Project] -Manager=KDevCMakeManager -Name=lxqt-qtplugin diff --git a/src/lxqtplatformtheme.cpp b/src/lxqtplatformtheme.cpp index a7b5edc..51f0166 100644 --- a/src/lxqtplatformtheme.cpp +++ b/src/lxqtplatformtheme.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include "qiconloader_p.h" LXQtPlatformTheme::LXQtPlatformTheme(): @@ -157,7 +158,11 @@ void LXQtPlatformTheme::onSettingsChanged() { loadSettings(); // reload the config file if(style_ != oldStyle) // the widget style is changed - qApp->setStyle(style_); // ask Qt5 to apply the new style + { + // ask Qt5 to apply the new style + if (qobject_cast(QCoreApplication::instance())) + QApplication::setStyle(style_); + } if(iconTheme_ != oldIconTheme) { // the icon theme is changed QIconLoader::instance()->updateSystemTheme(); // this is a private internal API of Qt5. @@ -198,12 +203,15 @@ bool LXQtPlatformTheme::usePlatformNativeDialog(DialogType type) const { QPlatformDialogHelper *LXQtPlatformTheme::createPlatformDialogHelper(DialogType type) const { return 0; } +#endif const QPalette *LXQtPlatformTheme::palette(Palette type) const { - return new QPalette(); -} -#endif + if (type == QPlatformTheme::SystemPalette) + // the default constructor uses the default palette + return new QPalette; + return QPlatformTheme::palette(type); +} const QFont *LXQtPlatformTheme::font(Font type) const { // qDebug() << "font()" << type << SystemFont; @@ -250,7 +258,7 @@ QVariant LXQtPlatformTheme::themeHint(ThemeHint hint) const { case ItemViewActivateItemOnSingleClick: return QVariant(singleClickActivate_); case SystemIconThemeName: - qDebug() << "iconTheme" << iconTheme_; + // qDebug() << "iconTheme" << iconTheme_; return iconTheme_; case SystemIconFallbackThemeName: return "hicolor"; diff --git a/src/lxqtplatformtheme.h b/src/lxqtplatformtheme.h index abba806..42f8ccf 100644 --- a/src/lxqtplatformtheme.h +++ b/src/lxqtplatformtheme.h @@ -24,7 +24,7 @@ * Boston, MA 02110-1301 USA * * END_COMMON_COPYRIGHT_HEADER */ - + #ifndef LXQTPLATFORMTHEME_H #define LXQTPLATFORMTHEME_H @@ -48,7 +48,7 @@ public: virtual bool usePlatformNativeDialog(DialogType type) const; // virtual QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const; - // virtual const QPalette *palette(Palette type = SystemPalette) const; + virtual const QPalette *palette(Palette type = SystemPalette) const; virtual const QFont *font(Font type = SystemFont) const;