diff options
Diffstat (limited to 'src/widgets/util')
-rw-r--r-- | src/widgets/util/qcompleter.cpp | 13 | ||||
-rw-r--r-- | src/widgets/util/qcompleter_p.h | 2 | ||||
-rw-r--r-- | src/widgets/util/qflickgesture.cpp | 23 | ||||
-rw-r--r-- | src/widgets/util/qflickgesture_p.h | 2 | ||||
-rw-r--r-- | src/widgets/util/qscroller.cpp | 3 | ||||
-rw-r--r-- | src/widgets/util/qscroller_mac.mm | 72 | ||||
-rw-r--r-- | src/widgets/util/qscrollerproperties.cpp | 7 | ||||
-rw-r--r-- | src/widgets/util/qsystemtrayicon.cpp | 11 | ||||
-rw-r--r-- | src/widgets/util/qsystemtrayicon_x11.cpp | 4 | ||||
-rw-r--r-- | src/widgets/util/qundostack_p.h | 4 | ||||
-rw-r--r-- | src/widgets/util/util.pri | 4 |
11 files changed, 20 insertions, 125 deletions
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index e41f7e7573..7b69eff30c 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -145,7 +145,9 @@ #include "QtWidgets/qscrollbar.h" #include "QtCore/qdir.h" +#if QT_CONFIG(stringlistmodel) #include "QtCore/qstringlistmodel.h" +#endif #if QT_CONFIG(dirmodel) #include "QtWidgets/qdirmodel.h" #endif @@ -159,6 +161,7 @@ #include "QtWidgets/qapplication.h" #include "QtGui/qevent.h" #include "QtWidgets/qdesktopwidget.h" +#include <private/qapplication_p.h> #include <private/qdesktopwidget_p.h> #if QT_CONFIG(lineedit) #include "QtWidgets/qlineedit.h" @@ -1414,7 +1417,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) // widget lost focus, hide the popup if (d->widget && (!d->widget->hasFocus() #ifdef QT_KEYPAD_NAVIGATION - || (QApplication::keypadNavigationEnabled() && !d->widget->hasEditFocus()) + || (QApplicationPrivate::keypadNavigationEnabled() && !d->widget->hasEditFocus()) #endif )) d->popup->hide(); @@ -1432,7 +1435,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) switch (key) { #ifdef QT_KEYPAD_NAVIGATION case Qt::Key_Select: - if (!QApplication::keypadNavigationEnabled()) + if (!QApplicationPrivate::keypadNavigationEnabled()) break; #endif case Qt::Key_Return: @@ -1462,7 +1465,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) #ifdef QT_KEYPAD_NAVIGATION case QEvent::KeyRelease: { QKeyEvent *ke = static_cast<QKeyEvent *>(e); - if (QApplication::keypadNavigationEnabled() && ke->key() == Qt::Key_Back) { + if (QApplicationPrivate::keypadNavigationEnabled() && ke->key() == Qt::Key_Back) { // Send the event to the 'widget'. This is what we did for KeyPress, so we need // to do the same for KeyRelease, in case the widget's KeyPress event set // up something (such as a timer) that is relying on also receiving the @@ -1479,7 +1482,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) case QEvent::MouseButtonPress: { #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled()) { + if (QApplicationPrivate::keypadNavigationEnabled()) { // if we've clicked in the widget (or its descendant), let it handle the click QWidget *source = qobject_cast<QWidget *>(o); if (source) { @@ -1504,7 +1507,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) case QEvent::InputMethod: case QEvent::ShortcutOverride: - QApplication::sendEvent(d->widget, e); + QCoreApplication::sendEvent(d->widget, e); break; default: diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h index 21dddf446e..a52e63a6e2 100644 --- a/src/widgets/util/qcompleter_p.h +++ b/src/widgets/util/qcompleter_p.h @@ -75,7 +75,7 @@ class QCompleterPrivate : public QObjectPrivate public: QCompleterPrivate(); ~QCompleterPrivate() { delete popup; } - void init(QAbstractItemModel *model = 0); + void init(QAbstractItemModel *model = nullptr); QPointer<QWidget> widget; QCompletionModel *proxy; diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp index a8b2a00a80..14a30ce7cf 100644 --- a/src/widgets/util/qflickgesture.cpp +++ b/src/widgets/util/qflickgesture.cpp @@ -228,7 +228,7 @@ public: // we did send a press, so we need to fake a release now // release all pressed mouse buttons - /* Qt::MouseButtons mouseButtons = QApplication::mouseButtons(); + /* Qt::MouseButtons mouseButtons = QGuiApplication::mouseButtons(); for (int i = 0; i < 32; ++i) { if (mouseButtons & (1 << i)) { Qt::MouseButton b = static_cast<Qt::MouseButton>(1 << i); @@ -237,7 +237,7 @@ public: qFGDebug() << "QFG: sending a fake mouse release at far-far-away to " << mouseTarget; QMouseEvent re(QEvent::MouseButtonRelease, QPoint(), farFarAway, - b, mouseButtons, QApplication::keyboardModifiers()); + b, mouseButtons, QGuiApplication::keyboardModifiers()); sendMouseEvent(&re); } }*/ @@ -246,8 +246,8 @@ public: qFGDebug() << "QFG: sending a fake mouse release at far-far-away to " << mouseTarget; QMouseEvent re(QEvent::MouseButtonRelease, QPoint(), farFarAway, farFarAway, - mouseButton, QApplication::mouseButtons() & ~mouseButton, - QApplication::keyboardModifiers(), mouseEventSource); + mouseButton, QGuiApplication::mouseButtons() & ~mouseButton, + QGuiApplication::keyboardModifiers(), mouseEventSource); sendMouseEvent(&re, RegrabMouseAfterwards); // don't clear the mouseTarget just yet, since we need to explicitly ungrab the mouse on release! } @@ -462,21 +462,6 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state, } break; -#if 0 // Used to be included in Qt4 for Q_WS_MAC - // the only way to distinguish between real mouse wheels and wheel - // events generated by the native 2 finger swipe gesture is to listen - // for these events (according to Apple's Cocoa Event-Handling Guide) - - case QEvent::NativeGesture: { - QNativeGestureEvent *nge = static_cast<QNativeGestureEvent *>(event); - if (nge->gestureType == QNativeGestureEvent::GestureBegin) - d->macIgnoreWheel = true; - else if (nge->gestureType == QNativeGestureEvent::GestureEnd) - d->macIgnoreWheel = false; - break; - } -#endif - // consume all wheel events if the scroller is active case QEvent::Wheel: if (d->macIgnoreWheel || (scroller->state() != QScroller::Inactive)) diff --git a/src/widgets/util/qflickgesture_p.h b/src/widgets/util/qflickgesture_p.h index d5ace887ae..0b47516047 100644 --- a/src/widgets/util/qflickgesture_p.h +++ b/src/widgets/util/qflickgesture_p.h @@ -71,7 +71,7 @@ class Q_WIDGETS_EXPORT QFlickGesture : public QGesture Q_DECLARE_PRIVATE(QFlickGesture) public: - QFlickGesture(QObject *receiver, Qt::MouseButton button, QObject *parent = 0); + QFlickGesture(QObject *receiver, Qt::MouseButton button, QObject *parent = nullptr); ~QFlickGesture(); friend class QFlickGestureRecognizer; diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp index 1e84237253..df05bbf71c 100644 --- a/src/widgets/util/qscroller.cpp +++ b/src/widgets/util/qscroller.cpp @@ -1031,7 +1031,8 @@ void QScrollerPrivate::setDpi(const QPointF &dpi) */ void QScrollerPrivate::setDpiFromWidget(QWidget *widget) { - const QScreen *screen = QGuiApplication::screens().at(QApplication::desktop()->screenNumber(widget)); + const QScreen *screen = widget ? widget->screen() : QGuiApplication::primaryScreen(); + Q_ASSERT(screen); setDpi(QPointF(screen->physicalDotsPerInchX(), screen->physicalDotsPerInchY())); } diff --git a/src/widgets/util/qscroller_mac.mm b/src/widgets/util/qscroller_mac.mm deleted file mode 100644 index 6dbb483089..0000000000 --- a/src/widgets/util/qscroller_mac.mm +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtCore/qglobal.h> - -#if 0 // Used to be included in Qt4 for Q_WS_MAC - -#import <AppKit/AppKit.h> - -#include "qscroller_p.h" - -QT_BEGIN_NAMESPACE - -QPointF QScrollerPrivate::realDpi(int screen) const -{ - QMacAutoReleasePool pool; - NSArray *nsscreens = [NSScreen screens]; - - if (screen < 0 || screen >= int([nsscreens count])) - screen = 0; - - NSScreen *nsscreen = [nsscreens objectAtIndex:screen]; - CGDirectDisplayID display = [[[nsscreen deviceDescription] objectForKey:@"NSScreenNumber"] intValue]; - - CGSize mmsize = CGDisplayScreenSize(display); - if (mmsize.width > 0 && mmsize.height > 0) { - return QPointF(CGDisplayPixelsWide(display) / mmsize.width, - CGDisplayPixelsHigh(display) / mmsize.height) * qreal(25.4); - } else { - return QPointF(); - } -} - -QT_END_NAMESPACE - -#endif diff --git a/src/widgets/util/qscrollerproperties.cpp b/src/widgets/util/qscrollerproperties.cpp index c26fba2cd3..df6b899fe4 100644 --- a/src/widgets/util/qscrollerproperties.cpp +++ b/src/widgets/util/qscrollerproperties.cpp @@ -40,9 +40,6 @@ #include <QPointer> #include <QObject> #include <QtCore/qmath.h> -#if 0 // Used to be included in Qt4 for Q_WS_WIN -# include <QLibrary> -#endif #include "qscrollerproperties.h" #include "private/qscrollerproperties_p.h" @@ -73,10 +70,6 @@ QScrollerPropertiesPrivate *QScrollerPropertiesPrivate::defaults() spp.overshootDragDistanceFactor = qreal(1); spp.overshootScrollDistanceFactor = qreal(0.5); spp.overshootScrollTime = qreal(0.7); -# if 0 // Used to be included in Qt4 for Q_WS_WIN - if (QLibrary::resolve(QLatin1String("UxTheme"), "BeginPanningFeedback")) - spp.overshootScrollTime = qreal(0.35); -# endif spp.hOvershootPolicy = QScrollerProperties::OvershootWhenScrollable; spp.vOvershootPolicy = QScrollerProperties::OvershootWhenScrollable; spp.frameRate = QScrollerProperties::Standard; diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index a38a50d3df..fd18888870 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -626,16 +626,6 @@ void QBalloonTip::balloon(const QPoint& pos, int msecs, bool showArrow) } QPainterPath path; -#if defined(QT_NO_XSHAPE) && 0 /* Used to be included in Qt4 for Q_WS_X11 */ - // XShape is required for setting the mask, so we just - // draw an ugly square when its not available - path.moveTo(0, 0); - path.lineTo(sz.width() - 1, 0); - path.lineTo(sz.width() - 1, sz.height() - 1); - path.lineTo(0, sz.height() - 1); - path.lineTo(0, 0); - move(qMax(pos.x() - sz.width(), scr.left()), pos.y()); -#else path.moveTo(ml + rc, mt); if (arrowAtTop && arrowAtLeft) { if (showArrow) { @@ -685,7 +675,6 @@ void QBalloonTip::balloon(const QPoint& pos, int msecs, bool showArrow) painter1.setBrush(QBrush(Qt::color1)); painter1.drawPath(path); setMask(bitmap); -#endif // Draw the border pixmap = QPixmap(sz); diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp index 70e5f3678e..0c7bb94a91 100644 --- a/src/widgets/util/qsystemtrayicon_x11.cpp +++ b/src/widgets/util/qsystemtrayicon_x11.cpp @@ -151,11 +151,11 @@ bool QSystemTrayIconSys::event(QEvent *e) { switch (e->type()) { case QEvent::ToolTip: - QApplication::sendEvent(q, e); + QCoreApplication::sendEvent(q, e); break; #if QT_CONFIG(wheelevent) case QEvent::Wheel: - return QApplication::sendEvent(q, e); + return QCoreApplication::sendEvent(q, e); #endif default: break; diff --git a/src/widgets/util/qundostack_p.h b/src/widgets/util/qundostack_p.h index 04bc381114..05c9e0d27e 100644 --- a/src/widgets/util/qundostack_p.h +++ b/src/widgets/util/qundostack_p.h @@ -80,7 +80,7 @@ class QUndoStackPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QUndoStack) public: - QUndoStackPrivate() : index(0), clean_index(0), group(0), undo_limit(0) {} + QUndoStackPrivate() : index(0), clean_index(0), group(nullptr), undo_limit(0) {} QList<QUndoCommand*> command_list; QList<QUndoCommand*> macro_stack; @@ -98,7 +98,7 @@ class QUndoAction : public QAction { Q_OBJECT public: - explicit QUndoAction(const QString &prefix, QObject *parent = 0); + explicit QUndoAction(const QString &prefix, QObject *parent = nullptr); void setTextFormat(const QString &textFormat, const QString &defaultText); public Q_SLOTS: void setPrefixedText(const QString &text); diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri index a3bd8897f1..363291528e 100644 --- a/src/widgets/util/util.pri +++ b/src/widgets/util/util.pri @@ -54,7 +54,3 @@ qtConfig(xcb) { } else { SOURCES += util/qsystemtrayicon_qpa.cpp } - -mac { - OBJECTIVE_SOURCES += util/qscroller_mac.mm -} |