Commit 94c85631 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii Committed by Vlad Zahorodnii

[kstyle] Drop Qt 4 style plugin

Summary:
KWindowSystem cannot be used in the Qt 4 style plugin. On the other hand,
we need to use KWindowSystem to make QWidget-based internal clients in
KWin cast drop-shadows.

Another problem with the Qt 4 style plugin is that some distributions
have already dropped Qt 4 (it's been EOL for almost 5 years), so one has
to build it in order to verify that his or her change works with Qt 4.

Given maintenance burden and the fact that Qt 6 is around the corner,
this change drops the Qt 4 style plugin.

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, plasma-devel

Tags: #plasma

Maniphest Tasks: T12496

Differential Revision: https://phabricator.kde.org/D26621
parent 05e2ffa5
......@@ -7,97 +7,58 @@ include(GenerateExportHeader)
include(WriteBasicConfigVersionFile)
include(FeatureSummary)
set(OXYGEN_USE_KDE4 ${USE_KDE4})
if(OXYGEN_USE_KDE4)
############ Language and toolchain features
############ copied from ECM
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" AND NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
endif()
endif()
################# Qt/KDE #################
if(OXYGEN_USE_KDE4)
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
include(MacroLibrary)
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories(${KDE4_INCLUDES})
### XCB
find_package(PkgConfig)
pkg_check_modules(XCB xcb x11-xcb)
add_feature_info("x11-xcb" XCB_FOUND "Required to pass style properties to native Windows on X11 Platform")
set_feature_info("x11-xcb" "Required to pass style properties to native Windows on X11 Platform" "http://xcb.freedesktop.org")
set(OXYGEN_HAVE_X11 ${XCB_FOUND})
set(OXYGEN_HAVE_KWAYLAND FALSE)
add_subdirectory(liboxygen)
add_subdirectory(kstyle)
else()
find_package(ECM 0.0.9 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(Qt5 REQUIRED CONFIG COMPONENTS Widgets DBus Quick)
find_package(KF5 REQUIRED COMPONENTS
I18n
Config
GuiAddons
WidgetsAddons
Service
Completion
FrameworkIntegration
WindowSystem)
find_package(XCB COMPONENTS XCB)
set_package_properties(XCB PROPERTIES
DESCRIPTION "X protocol C-language Binding"
URL "http://xcb.freedesktop.org"
TYPE OPTIONAL
PURPOSE "Required to pass style properties to native Windows on X11 Platform"
)
find_package(KF5Wayland CONFIG)
set(OXYGEN_HAVE_KWAYLAND ${KF5Wayland_FOUND})
if(NOT APPLE)
find_package(ECM 0.0.9 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(Qt5 REQUIRED CONFIG COMPONENTS Widgets DBus Quick)
find_package(KF5 REQUIRED COMPONENTS
I18n
Config
GuiAddons
WidgetsAddons
Service
Completion
FrameworkIntegration
WindowSystem)
find_package(XCB COMPONENTS XCB)
set_package_properties(XCB PROPERTIES
DESCRIPTION "X protocol C-language Binding"
URL "http://xcb.freedesktop.org"
TYPE OPTIONAL
PURPOSE "Required to pass style properties to native Windows on X11 Platform"
)
find_package(KF5Wayland CONFIG)
set(OXYGEN_HAVE_KWAYLAND ${KF5Wayland_FOUND})
if(NOT APPLE)
set(OXYGEN_HAVE_X11 ${XCB_XCB_FOUND})
if (XCB_XCB_FOUND)
find_package(Qt5 REQUIRED CONFIG COMPONENTS X11Extras)
find_package(Qt5 REQUIRED CONFIG COMPONENTS X11Extras)
endif()
endif()
endif()
include(ECMInstallIcons)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMInstallIcons)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
add_subdirectory(liboxygen)
add_subdirectory(kstyle)
add_subdirectory(color-schemes)
add_subdirectory(cursors)
add_subdirectory(sounds)
add_subdirectory(kdecoration)
add_subdirectory(liboxygen)
add_subdirectory(kstyle)
add_subdirectory(color-schemes)
add_subdirectory(cursors)
add_subdirectory(sounds)
add_subdirectory(kdecoration)
install(DIRECTORY lookandfeel/ DESTINATION ${KDE_INSTALL_DATADIR}/plasma/look-and-feel/org.kde.oxygen
PATTERN "Messages.sh" EXCLUDE PATTERN "CMakeLists.txt" EXCLUDE)
install(DIRECTORY lookandfeel/ DESTINATION ${KDE_INSTALL_DATADIR}/plasma/look-and-feel/org.kde.oxygen
PATTERN "Messages.sh" EXCLUDE PATTERN "CMakeLists.txt" EXCLUDE)
# po/ dir added by packaging scripts
if(EXISTS ${CMAKE_SOURCE_DIR}/po AND IS_DIRECTORY ${CMAKE_SOURCE_DIR}/po)
# po/ dir added by packaging scripts
if(EXISTS ${CMAKE_SOURCE_DIR}/po AND IS_DIRECTORY ${CMAKE_SOURCE_DIR}/po)
find_package(KF5I18n CONFIG REQUIRED)
ki18n_install(po)
endif()
endif()
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
......@@ -66,42 +66,24 @@ set(oxygen_PART_SRCS
oxygenwindowmanager.cpp
)
if(OXYGEN_USE_KDE4)
kconfig_add_kcfg_files(oxygen_PART_SRCS oxygenstyleconfigdata.kcfgc)
add_library(oxygen MODULE ${oxygen_PART_SRCS})
kde4_add_kcfg_files(oxygen_PART_SRCS oxygenstyleconfigdata.kcfgc)
kde4_add_plugin(oxygen ${oxygen_PART_SRCS} kstylekde4compat.cpp)
target_link_libraries(oxygen ${KDE4_KDEUI_LIBS})
target_link_libraries(oxygen oxygenstyle)
target_link_libraries(oxygen Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus Qt5::Quick)
target_link_libraries(oxygen KF5::GuiAddons KF5::Style KF5::WindowSystem)
target_link_libraries(oxygen oxygenstyle5)
if(OXYGEN_HAVE_X11)
target_link_libraries(oxygen ${X11_XCB_LIBRARIES})
target_link_libraries(oxygen ${XCB_LIBRARIES})
endif()
install(TARGETS oxygen DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/styles/)
else()
kconfig_add_kcfg_files(oxygen_PART_SRCS oxygenstyleconfigdata.kcfgc)
add_library(oxygen MODULE ${oxygen_PART_SRCS})
target_link_libraries(oxygen Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus Qt5::Quick)
target_link_libraries(oxygen KF5::GuiAddons KF5::Style KF5::WindowSystem)
target_link_libraries(oxygen oxygenstyle5)
if(OXYGEN_HAVE_X11)
if(OXYGEN_HAVE_X11)
target_link_libraries(oxygen XCB::XCB)
target_link_libraries(oxygen Qt5::X11Extras)
endif()
endif()
if(OXYGEN_HAVE_KWAYLAND)
if(OXYGEN_HAVE_KWAYLAND)
target_link_libraries(oxygen KF5::WaylandClient)
endif()
install(TARGETS oxygen DESTINATION ${QT_PLUGIN_INSTALL_DIR}/styles/)
endif()
install(TARGETS oxygen DESTINATION ${QT_PLUGIN_INSTALL_DIR}/styles/)
if(WIN32)
# As stated in http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx M_PI only gets defined
# when using MSVC if _USE_MATH_DEFINES is defined (this is needed for angle.cpp)
......
......@@ -11,70 +11,47 @@ set(kstyle_oxygen_config_PART_FORMS
ui/oxygenstyleconfig.ui
)
if(OXYGEN_USE_KDE4)
set(kstyle_oxygen_config_PART_SRCS ${kstyle_oxygen_config_PART_SRCS} oxygenstyleconfigmodule.cpp)
kde4_add_kcfg_files(kstyle_oxygen_config_PART_SRCS ../oxygenstyleconfigdata.kcfgc)
kconfig_add_kcfg_files(kstyle_oxygen_config_PART_SRCS ../oxygenstyleconfigdata.kcfgc)
kde4_add_ui_files(kstyle_oxygen_config_PART_FORMS_HEADERS ${kstyle_oxygen_config_PART_FORMS})
kde4_add_plugin(kstyle_oxygen_config
${kstyle_oxygen_config_PART_SRCS}
${kstyle_oxygen_config_PART_FORMS_HEADERS}
)
target_link_libraries(kstyle_oxygen_config ${KDE4_KDEUI_LIBS})
target_link_libraries(kstyle_oxygen_config oxygenstyleconfig)
install(TARGETS kstyle_oxygen_config DESTINATION ${PLUGIN_INSTALL_DIR}/)
else()
set(kstyle_oxygen_config_PART_SRCS ${kstyle_oxygen_config_PART_SRCS} oxygenstyleconfigmodule.cpp)
kconfig_add_kcfg_files(kstyle_oxygen_config_PART_SRCS ../oxygenstyleconfigdata.kcfgc)
set(kstyle_oxygen_config_PART_FORMS
set(kstyle_oxygen_config_PART_FORMS
ui/oxygenfollowmouseanimationconfigbox.ui
ui/oxygenstyleconfig.ui
)
ki18n_wrap_ui(kstyle_oxygen_config_PART_FORMS_HEADERS ${kstyle_oxygen_config_PART_FORMS})
)
add_library(kstyle_oxygen_config MODULE
${kstyle_oxygen_config_PART_SRCS}
${kstyle_oxygen_config_PART_FORMS_HEADERS}
)
ki18n_wrap_ui(kstyle_oxygen_config_PART_FORMS_HEADERS ${kstyle_oxygen_config_PART_FORMS})
target_link_libraries(kstyle_oxygen_config Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus)
target_link_libraries(kstyle_oxygen_config KF5::Completion KF5::I18n)
target_link_libraries(kstyle_oxygen_config oxygenstyleconfig5)
add_library(kstyle_oxygen_config MODULE
${kstyle_oxygen_config_PART_SRCS}
${kstyle_oxygen_config_PART_FORMS_HEADERS}
)
install(TARGETS kstyle_oxygen_config DESTINATION ${QT_PLUGIN_INSTALL_DIR})
install(FILES oxygenstyleconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR})
target_link_libraries(kstyle_oxygen_config Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus)
target_link_libraries(kstyle_oxygen_config KF5::Completion KF5::I18n)
target_link_libraries(kstyle_oxygen_config oxygenstyleconfig5)
endif()
install(TARGETS kstyle_oxygen_config DESTINATION ${QT_PLUGIN_INSTALL_DIR})
install(FILES oxygenstyleconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR})
########### next target ###############
if(NOT OXYGEN_USE_KDE4)
find_package(KF5KCMUtils CONFIG)
set_package_properties(KF5KCMUtils PROPERTIES
DESCRIPTION "KF5 KCM utils Framework"
URL "https://projects.kde.org/projects/frameworks/kcmutils"
TYPE OPTIONAL
PURPOSE "Required for oxygen-settings5 application to build")
if( KF5KCMUtils_FOUND )
set(oxygen_settings_SOURCES main.cpp)
add_executable(oxygen-settings5 ${oxygen_settings_SOURCES} )
target_link_libraries(oxygen-settings5 Qt5::Core Qt5::Gui Qt5::Widgets )
target_link_libraries(oxygen-settings5 KF5::I18n KF5::KCMUtils)
install(TARGETS oxygen-settings5 ${INSTALL_TARGETS_DEFAULT_ARGS})
# icon
ecm_install_icons(ICONS 256-apps-oxygen-settings.png
DESTINATION ${ICON_INSTALL_DIR}
THEME hicolor )
endif()
find_package(KF5KCMUtils CONFIG)
set_package_properties(KF5KCMUtils PROPERTIES
DESCRIPTION "KF5 KCM utils Framework"
URL "https://projects.kde.org/projects/frameworks/kcmutils"
TYPE OPTIONAL
PURPOSE "Required for oxygen-settings5 application to build")
if( KF5KCMUtils_FOUND )
set(oxygen_settings_SOURCES main.cpp)
add_executable(oxygen-settings5 ${oxygen_settings_SOURCES} )
target_link_libraries(oxygen-settings5 Qt5::Core Qt5::Gui Qt5::Widgets )
target_link_libraries(oxygen-settings5 KF5::I18n KF5::KCMUtils)
install(TARGETS oxygen-settings5 ${INSTALL_TARGETS_DEFAULT_ARGS})
# icon
ecm_install_icons(ICONS 256-apps-oxygen-settings.png
DESTINATION ${ICON_INSTALL_DIR}
THEME hicolor )
endif()
......@@ -40,9 +40,6 @@ DEALINGS IN THE SOFTWARE.
#include <KLocalizedString>
#include <KSharedConfig>
#include <KConfigGroup>
#if !OXYGEN_USE_KDE4
#include <Kdelibs4Migration>
#endif
#define SCROLLBAR_DEFAULT_WIDTH 15
#define SCROLLBAR_MINIMUM_WIDTH 10
......@@ -105,21 +102,8 @@ namespace Oxygen
_animationConfigWidget->save();
#if OXYGEN_USE_KDE4
StyleConfigData::self()->writeConfig();
#else
StyleConfigData::self()->save();
//update the KDE4 config to match
Kdelibs4Migration migration;
const QString kde4ConfigDirPath = migration.saveLocation("config");
QScopedPointer<KConfig> kde4Config(new KConfig);
StyleConfigData::self()->config()->copyTo(kde4ConfigDirPath+"/oxygenrc", kde4Config.data());
kde4Config->sync();
#endif
// emit dbus signal
QDBusMessage message( QDBusMessage::createSignal( QStringLiteral( "/OxygenStyle" ), QStringLiteral( "org.kde.Oxygen.Style" ), QStringLiteral( "reparseConfiguration" ) ) );
QDBusConnection::sessionBus().send(message);
......@@ -137,11 +121,7 @@ namespace Oxygen
void StyleConfig::reset( void )
{
// reparse configuration
#if OXYGEN_USE_KDE4
StyleConfigData::self()->readConfig();
#else
StyleConfigData::self()->load();
#endif
load();
}
......
......@@ -29,42 +29,24 @@ set(oxygen_demo_FORMS
ui/oxygentabdemowidget.ui
)
if(OXYGEN_USE_KDE4)
kde4_add_ui_files(oxygen_demo_FORMS_HEADERS ${oxygen_demo_FORMS})
kde4_add_executable(oxygen-demo
${oxygen_demo_SOURCES}
${oxygen_demo_FORMS_HEADERS}
)
target_link_libraries(oxygen-demo ${KDE4_KDEUI_LIBS})
########### install files ###############
install(TARGETS oxygen-demo ${INSTALL_TARGETS_DEFAULT_ARGS})
else()
find_package(KF5ConfigWidgets CONFIG)
if(KF5ConfigWidgets_FOUND)
find_package(KF5ConfigWidgets CONFIG)
if(KF5ConfigWidgets_FOUND)
set(oxygen_demo_SOURCES ${oxygen_demo_SOURCES} oxygenschemechooser.cpp oxygenstylechooser.cpp)
add_definitions(-DHAVE_SCHEME_CHOOSER)
endif()
endif()
ki18n_wrap_ui(oxygen_demo_FORMS_HEADERS ${oxygen_demo_FORMS})
ki18n_wrap_ui(oxygen_demo_FORMS_HEADERS ${oxygen_demo_FORMS})
add_executable(oxygen-demo5
${oxygen_demo_SOURCES}
${oxygen_demo_FORMS_HEADERS}
)
add_executable(oxygen-demo5
${oxygen_demo_SOURCES}
${oxygen_demo_FORMS_HEADERS}
)
target_link_libraries(oxygen-demo5 Qt5::Core Qt5::Gui Qt5::Widgets)
target_link_libraries(oxygen-demo5 KF5::Completion KF5::ConfigGui KF5::WidgetsAddons KF5::I18n)
if(KF5ConfigWidgets_FOUND)
target_link_libraries(oxygen-demo5 Qt5::Core Qt5::Gui Qt5::Widgets)
target_link_libraries(oxygen-demo5 KF5::Completion KF5::ConfigGui KF5::WidgetsAddons KF5::I18n)
if(KF5ConfigWidgets_FOUND)
target_link_libraries(oxygen-demo5 KF5::ConfigWidgets)
endif()
########### install files ###############
install(TARGETS oxygen-demo5 ${INSTALL_TARGETS_DEFAULT_ARGS})
endif()
########### install files ###############
install(TARGETS oxygen-demo5 ${INSTALL_TARGETS_DEFAULT_ARGS})
......@@ -29,12 +29,8 @@
#include "config-liboxygen.h"
#include <QApplication>
#if QT_VERSION >= 0x050200
#include <QCommandLineOption>
#include <QCommandLineParser>
#endif
#include <QIcon>
#include <KLocalizedString>
......@@ -46,14 +42,12 @@ namespace Oxygen
{
QApplication app( argc, argv );
#if QT_VERSION >= 0x050200
QCommandLineParser commandLine;
QCommandLineOption enableHighDpi( "highdpi", "Enable High DPI pixmaps" );
commandLine.addOption( enableHighDpi );
commandLine.process( app );
app.setAttribute( Qt::AA_UseHighDpiPixmaps, commandLine.isSet( enableHighDpi ) );
#endif
app.setApplicationName( i18n( "Oxygen Demo" ) );
app.setWindowIcon( QIcon::fromTheme( QStringLiteral( "oxygen" ) ) );
......@@ -68,9 +62,7 @@ namespace Oxygen
//__________________________________________
int main(int argc, char *argv[])
{
#if !OXYGEN_USE_KDE4
KLocalizedString::setApplicationDomain("oxygen_style_demo");
#endif
return Oxygen::run( argc, argv );
......
......@@ -55,27 +55,16 @@ namespace Oxygen
setWindowTitle( i18n( "Oxygen Demo" ) );
#if OXYGEN_USE_KDE4
// install Quit shortcut
connect( new QShortcut( KStandardShortcut::quit().primary(), this ), SIGNAL(activated()), SLOT(close()) );
connect( new QShortcut( KStandardShortcut::quit().alternate(), this ), SIGNAL(activated()), SLOT(close()) );
#else
// install Quit shortcut
foreach( const QKeySequence& sequence, KStandardShortcut::quit() )
{ connect( new QShortcut( sequence, this ), SIGNAL(activated()), SLOT(close()) ); }
#endif
#if OXYGEN_USE_KDE4
setButtons( KDialog::Ok );
auto buttonBox = findChild<QDialogButtonBox*>();
#else
// button box
auto buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok, Qt::Horizontal );
setButtonBox( buttonBox );
// connection
connect( buttonBox->button( QDialogButtonBox::Ok ), SIGNAL(clicked()), SLOT(close()) );
#endif
// customize button box
_enableCheckBox = new QCheckBox( i18n( "Enabled" ) );
......@@ -102,11 +91,7 @@ namespace Oxygen
auto setPageIcon = []( KPageWidgetItem* page, const QString& iconName )
{
#if OXYGEN_USE_KDE4
page->setIcon( KIcon( iconName ) );
#else
page->setIcon( QIcon::fromTheme( iconName ) );
#endif
};
KPageWidgetItem* page = nullptr;
......
......@@ -31,9 +31,7 @@
#include <KComboBox>
#include <KMessageWidget>
#if !OXYGEN_USE_KDE4
#include <kwidgetsaddons_version.h>
#endif
namespace Oxygen
{
......@@ -61,7 +59,7 @@ namespace Oxygen
connect( ui.flatGroupBoxCheckBox, SIGNAL(toggled(bool)), SLOT(toggleFlatGroupBox(bool)) );
addMessages();
#if !OXYGEN_USE_KDE4 && KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(5, 48, 0)
#if KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(5, 48, 0)
qApp->installEventFilter(this);
#endif
}
......@@ -102,7 +100,7 @@ namespace Oxygen
bool FrameDemoWidget::eventFilter( QObject *obj, QEvent *event )
{
#if !OXYGEN_USE_KDE4 && KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(5, 48, 0)
#if KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(5, 48, 0)
if (event->type() == QEvent::DynamicPropertyChange && obj == qApp) {
QDynamicPropertyChangeEvent *e = dynamic_cast<QDynamicPropertyChangeEvent*>(event);
if (e->propertyName() == QByteArrayLiteral("KDE_COLOR_SCHEME_PATH")) {
......
/*************************************************************************
* Copyright (C) 2015 by David Edmundson <davidedmundson@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*************************************************************************/
#include "kstylekde4compat.h"
#include <KConfigGroup>
#include <QToolBar>
#include <KSharedConfig>
static const QStyle::StyleHint SH_KCustomStyleElement = (QStyle::StyleHint)0xff000001;
static const int X_KdeBase = 0xff000000;
//_____________________________________________________________________
KStyleKDE4Compat::KStyleKDE4Compat()
{
controlCounter = subElementCounter = X_KdeBase;
hintCounter = X_KdeBase + 1; //sic! X_KdeBase is covered by SH_KCustomStyleElement
}
//_____________________________________________________________________
static inline int newStyleElement(const QString &element, const char *check, int &counter, QHash<QString, int> *elements)
{
if (!element.contains(check)) return 0;
int id = elements->value(element, 0);
if (!id)
{
++counter;
id = counter;
elements->insert(element, id);
}
return id;
}
//_____________________________________________________________________
QStyle::StyleHint KStyleKDE4Compat::newStyleHint(const QString &element)
{ return (StyleHint)newStyleElement(element, "SH_", hintCounter, &styleElements); }
//_____________________________________________________________________
QStyle::ControlElement KStyleKDE4Compat::newControlElement(const QString &element)
{ return (ControlElement)newStyleElement(element, "CE_", controlCounter, &styleElements); }
//_____________________________________________________________________
QStyle::SubElement KStyleKDE4Compat::newSubElement(const QString &element)
{ return (SubElement)newStyleElement(element, "SE_", subElementCounter, &styleElements); }
//_____________________________________________________________________
int KStyleKDE4Compat::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
{
if( hint == SH_KCustomStyleElement && widget )
{ return styleElements.value(widget->objectName(), 0); }
switch (hint) {
case SH_ItemView_ActivateItemOnSingleClick: {
KConfigGroup g(KSharedConfig::openConfig(), "KDE");
return g.readEntry("SingleClick", true);
}
case SH_DialogButtonBox_ButtonsHaveIcons: {
// was KGlobalSettings::showIconsOnPushButtons() :
KConfigGroup g(KSharedConfig::openConfig(), "KDE");
return g.readEntry("ShowIconsOnPushButtons", true);
}
case SH_ItemView_ArrowKeysNavigateIntoChildren:
return true;
case SH_ToolButtonStyle: {
KConfigGroup g(KSharedConfig::openConfig(), "Toolbar style");
bool useOthertoolbars = false;
const QWidget *parent = widget ? widget->parentWidget() : nullptr;
//If the widget parent is a QToolBar and the magic property is set
if (parent && qobject_cast< const QToolBar * >(parent)) {
if (parent->property("otherToolbar").isValid()) {
useOthertoolbars = true;
}
}
QString buttonStyle;
if (useOthertoolbars) {
buttonStyle = g.readEntry("ToolButtonStyleOtherToolbars", "NoText").toLower();
} else {
buttonStyle = g.readEntry("ToolButtonStyle", "TextBesideIcon").toLower();
}
return buttonStyle == QLatin1String("textbesideicon") ? Qt::ToolButtonTextBesideIcon
: buttonStyle == QLatin1String("icontextright") ? Qt::ToolButtonTextBesideIcon
: buttonStyle == QLatin1String("textundericon") ? Qt::ToolButtonTextUnderIcon
: buttonStyle == QLatin1String("icontextbottom") ? Qt::ToolButtonTextUnderIcon
: buttonStyle == QLatin1String("textonly") ? Qt::ToolButtonTextOnly
: Qt::ToolButtonIconOnly;
}
default:
break;
};
return QCommonStyle::styleHint(hint, option, widget, returnData);
}
/*************************************************************************
* Copyright (C) 2015 by David Edmundson <davidedmundson@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*************************************************************************/
/**
* This class copies the features of KF5's KStyle for use in KDE4 only