Skip to content

Commit

Permalink
Merge branch 'master' into cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
uwerat committed Apr 5, 2023
2 parents b21b42a + 1ac6334 commit 445f6c7
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 42 deletions.
19 changes: 15 additions & 4 deletions src/common/QskObjectCounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

#include <qdebug.h>
#include <qset.h>
#include <qobject.h>
#include <qcoreapplication.h>

QSK_QT_PRIVATE_BEGIN
#include <private/qhooks_p.h>
#include <private/qobject_p.h>
#include <private/qquickitem_p.h>
QSK_QT_PRIVATE_END

#define QSK_OBJECT_INFO 0
Expand All @@ -20,18 +20,29 @@ QSK_QT_PRIVATE_END
#include <qset.h>
#endif

#if QT_VERSION < QT_VERSION_CHECK( 6, 4, 0 )

QSK_QT_PRIVATE_BEGIN
#include <private/qquickitem_p.h>
QSK_QT_PRIVATE_END

#endif

static inline bool qskIsItem( const QObject* object )
{
QObjectPrivate* o_p = QObjectPrivate::get( const_cast< QObject* >( object ) );

#if QT_VERSION >= QT_VERSION_CHECK( 6, 4, 0 )
return object->isQuickItemType();
#else
/*
The addObject hook is called from the constructor of QObject,
where we don't have the derived class constructed yet.
So we can't cast the object itself and also have to rely on
RTTI being enabled. TODO ...
*/

auto o_p = QObjectPrivate::get( const_cast< QObject* >( object ) );
return dynamic_cast< QQuickItemPrivate* >( o_p ) != nullptr;
#endif
}

namespace
Expand Down
5 changes: 5 additions & 0 deletions src/common/QskPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ const QPlatformIntegration* qskPlatformIntegration()
return QGuiApplicationPrivate::platformIntegration();
}

const QPlatformTheme* qskPlatformTheme()
{
return QGuiApplicationPrivate::platformTheme();
}

bool qskMaybeDesktopPlatform()
{
#if QT_CONFIG(cursor)
Expand Down
5 changes: 4 additions & 1 deletion src/common/QskPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@

class QScreen;
class QPlatformIntegration;
class QPlatformTheme;
class QRect;

QSK_EXPORT qreal qskGlobalScaleFactor();

QSK_EXPORT bool qskMaybeDesktopPlatform();
QSK_EXPORT const QPlatformIntegration* qskPlatformIntegration();
QSK_EXPORT QRect qskPlatformScreenGeometry( const QScreen* );

QSK_EXPORT const QPlatformIntegration* qskPlatformIntegration();
QSK_EXPORT const QPlatformTheme* qskPlatformTheme();

/*
One dp is a virtual pixel unit that's roughly equal to one pixel
on a medium-density screen ( 160 dpi ).
Expand Down
11 changes: 3 additions & 8 deletions src/controls/QskEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
#include <qevent.h>

#if QT_VERSION >= QT_VERSION_CHECK( 6, 4, 0 )

QSK_QT_PRIVATE_BEGIN
#include <private/qguiapplication_p.h>
QSK_QT_PRIVATE_END

#include "QskPlatform.h"
#include <qpa/qplatformtheme.h>
#endif

Expand Down Expand Up @@ -127,7 +123,7 @@ bool qskIsStandardKeyInput( const QKeyEvent* event, QKeySequence::StandardKey ke
constexpr auto mask = ~( Qt::KeypadModifier | Qt::GroupSwitchModifier );
// We should route this call through the skin. TODO
const auto theme = QGuiApplicationPrivate::platformTheme();
const auto theme = qskPlatformTheme();
const auto bindings = theme->keyBindings( ( event->modifiers() | event->key() ) & mask );
return bindings.contains( QKeySequence(searchkey) );
Expand All @@ -138,8 +134,7 @@ bool qskIsButtonPressKey( const QKeyEvent* event )
{
#if QT_VERSION >= QT_VERSION_CHECK( 6, 4, 0 )

const auto hint = QGuiApplicationPrivate::platformTheme()->themeHint(
QPlatformTheme::ButtonPressKeys );
const auto hint = qskPlatformTheme()->themeHint( QPlatformTheme::ButtonPressKeys );

const auto keys = hint.value< QList< Qt::Key > >();
return keys.contains( static_cast< Qt::Key >( event->key() ) );
Expand Down
6 changes: 3 additions & 3 deletions src/controls/QskQuick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#include "QskControl.h"
#include "QskFunctions.h"
#include "QskLayoutElement.h"
#include "QskPlatform.h"
#include <qquickitem.h>

QSK_QT_PRIVATE_BEGIN
#include <private/qguiapplication_p.h>
#include <private/qquickitem_p.h>
QSK_QT_PRIVATE_END

Expand Down Expand Up @@ -277,7 +277,7 @@ void qskUpdateInputMethod( const QQuickItem* item, Qt::InputMethodQueries querie
when using it. So let's go with QGuiApplicationPrivate.
*/

auto inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext();
auto inputContext = qskPlatformIntegration()->inputContext();
if ( inputContext == nullptr )
{
context = nullptr;
Expand Down Expand Up @@ -317,7 +317,7 @@ void qskInputMethodSetVisible( const QQuickItem* item, bool on )
static QPlatformInputContext* context = nullptr;
static int methodId = -1;

auto inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext();
auto inputContext = qskPlatformIntegration()->inputContext();
if ( inputContext == nullptr )
{
context = nullptr;
Expand Down
2 changes: 2 additions & 0 deletions src/controls/QskQuickItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ QSK_QT_PRIVATE_BEGIN
#endif
#endif

#if defined( QT_DEBUG )
#include <private/qquickpositioners_p.h>
#endif

QSK_QT_PRIVATE_END

Expand Down
2 changes: 0 additions & 2 deletions src/controls/QskScrollArea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
#include "QskSGNode.h"

QSK_QT_PRIVATE_BEGIN
#include <private/qquickclipnode_p.h>
#include <private/qquickitem_p.h>
#include <private/qquickitemchangelistener_p.h>
#include <private/qquickwindow_p.h>
QSK_QT_PRIVATE_END

static inline bool qskNeedsScrollBars(
Expand Down
9 changes: 3 additions & 6 deletions src/controls/QskSkin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@

#include "QskMargins.h"

QSK_QT_PRIVATE_BEGIN
#include <private/qguiapplication_p.h>
QSK_QT_PRIVATE_END

#include <qguiapplication.h>
#include <qpa/qplatformdialoghelper.h>
#include <qpa/qplatformtheme.h>

Expand Down Expand Up @@ -344,7 +341,7 @@ bool QskSkin::hasGraphicProvider() const

QString QskSkin::dialogButtonText( int action ) const
{
const auto theme = QGuiApplicationPrivate::platformTheme();
const auto theme = qskPlatformTheme();

auto text = theme->standardButtonText( action );
text = QPlatformTheme::removeMnemonics( text );
Expand All @@ -357,7 +354,7 @@ const int* QskSkin::dialogButtonLayout( Qt::Orientation orientation ) const
// auto policy = QPlatformDialogHelper::UnknownLayout;
auto policy = QPlatformDialogHelper::WinLayout;

if ( const auto theme = QGuiApplicationPrivate::platformTheme() )
if ( const auto theme = qskPlatformTheme() )
{
const QVariant v = theme->themeHint( QPlatformTheme::DialogButtonBoxLayout );
policy = static_cast< QPlatformDialogHelper::ButtonLayout >( v.toInt() );
Expand Down
6 changes: 1 addition & 5 deletions src/controls/QskSkinlet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,9 @@
#include <qquickwindow.h>
#include <qsgsimplerectnode.h>

QSK_QT_PRIVATE_BEGIN
#include <private/qquickitem_p.h>
QSK_QT_PRIVATE_END

static inline QRectF qskSceneAlignedRect( const QQuickItem* item, const QRectF& rect )
{
const auto transform = QQuickItemPrivate::get( item )->itemToWindowTransform();
const auto transform = item->itemTransform( nullptr, nullptr );
if ( transform.type() > QTransform::TxTranslate )
return rect;

Expand Down
1 change: 0 additions & 1 deletion src/graphic/QskGraphic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

QSK_QT_PRIVATE_BEGIN
#include <private/qpainter_p.h>
#include <private/qpaintengineex_p.h>
QSK_QT_PRIVATE_END

static inline qreal qskDevicePixelRatio()
Expand Down
8 changes: 3 additions & 5 deletions src/inputpanel/QskInputContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
#include "QskQuick.h"
#include "QskTextPredictor.h"
#include "QskWindow.h"
#include "QskPlatform.h"

#include <qguiapplication.h>
#include <qmap.h>
#include <qpointer.h>

QSK_QT_PRIVATE_BEGIN
#include <private/qguiapplication_p.h>
QSK_QT_PRIVATE_END
#include <qthread.h>

#include <qpa/qplatforminputcontext.h>
#include <qpa/qplatformintegration.h>
Expand Down Expand Up @@ -183,7 +181,7 @@ static QPointer< QskInputContext > qskInputContext;

static void qskSendToPlatformContext( QEvent::Type type )
{
const auto integration = QGuiApplicationPrivate::platformIntegration();
const auto integration = qskPlatformIntegration();

if ( const auto inputContext = integration->inputContext() )
{
Expand Down
5 changes: 0 additions & 5 deletions src/nodes/QskGradientMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@

#include <qsgtexture.h>

QSK_QT_PRIVATE_BEGIN
#include <private/qrhi_p.h>
#include <private/qdrawhelper_p.h>
QSK_QT_PRIVATE_END

#include <cmath>

// RHI shaders are supported by Qt 5.15 and Qt 6.x
Expand Down
2 changes: 0 additions & 2 deletions src/nodes/QskPlainTextRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#include <qsgnode.h>

QSK_QT_PRIVATE_BEGIN
#include <private/qsgadaptationlayer_p.h>
#include <private/qsgcontext_p.h>
#include <private/qquickitem_p.h>
QSK_QT_PRIVATE_END

Expand Down

0 comments on commit 445f6c7

Please sign in to comment.