Commit 0c7f3516 authored by Alexander Schlarb's avatar Alexander Schlarb Committed by Nate Graham

Only include QtQuick support in Breeze KStyle if QtQuick is available

Summary: Currently Breeze hard-depends on QtQuick in order to provide QtQuick-specific theme tweaks, but only for KDE5. This patch decouples KDE4 support from QtQuick support and allows Breeze to be built even when QtQuick is not available (at the loss of the QtQuick specific tweaks of course).

Reviewers: mart

Reviewed By: mart

Subscribers: ngraham, davidedmundson, plasma-devel

Tags: #plasma, #breeze

Differential Revision: https://phabricator.kde.org/D12708
parent 4c8b02ca
......@@ -25,6 +25,7 @@ if(BREEZE_USE_KDE4)
set(BREEZE_HAVE_X11 FALSE)
endif()
set(BREEZE_HAVE_QTQUICK FALSE)
set(BREEZE_HAVE_KWAYLAND FALSE)
### KStyle
......@@ -32,7 +33,7 @@ if(BREEZE_USE_KDE4)
else()
find_package(Qt5 REQUIRED CONFIG COMPONENTS Widgets DBus Quick)
find_package(Qt5 REQUIRED CONFIG COMPONENTS Widgets DBus)
find_package(KF5 REQUIRED COMPONENTS
I18n
Config
......@@ -40,6 +41,9 @@ else()
ConfigWidgets
WindowSystem)
find_package(Qt5 COMPONENTS Quick)
set(BREEZE_HAVE_QTQUICK ${Qt5_Quick_FOUND})
find_package( KF5FrameworkIntegration CONFIG )
set_package_properties(KF5FrameworkIntegration PROPERTIES
DESCRIPTION "KF5 Framework Integration"
......@@ -155,7 +159,10 @@ else()
kconfig_add_kcfg_files(breeze_PART_SRCS breezestyleconfigdata.kcfgc)
add_library(breeze MODULE ${breeze_PART_SRCS})
target_link_libraries(breeze Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus Qt5::Quick)
target_link_libraries(breeze Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus)
if( Qt5_Quick_FOUND )
target_link_libraries(breeze Qt5::Quick)
endif()
target_link_libraries(breeze KF5::ConfigCore KF5::ConfigWidgets KF5::GuiAddons KF5::WindowSystem)
target_link_libraries(breeze breezecommon)
......
......@@ -7158,7 +7158,7 @@ namespace Breeze
//____________________________________________________________________
bool Style::isQtQuickControl( const QStyleOption* option, const QWidget* widget ) const
{
#if QT_VERSION >= 0x050000
#if QT_VERSION >= 0x050000 && BREEZE_HAVE_QTQUICK
const bool is = (widget == nullptr) && option && option->styleObject && option->styleObject->inherits( "QQuickItem" );
if ( is ) _windowManager->registerQuickItem( static_cast<QQuickItem*>( option->styleObject ) );
return is;
......
......@@ -79,7 +79,7 @@
#include <QWindow>
#endif
#if QT_VERSION >= 0x050000
#if BREEZE_HAVE_QTQUICK
// needed to enable dragging from QQuickWindows
#include <QQuickItem>
#include <QQuickWindow>
......@@ -319,7 +319,7 @@ namespace Breeze
}
#if !BREEZE_USE_KDE4
#if BREEZE_HAVE_QTQUICK
//_____________________________________________________________
void WindowManager::registerQuickItem( QQuickItem* item )
{
......@@ -390,7 +390,7 @@ namespace Breeze
case QEvent::MouseMove:
if ( object == _target.data()
#if !BREEZE_USE_KDE4
#if BREEZE_HAVE_QTQUICK
|| object == _quickTarget.data()
#endif
) return mouseMoveEvent( object, event );
......@@ -398,7 +398,7 @@ namespace Breeze
case QEvent::MouseButtonRelease:
if ( _target
#if !BREEZE_USE_KDE4
#if BREEZE_HAVE_QTQUICK
|| _quickTarget
#endif
) return mouseReleaseEvent( object, event );
......@@ -426,8 +426,10 @@ namespace Breeze
{ startDrag( _target.data()->window(), _globalDragPoint ); }
#else
if( _target ) startDrag( _target.data()->window()->windowHandle(), _globalDragPoint );
#if BREEZE_HAVE_QTQUICK
else if( _quickTarget ) startDrag( _quickTarget.data()->window(), _globalDragPoint );
#endif
#endif
} else {
......@@ -450,7 +452,7 @@ namespace Breeze
if( isLocked() ) return false;
else setLocked( true );
#if !BREEZE_USE_KDE4
#if BREEZE_HAVE_QTQUICK
// check QQuickItem - we can immediately start drag, because QQuickWindow's contentItem
// only receives mouse events that weren't handled by children
if( auto item = qobject_cast<QQuickItem*>( object ) )
......@@ -837,7 +839,7 @@ namespace Breeze
}
_target.clear();
#if !BREEZE_USE_KDE4
#if BREEZE_HAVE_QTQUICK
_quickTarget.clear();
#endif
if( _dragTimer.isActive() ) _dragTimer.stop();
......
......@@ -33,7 +33,7 @@
#include <QString>
#include <QWidget>
#if !BREEZE_USE_KDE4
#if BREEZE_HAVE_QTQUICK
#include <QQuickItem>
#endif
......@@ -68,7 +68,7 @@ namespace Breeze
//* register widget
void registerWidget( QWidget* );
#if !BREEZE_USE_KDE4
#if BREEZE_HAVE_QTQUICK
//* register quick item
void registerQuickItem( QQuickItem* );
#endif
......@@ -286,7 +286,7 @@ namespace Breeze
/** Weak pointer is used in case the target gets deleted while drag is in progress */
WeakPointer<QWidget> _target;
#if !BREEZE_USE_KDE4
#if BREEZE_HAVE_QTQUICK
WeakPointer<QQuickItem> _quickTarget;
#endif
......
......@@ -25,6 +25,9 @@
/* Define to 1 if breeze is compiled against KDE4 */
#cmakedefine01 BREEZE_USE_KDE4
/* Define to 1 if QtQuick is available */
#cmakedefine01 BREEZE_HAVE_QTQUICK
/* Define to 1 if FrameworkIntegration/Kstyle libraries are found */
#cmakedefine01 BREEZE_HAVE_KSTYLE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment