diff options
Diffstat (limited to 'src/widgets/util')
-rw-r--r-- | src/widgets/util/qcompleter.cpp | 4 | ||||
-rw-r--r-- | src/widgets/util/qcompleter.h | 2 | ||||
-rw-r--r-- | src/widgets/util/qscroller.cpp | 4 | ||||
-rw-r--r-- | src/widgets/util/qsystemtrayicon.cpp | 2 | ||||
-rw-r--r-- | src/widgets/util/qsystemtrayicon_x11.cpp | 70 | ||||
-rw-r--r-- | src/widgets/util/qundostack.cpp | 55 | ||||
-rw-r--r-- | src/widgets/util/qundostack.h | 5 |
7 files changed, 71 insertions, 71 deletions
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 599b983748..96dde64ccc 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -1000,7 +1000,7 @@ QCompleter::QCompleter(QAbstractItemModel *model, QObject *parent) d->init(model); } -#ifndef QT_NO_STRINGLISTMODEL +#if QT_CONFIG(stringlistmodel) /*! Constructs a QCompleter object with the given \a parent that uses the specified \a list as a source of possible completions. @@ -1011,7 +1011,7 @@ QCompleter::QCompleter(const QStringList& list, QObject *parent) Q_D(QCompleter); d->init(new QStringListModel(list, this)); } -#endif // QT_NO_STRINGLISTMODEL +#endif // QT_CONFIG(stringlistmodel) /*! Destroys the completer object. diff --git a/src/widgets/util/qcompleter.h b/src/widgets/util/qcompleter.h index de79302e15..fd1191d123 100644 --- a/src/widgets/util/qcompleter.h +++ b/src/widgets/util/qcompleter.h @@ -84,7 +84,7 @@ public: QCompleter(QObject *parent = nullptr); QCompleter(QAbstractItemModel *model, QObject *parent = nullptr); -#ifndef QT_NO_STRINGLISTMODEL +#if QT_CONFIG(stringlistmodel) QCompleter(const QStringList& completions, QObject *parent = nullptr); #endif ~QCompleter(); diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp index 903a141e49..28504f5631 100644 --- a/src/widgets/util/qscroller.cpp +++ b/src/widgets/util/qscroller.cpp @@ -1894,7 +1894,7 @@ qreal QScrollerPrivate::nextSnapPos(qreal p, int dir, Qt::Orientation orientatio if (orientation == Qt::Horizontal) { // the snap points in the list - foreach (qreal snapPos, snapPositionsX) { + for (qreal snapPos : snapPositionsX) { qreal snapPosDist = snapPos - p; if ((dir > 0 && snapPosDist < 0) || (dir < 0 && snapPosDist > 0)) @@ -1941,7 +1941,7 @@ qreal QScrollerPrivate::nextSnapPos(qreal p, int dir, Qt::Orientation orientatio } else { // (orientation == Qt::Vertical) // the snap points in the list - foreach (qreal snapPos, snapPositionsY) { + for (qreal snapPos : snapPositionsY) { qreal snapPosDist = snapPos - p; if ((dir > 0 && snapPosDist < 0) || (dir < 0 && snapPosDist > 0)) diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 86c824afdb..d15f5e5955 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -523,6 +523,8 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title, closeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); closeButton->setFixedSize(closeButtonSize, closeButtonSize); QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); +#else + Q_UNUSED(closeButtonSize); #endif #if QT_CONFIG(label) diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp index df93e15f80..86532456c7 100644 --- a/src/widgets/util/qsystemtrayicon_x11.cpp +++ b/src/widgets/util/qsystemtrayicon_x11.cpp @@ -63,8 +63,6 @@ #include <private/qguiapplication_p.h> #include <qdebug.h> -#include <QtPlatformHeaders/qxcbwindowfunctions.h> -#include <QtPlatformHeaders/qxcbintegrationfunctions.h> #ifndef QT_NO_SYSTEMTRAYICON QT_BEGIN_NAMESPACE @@ -98,10 +96,7 @@ private slots: void systemTrayWindowChanged(QScreen *screen); private: - bool addToTray(); - QSystemTrayIcon *q; - QPixmap background; }; QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *qIn) @@ -117,55 +112,13 @@ QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *qIn) const QSize size(22, 22); // Gnome, standard size setGeometry(QRect(QPoint(0, 0), size)); setMinimumSize(size); - - // We need two different behaviors depending on whether the X11 visual for the system tray - // (a) exists and (b) supports an alpha channel, i.e. is 32 bits. - // If we have a visual that has an alpha channel, we can paint this widget with a transparent - // background and it will work. - // However, if there's no alpha channel visual, in order for transparent tray icons to work, - // we do not have a transparent background on the widget, but set the BackPixmap property of our - // window to ParentRelative (so that it inherits the background of its X11 parent window), call - // xcb_clear_region before painting (so that the inherited background is visible) and then grab - // the just-drawn background from the X11 server. - bool hasAlphaChannel = QXcbIntegrationFunctions::xEmbedSystemTrayVisualHasAlphaChannel(); - setAttribute(Qt::WA_TranslucentBackground, hasAlphaChannel); - if (!hasAlphaChannel) { - createWinId(); - QXcbWindowFunctions::setParentRelativeBackPixmap(windowHandle()); - - // XXX: This is actually required, but breaks things ("QWidget::paintEngine: Should no - // longer be called"). Why is this needed? When the widget is drawn, we use tricks to grab - // the tray icon's background from the server. If the tray icon isn't visible (because - // another window is on top of it), the trick fails and instead uses the content of that - // other window as the background. - // setAttribute(Qt::WA_PaintOnScreen); - } - - addToTray(); -} - -bool QSystemTrayIconSys::addToTray() -{ - if (!locateSystemTray()) - return false; - - createWinId(); + setAttribute(Qt::WA_TranslucentBackground); setMouseTracking(true); - - if (!QXcbWindowFunctions::requestSystemTrayWindowDock(windowHandle())) - return false; - - if (!background.isNull()) - background = QPixmap(); - show(); - return true; } void QSystemTrayIconSys::systemTrayWindowChanged(QScreen *) { - if (locateSystemTray()) { - addToTray(); - } else { + if (!locateSystemTray()) { QBalloonTip::hideBalloon(); hide(); // still no luck destroy(); @@ -174,7 +127,7 @@ void QSystemTrayIconSys::systemTrayWindowChanged(QScreen *) QRect QSystemTrayIconSys::globalGeometry() const { - return QXcbWindowFunctions::systemTrayWindowGlobalGeometry(windowHandle()); + return QRect(mapToGlobal(QPoint(0, 0)), size()); } void QSystemTrayIconSys::mousePressEvent(QMouseEvent *ev) @@ -227,22 +180,6 @@ void QSystemTrayIconSys::paintEvent(QPaintEvent *) const QRect rect(QPoint(0, 0), geometry().size()); QPainter painter(this); - // If we have Qt::WA_TranslucentBackground set, during widget creation - // we detected the systray visual supported an alpha channel - if (testAttribute(Qt::WA_TranslucentBackground)) { - painter.setCompositionMode(QPainter::CompositionMode_Source); - painter.fillRect(rect, Qt::transparent); - } else { - // clearRegion() was called on XEMBED_EMBEDDED_NOTIFY, so we hope that got done by now. - // Grab the tray background pixmap, before rendering the icon for the first time. - if (background.isNull()) { - background = QGuiApplication::primaryScreen()->grabWindow(winId(), - 0, 0, rect.size().width(), rect.size().height()); - } - // Then paint over the icon area with the background before compositing the icon on top. - painter.drawPixmap(QPoint(0, 0), background); - } - painter.setCompositionMode(QPainter::CompositionMode_SourceOver); q->icon().paint(&painter, rect); } @@ -285,6 +222,7 @@ void QSystemTrayIconPrivate::install_sys() sys = new QSystemTrayIconSys(q); QObject::connect(QGuiApplication::platformNativeInterface(), SIGNAL(systemTrayWindowChanged(QScreen*)), sys, SLOT(systemTrayWindowChanged(QScreen*))); + sys->show(); } } diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp index b371e903a6..e928b9fe37 100644 --- a/src/widgets/util/qundostack.cpp +++ b/src/widgets/util/qundostack.cpp @@ -742,6 +742,17 @@ void QUndoStack::resetClean() } /*! + \since 5.12 + \property QUndoStack::clean + \brief the clean status of this stack. + + This property indicates whether or not the stack is clean. For example, a + stack is clean when a document has been saved. + + \sa isClean(), setClean(), resetClean(), cleanIndex() +*/ + +/*! If the stack is in the clean state, returns \c true; otherwise returns \c false. \sa setClean(), cleanIndex() @@ -940,6 +951,17 @@ void QUndoStack::setIndex(int idx) } /*! + \since 5.12 + \property QUndoStack::canUndo + \brief whether this stack can undo. + + This property indicates whether or not there is a command that can be + undone. + + \sa canUndo(), index(), canRedo() +*/ + +/*! Returns \c true if there is a command available for undo; otherwise returns \c false. This function returns \c false if the stack is empty, or if the bottom command @@ -959,6 +981,17 @@ bool QUndoStack::canUndo() const } /*! + \since 5.12 + \property QUndoStack::canRedo + \brief whether this stack can redo. + + This property indicates whether or not there is a command that can be + redone. + + \sa canRedo(), index(), canUndo() +*/ + +/*! Returns \c true if there is a command available for redo; otherwise returns \c false. This function returns \c false if the stack is empty or if the top command @@ -978,6 +1011,17 @@ bool QUndoStack::canRedo() const } /*! + \since 5.12 + \property QUndoStack::undoText + \brief the undo text of the next command that is undone. + + This property holds the text of the command which will be undone in the + next call to undo(). + + \sa undoText(), QUndoCommand::actionText(), redoText() +*/ + +/*! Returns the text of the command which will be undone in the next call to undo(). \sa QUndoCommand::actionText(), redoText() @@ -994,6 +1038,17 @@ QString QUndoStack::undoText() const } /*! + \since 5.12 + \property QUndoStack::redoText + \brief the redo text of the next command that is redone. + + This property holds the text of the command which will be redone in the + next call to redo(). + + \sa redoText(), QUndoCommand::actionText(), undoText() +*/ + +/*! Returns the text of the command which will be redone in the next call to redo(). \sa QUndoCommand::actionText(), undoText() diff --git a/src/widgets/util/qundostack.h b/src/widgets/util/qundostack.h index 4be24eadab..b5716b2e9b 100644 --- a/src/widgets/util/qundostack.h +++ b/src/widgets/util/qundostack.h @@ -90,6 +90,11 @@ class Q_WIDGETS_EXPORT QUndoStack : public QObject Q_DECLARE_PRIVATE(QUndoStack) Q_PROPERTY(bool active READ isActive WRITE setActive) Q_PROPERTY(int undoLimit READ undoLimit WRITE setUndoLimit) + Q_PROPERTY(bool canUndo READ canUndo NOTIFY canUndoChanged) + Q_PROPERTY(bool canRedo READ canRedo NOTIFY canRedoChanged) + Q_PROPERTY(QString undoText READ undoText NOTIFY undoTextChanged) + Q_PROPERTY(QString redoText READ redoText NOTIFY redoTextChanged) + Q_PROPERTY(bool clean READ isClean NOTIFY cleanChanged) public: explicit QUndoStack(QObject *parent = nullptr); |