diff options
Diffstat (limited to 'src/widgets/kernel/qapplication.cpp')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 108 |
1 files changed, 27 insertions, 81 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index ef046f3ef8..358838b4e9 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -101,23 +101,13 @@ #include "qdatetime.h" -#ifdef Q_OS_WINCE -extern bool qt_wince_is_smartphone(); //qguifunctions_wince.cpp -extern bool qt_wince_is_mobile(); //qguifunctions_wince.cpp -extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp -#endif - #include <qpa/qplatformwindow.h> //#define ALIEN_DEBUG static void initResources() { -#if defined(Q_OS_WINCE) - Q_INIT_RESOURCE(qstyle_wince); -#else Q_INIT_RESOURCE(qstyle); -#endif Q_INIT_RESOURCE(qmessagebox); } @@ -171,12 +161,7 @@ static QByteArray nativeStyleClassName() return name; } -#ifdef Q_OS_WINCE -int QApplicationPrivate::autoMaximizeThreshold = -1; -bool QApplicationPrivate::autoSipEnabled = false; -#else bool QApplicationPrivate::autoSipEnabled = true; -#endif QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags) : QApplicationPrivateBase(argc, argv, flags) @@ -352,8 +337,10 @@ void QApplicationPrivate::createEventDispatcher() \sa QCoreApplication, QAbstractEventDispatcher, QEventLoop, QSettings */ +// ### fixme: Qt 6: Remove ColorSpec and accessors. /*! \enum QApplication::ColorSpec + \obsolete \value NormalColor the default color allocation policy \value CustomColor the same as NormalColor for X11; allocates colors @@ -410,8 +397,6 @@ QString QApplicationPrivate::styleSheet; // default application styles #endif QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0; -int QApplicationPrivate::app_cspec = QApplication::NormalColor; - QPalette *QApplicationPrivate::sys_pal = 0; // default system palette QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer @@ -623,7 +608,7 @@ void qt_init_tooltip_palette() #endif } -#ifndef QT_NO_STATEMACHINE +#if QT_CONFIG(statemachine) void qRegisterGuiStateMachine(); void qUnregisterGuiStateMachine(); #endif @@ -649,7 +634,7 @@ void QApplicationPrivate::initialize() if (application_type != QApplicationPrivate::Tty) (void) QApplication::style(); // trigger creation of application style -#ifndef QT_NO_STATEMACHINE +#if QT_CONFIG(statemachine) // trigger registering of QStateMachine's GUI types qRegisterGuiStateMachine(); #endif @@ -657,17 +642,6 @@ void QApplicationPrivate::initialize() if (qEnvironmentVariableIntValue("QT_USE_NATIVE_WINDOWS") > 0) QCoreApplication::setAttribute(Qt::AA_NativeWindows); -#ifdef Q_OS_WINCE -#ifdef QT_AUTO_MAXIMIZE_THRESHOLD - autoMaximizeThreshold = QT_AUTO_MAXIMIZE_THRESHOLD; -#else - if (qt_wince_is_mobile()) - autoMaximizeThreshold = 50; - else - autoMaximizeThreshold = -1; -#endif //QT_AUTO_MAXIMIZE_THRESHOLD -#endif //Q_OS_WINCE - #ifndef QT_NO_WHEELEVENT QApplicationPrivate::wheel_scroll_lines = 3; #endif @@ -888,12 +862,13 @@ QApplication::~QApplication() QApplicationPrivate::enabledAnimations = QPlatformTheme::GeneralUiEffect; QApplicationPrivate::widgetCount = false; -#ifndef QT_NO_STATEMACHINE +#if QT_CONFIG(statemachine) // trigger unregistering of QStateMachine's GUI types qUnregisterGuiStateMachine(); #endif } +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // #fixme: Remove. static HDC displayDC = 0; // display device context @@ -906,6 +881,7 @@ Q_WIDGETS_EXPORT HDC qt_win_display_dc() // get display D return displayDC; } #endif +#endif void qt_cleanup() { @@ -913,12 +889,14 @@ void qt_cleanup() QColormap::cleanup(); QApplicationPrivate::active_window = 0; //### this should not be necessary +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) if (displayDC) { ReleaseDC(0, displayDC); displayDC = 0; } #endif +#endif } /*! @@ -1023,30 +1001,6 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis */ /*! - \property QApplication::autoMaximizeThreshold - \since 4.4 - \brief defines a threshold for auto maximizing widgets - \deprecated - \b{The auto maximize threshold is only available as part of Qt for - Windows CE.} - - This property defines a threshold for the size of a window as a percentage - of the screen size. If the minimum size hint of a window exceeds the - threshold, calling show() will cause the window to be maximized - automatically. - - Setting the threshold to 100 or greater means that the widget will always - be maximized. Alternatively, setting the threshold to 50 means that the - widget will be maximized only if the vertical minimum size hint is at least - 50% of the vertical screen size. - - Setting the threshold to -1 disables the feature. - - On Windows CE the default is -1 (i.e., it is disabled). - On Windows Mobile the default is 40. -*/ - -/*! \property QApplication::autoSipEnabled \since 4.5 \brief toggles automatic SIP (software input panel) visibility @@ -1061,19 +1015,6 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis The default is platform dependent. */ - -#ifdef Q_OS_WINCE -void QApplication::setAutoMaximizeThreshold(const int threshold) -{ - QApplicationPrivate::autoMaximizeThreshold = threshold; -} - -int QApplication::autoMaximizeThreshold() const -{ - return QApplicationPrivate::autoMaximizeThreshold; -} -#endif - void QApplication::setAutoSipEnabled(const bool enabled) { QApplicationPrivate::autoSipEnabled = enabled; @@ -1127,15 +1068,17 @@ QStyle *QApplication::style() if (!QApplicationPrivate::app_style) { // Compile-time search for default style // - QString style; + QStyle *&app_style = QApplicationPrivate::app_style; + if (!QApplicationPrivate::styleOverride.isEmpty()) { - style = QApplicationPrivate::styleOverride.toLower(); - } else { - style = QApplicationPrivate::desktopStyleKey(); + const QString style = QApplicationPrivate::styleOverride.toLower(); + app_style = QStyleFactory::create(style); + if (!app_style) + qWarning("QApplication: invalid style override passed, ignoring it."); } + if (!app_style) + app_style = QStyleFactory::create(QApplicationPrivate::desktopStyleKey()); - QStyle *&app_style = QApplicationPrivate::app_style; - app_style = QStyleFactory::create(style); if (!app_style) { const QStringList styles = QStyleFactory::keys(); for (const auto &style : styles) { @@ -1314,17 +1257,21 @@ QStyle* QApplication::setStyle(const QString& style) /*! Returns the color specification. + \obsolete \sa QApplication::setColorSpec() */ int QApplication::colorSpec() { - return QApplicationPrivate::app_cspec; + return QApplication::NormalColor; } /*! Sets the color specification for the application to \a spec. + \obsolete + + This call has no effect. The color specification controls how the application allocates colors when run on a display with a limited amount of colors, e.g. 8 bit / 256 color @@ -1380,10 +1327,7 @@ int QApplication::colorSpec() void QApplication::setColorSpec(int spec) { - if (Q_UNLIKELY(qApp)) - qWarning("QApplication::setColorSpec: This function must be " - "called before the QApplication object is created"); - QApplicationPrivate::app_cspec = spec; + Q_UNUSED(spec) } /*! @@ -2846,6 +2790,8 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) // Send enter/leave events followed by a mouse move on the entered widget. QMouseEvent e(QEvent::MouseMove, pos, windowPos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); sendMouseEvent(widgetUnderCursor, &e, widgetUnderCursor, tlw, &qt_button_down, qt_last_mouse_receiver); +#else // !QT_NO_CURSOR + Q_UNUSED(widget); #endif // QT_NO_CURSOR } @@ -3637,7 +3583,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) // We may get here if the widget is subscribed to a gesture, // but has not accepted TouchBegin. Propagate touch events // only if TouchBegin has been accepted. - if (widget && widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent)) + if (widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent)) res = d->notify_helper(widget, e); break; } @@ -3777,7 +3723,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) if (receiver->isWidgetType()) { QWidget *widget = static_cast<QWidget *>(receiver); -#if !defined(Q_OS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR)) +#if !defined(QT_NO_CURSOR) // toggle HasMouse widget state on enter and leave if ((e->type() == QEvent::Enter || e->type() == QEvent::DragEnter) && (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == widget->window())) |