hiding QGuiApplicationPrivate

This commit is contained in:
Uwe Rathmann 2023-04-05 09:52:23 +02:00
parent 084eae3dbc
commit 18c16c12fe
6 changed files with 21 additions and 23 deletions

View File

@ -23,6 +23,11 @@ const QPlatformIntegration* qskPlatformIntegration()
return QGuiApplicationPrivate::platformIntegration(); return QGuiApplicationPrivate::platformIntegration();
} }
const QPlatformTheme* qskPlatformTheme()
{
return QGuiApplicationPrivate::platformTheme();
}
bool qskMaybeDesktopPlatform() bool qskMaybeDesktopPlatform()
{ {
#if QT_CONFIG(cursor) #if QT_CONFIG(cursor)

View File

@ -10,14 +10,17 @@
class QScreen; class QScreen;
class QPlatformIntegration; class QPlatformIntegration;
class QPlatformTheme;
class QRect; class QRect;
QSK_EXPORT qreal qskGlobalScaleFactor(); QSK_EXPORT qreal qskGlobalScaleFactor();
QSK_EXPORT bool qskMaybeDesktopPlatform(); QSK_EXPORT bool qskMaybeDesktopPlatform();
QSK_EXPORT const QPlatformIntegration* qskPlatformIntegration();
QSK_EXPORT QRect qskPlatformScreenGeometry( const QScreen* ); 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 One dp is a virtual pixel unit that's roughly equal to one pixel
on a medium-density screen ( 160 dpi ). on a medium-density screen ( 160 dpi ).

View File

@ -9,11 +9,7 @@
#include <qevent.h> #include <qevent.h>
#if QT_VERSION >= QT_VERSION_CHECK( 6, 4, 0 ) #if QT_VERSION >= QT_VERSION_CHECK( 6, 4, 0 )
#include "QskPlatform.h"
QSK_QT_PRIVATE_BEGIN
#include <private/qguiapplication_p.h>
QSK_QT_PRIVATE_END
#include <qpa/qplatformtheme.h> #include <qpa/qplatformtheme.h>
#endif #endif
@ -127,7 +123,7 @@ bool qskIsStandardKeyInput( const QKeyEvent* event, QKeySequence::StandardKey ke
constexpr auto mask = ~( Qt::KeypadModifier | Qt::GroupSwitchModifier ); constexpr auto mask = ~( Qt::KeypadModifier | Qt::GroupSwitchModifier );
// We should route this call through the skin. TODO // 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 ); const auto bindings = theme->keyBindings( ( event->modifiers() | event->key() ) & mask );
return bindings.contains( QKeySequence(searchkey) ); return bindings.contains( QKeySequence(searchkey) );
@ -138,8 +134,7 @@ bool qskIsButtonPressKey( const QKeyEvent* event )
{ {
#if QT_VERSION >= QT_VERSION_CHECK( 6, 4, 0 ) #if QT_VERSION >= QT_VERSION_CHECK( 6, 4, 0 )
const auto hint = QGuiApplicationPrivate::platformTheme()->themeHint( const auto hint = qskPlatformTheme()->themeHint( QPlatformTheme::ButtonPressKeys );
QPlatformTheme::ButtonPressKeys );
const auto keys = hint.value< QList< Qt::Key > >(); const auto keys = hint.value< QList< Qt::Key > >();
return keys.contains( static_cast< Qt::Key >( event->key() ) ); return keys.contains( static_cast< Qt::Key >( event->key() ) );

View File

@ -7,10 +7,10 @@
#include "QskControl.h" #include "QskControl.h"
#include "QskFunctions.h" #include "QskFunctions.h"
#include "QskLayoutElement.h" #include "QskLayoutElement.h"
#include "QskPlatform.h"
#include <qquickitem.h> #include <qquickitem.h>
QSK_QT_PRIVATE_BEGIN QSK_QT_PRIVATE_BEGIN
#include <private/qguiapplication_p.h>
#include <private/qquickitem_p.h> #include <private/qquickitem_p.h>
QSK_QT_PRIVATE_END QSK_QT_PRIVATE_END
@ -277,7 +277,7 @@ void qskUpdateInputMethod( const QQuickItem* item, Qt::InputMethodQueries querie
when using it. So let's go with QGuiApplicationPrivate. when using it. So let's go with QGuiApplicationPrivate.
*/ */
auto inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext(); auto inputContext = qskPlatformIntegration()->inputContext();
if ( inputContext == nullptr ) if ( inputContext == nullptr )
{ {
context = nullptr; context = nullptr;
@ -317,7 +317,7 @@ void qskInputMethodSetVisible( const QQuickItem* item, bool on )
static QPlatformInputContext* context = nullptr; static QPlatformInputContext* context = nullptr;
static int methodId = -1; static int methodId = -1;
auto inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext(); auto inputContext = qskPlatformIntegration()->inputContext();
if ( inputContext == nullptr ) if ( inputContext == nullptr )
{ {
context = nullptr; context = nullptr;

View File

@ -16,10 +16,7 @@
#include "QskMargins.h" #include "QskMargins.h"
QSK_QT_PRIVATE_BEGIN #include <qguiapplication.h>
#include <private/qguiapplication_p.h>
QSK_QT_PRIVATE_END
#include <qpa/qplatformdialoghelper.h> #include <qpa/qplatformdialoghelper.h>
#include <qpa/qplatformtheme.h> #include <qpa/qplatformtheme.h>
@ -344,7 +341,7 @@ bool QskSkin::hasGraphicProvider() const
QString QskSkin::dialogButtonText( int action ) const QString QskSkin::dialogButtonText( int action ) const
{ {
const auto theme = QGuiApplicationPrivate::platformTheme(); const auto theme = qskPlatformTheme();
auto text = theme->standardButtonText( action ); auto text = theme->standardButtonText( action );
text = QPlatformTheme::removeMnemonics( text ); text = QPlatformTheme::removeMnemonics( text );
@ -357,7 +354,7 @@ const int* QskSkin::dialogButtonLayout( Qt::Orientation orientation ) const
// auto policy = QPlatformDialogHelper::UnknownLayout; // auto policy = QPlatformDialogHelper::UnknownLayout;
auto policy = QPlatformDialogHelper::WinLayout; auto policy = QPlatformDialogHelper::WinLayout;
if ( const auto theme = QGuiApplicationPrivate::platformTheme() ) if ( const auto theme = qskPlatformTheme() )
{ {
const QVariant v = theme->themeHint( QPlatformTheme::DialogButtonBoxLayout ); const QVariant v = theme->themeHint( QPlatformTheme::DialogButtonBoxLayout );
policy = static_cast< QPlatformDialogHelper::ButtonLayout >( v.toInt() ); policy = static_cast< QPlatformDialogHelper::ButtonLayout >( v.toInt() );

View File

@ -13,14 +13,12 @@
#include "QskQuick.h" #include "QskQuick.h"
#include "QskTextPredictor.h" #include "QskTextPredictor.h"
#include "QskWindow.h" #include "QskWindow.h"
#include "QskPlatform.h"
#include <qguiapplication.h> #include <qguiapplication.h>
#include <qmap.h> #include <qmap.h>
#include <qpointer.h> #include <qpointer.h>
#include <qthread.h>
QSK_QT_PRIVATE_BEGIN
#include <private/qguiapplication_p.h>
QSK_QT_PRIVATE_END
#include <qpa/qplatforminputcontext.h> #include <qpa/qplatforminputcontext.h>
#include <qpa/qplatformintegration.h> #include <qpa/qplatformintegration.h>
@ -183,7 +181,7 @@ static QPointer< QskInputContext > qskInputContext;
static void qskSendToPlatformContext( QEvent::Type type ) static void qskSendToPlatformContext( QEvent::Type type )
{ {
const auto integration = QGuiApplicationPrivate::platformIntegration(); const auto integration = qskPlatformIntegration();
if ( const auto inputContext = integration->inputContext() ) if ( const auto inputContext = integration->inputContext() )
{ {