diff options
Diffstat (limited to 'src/widgets/util')
-rw-r--r-- | src/widgets/util/qcolormap.h | 1 | ||||
-rw-r--r-- | src/widgets/util/qcompleter.cpp | 12 | ||||
-rw-r--r-- | src/widgets/util/qcompleter.h | 1 | ||||
-rw-r--r-- | src/widgets/util/qcompleter_p.h | 1 | ||||
-rw-r--r-- | src/widgets/util/qflickgesture.cpp | 10 | ||||
-rw-r--r-- | src/widgets/util/qflickgesture_p.h | 1 | ||||
-rw-r--r-- | src/widgets/util/qscroller.h | 1 | ||||
-rw-r--r-- | src/widgets/util/qscroller_p.h | 1 | ||||
-rw-r--r-- | src/widgets/util/qscrollerproperties.h | 1 | ||||
-rw-r--r-- | src/widgets/util/qscrollerproperties_p.h | 1 | ||||
-rw-r--r-- | src/widgets/util/qsystemtrayicon.cpp | 29 | ||||
-rw-r--r-- | src/widgets/util/qsystemtrayicon.h | 1 | ||||
-rw-r--r-- | src/widgets/util/qsystemtrayicon_p.h | 7 | ||||
-rw-r--r-- | src/widgets/util/qsystemtrayicon_win.cpp | 10 | ||||
-rw-r--r-- | src/widgets/util/qsystemtrayicon_wince.cpp | 301 | ||||
-rw-r--r-- | src/widgets/util/qundogroup.h | 1 | ||||
-rw-r--r-- | src/widgets/util/qundostack.cpp | 4 | ||||
-rw-r--r-- | src/widgets/util/qundostack.h | 1 | ||||
-rw-r--r-- | src/widgets/util/qundostack_p.h | 1 | ||||
-rw-r--r-- | src/widgets/util/qundoview.h | 1 | ||||
-rw-r--r-- | src/widgets/util/util.pri | 4 |
21 files changed, 40 insertions, 350 deletions
diff --git a/src/widgets/util/qcolormap.h b/src/widgets/util/qcolormap.h index 0c752d4a22..8e652d8154 100644 --- a/src/widgets/util/qcolormap.h +++ b/src/widgets/util/qcolormap.h @@ -40,6 +40,7 @@ #ifndef QCOLORMAP_H #define QCOLORMAP_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qatomic.h> #include <QtGui/qrgb.h> #include <QtCore/qvector.h> diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 2c7dbf63be..3006f0c9ce 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -480,7 +480,7 @@ QMatchData QCompletionEngine::filterHistory() for (int i = 0; i < source->rowCount(); i++) { QString str = source->index(i, c->column).data().toString(); if (str.startsWith(c->prefix, c->cs) -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) && ((!isFsModel && !isDirModel) || QDir::toNativeSeparators(str) != QDir::separator()) #endif ) @@ -1055,7 +1055,7 @@ void QCompleter::setModel(QAbstractItemModel *model) delete oldModel; #ifndef QT_NO_DIRMODEL if (qobject_cast<QDirModel *>(model)) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) setCaseSensitivity(Qt::CaseInsensitive); #else setCaseSensitivity(Qt::CaseSensitive); @@ -1065,7 +1065,7 @@ void QCompleter::setModel(QAbstractItemModel *model) #ifndef QT_NO_FILESYSTEMMODEL QFileSystemModel *fsModel = qobject_cast<QFileSystemModel *>(model); if (fsModel) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) setCaseSensitivity(Qt::CaseInsensitive); #else setCaseSensitivity(Qt::CaseSensitive); @@ -1790,7 +1790,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const idx = parent.sibling(parent.row(), index.column()); } while (idx.isValid()); -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) if (list.count() == 1) // only the separator or some other text return list[0]; list[0].clear() ; // the join below will provide the separator @@ -1830,7 +1830,7 @@ QStringList QCompleter::splitPath(const QString& path) const return QStringList(completionPrefix()); QString pathCopy = QDir::toNativeSeparators(path); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (pathCopy == QLatin1String("\\") || pathCopy == QLatin1String("\\\\")) return QStringList(pathCopy); const bool startsWithDoubleSlash = pathCopy.startsWith(QLatin1String("\\\\")); @@ -1841,7 +1841,7 @@ QStringList QCompleter::splitPath(const QString& path) const const QChar sep = QDir::separator(); QStringList parts = pathCopy.split(sep); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (startsWithDoubleSlash) parts[0].prepend(QLatin1String("\\\\")); #else diff --git a/src/widgets/util/qcompleter.h b/src/widgets/util/qcompleter.h index 435639be99..33e6540264 100644 --- a/src/widgets/util/qcompleter.h +++ b/src/widgets/util/qcompleter.h @@ -40,6 +40,7 @@ #ifndef QCOMPLETER_H #define QCOMPLETER_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #include <QtCore/qpoint.h> #include <QtCore/qstring.h> diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h index 10dde975c0..c35f70b451 100644 --- a/src/widgets/util/qcompleter_p.h +++ b/src/widgets/util/qcompleter_p.h @@ -52,6 +52,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qobject_p.h" #ifndef QT_NO_COMPLETER diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp index 4f08664784..57db9ff7fc 100644 --- a/src/widgets/util/qflickgesture.cpp +++ b/src/widgets/util/qflickgesture.cpp @@ -551,11 +551,11 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state, case QEvent::TouchBegin: inputType = QScroller::InputPress; - // fall through + Q_FALLTHROUGH(); case QEvent::TouchEnd: if (!inputType) inputType = QScroller::InputRelease; - // fallthrough + Q_FALLTHROUGH(); case QEvent::TouchUpdate: if (!inputType) inputType = QScroller::InputMove; @@ -669,7 +669,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state, event->accept(); } } - // fall through + Q_FALLTHROUGH(); case QEvent::TouchBegin: q->setHotSpot(globalPos); result |= scrollerIsActive ? TriggerGesture : MayBeGesture; @@ -681,7 +681,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state, #endif if (PressDelayHandler::instance()->isDelaying()) result |= ConsumeEventHint; - // fall through + Q_FALLTHROUGH(); case QEvent::TouchUpdate: result |= scrollerIsActive ? TriggerGesture : Ignore; break; @@ -692,7 +692,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state, case QEvent::MouseButtonRelease: if (PressDelayHandler::instance()->released(event, scrollerWasDragging || scrollerWasScrolling, scrollerIsActive)) result |= ConsumeEventHint; - // fall through + Q_FALLTHROUGH(); case QEvent::TouchEnd: result |= scrollerIsActive ? FinishGesture : CancelGesture; break; diff --git a/src/widgets/util/qflickgesture_p.h b/src/widgets/util/qflickgesture_p.h index 1b82a314ee..fa70806ef7 100644 --- a/src/widgets/util/qflickgesture_p.h +++ b/src/widgets/util/qflickgesture_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qevent.h" #include "qgesturerecognizer.h" #include "private/qgesture_p.h" diff --git a/src/widgets/util/qscroller.h b/src/widgets/util/qscroller.h index 1e017a2410..561dcfaefc 100644 --- a/src/widgets/util/qscroller.h +++ b/src/widgets/util/qscroller.h @@ -40,6 +40,7 @@ #ifndef QSCROLLER_H #define QSCROLLER_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/QObject> #include <QtCore/QPointF> #include <QtWidgets/QScrollerProperties> diff --git a/src/widgets/util/qscroller_p.h b/src/widgets/util/qscroller_p.h index 24ad841a91..4557e7cc33 100644 --- a/src/widgets/util/qscroller_p.h +++ b/src/widgets/util/qscroller_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QObject> #include <QPointer> #include <QQueue> diff --git a/src/widgets/util/qscrollerproperties.h b/src/widgets/util/qscrollerproperties.h index 67f3d0e15d..4fdc9bd32f 100644 --- a/src/widgets/util/qscrollerproperties.h +++ b/src/widgets/util/qscrollerproperties.h @@ -40,6 +40,7 @@ #ifndef QSCROLLERPROPERTIES_H #define QSCROLLERPROPERTIES_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/QScopedPointer> #include <QtCore/QMetaType> #include <QtCore/QVariant> diff --git a/src/widgets/util/qscrollerproperties_p.h b/src/widgets/util/qscrollerproperties_p.h index d480d8d829..7965171321 100644 --- a/src/widgets/util/qscrollerproperties_p.h +++ b/src/widgets/util/qscrollerproperties_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QPointF> #include <QEasingCurve> #include <qscrollerproperties.h> diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 74feb05d9b..2a418167f1 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -141,7 +141,7 @@ QSystemTrayIcon::QSystemTrayIcon(QObject *parent) \sa visible */ QSystemTrayIcon::QSystemTrayIcon(const QIcon &icon, QObject *parent) -: QObject(*new QSystemTrayIconPrivate(), parent) + : QSystemTrayIcon(parent) { setIcon(icon); } @@ -446,19 +446,11 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title titleLabel->setText(title); QFont f = titleLabel->font(); f.setBold(true); -#ifdef Q_OS_WINCE - f.setPointSize(f.pointSize() - 2); -#endif titleLabel->setFont(f); titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows -#ifdef Q_OS_WINCE - const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize); - const int closeButtonSize = style()->pixelMetric(QStyle::PM_SmallIconSize) - 2; -#else const int iconSize = 18; const int closeButtonSize = 15; -#endif QPushButton *closeButton = new QPushButton; closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton)); @@ -468,21 +460,13 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); QLabel *msgLabel = new QLabel; -#ifdef Q_OS_WINCE - f.setBold(false); - msgLabel->setFont(f); -#endif msgLabel->installEventFilter(this); msgLabel->setText(message); msgLabel->setTextFormat(Qt::PlainText); msgLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft); // smart size for the message label -#ifdef Q_OS_WINCE - int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 2; -#else int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 3; -#endif if (msgLabel->sizeHint().width() > limit) { msgLabel->setWordWrap(true); if (msgLabel->sizeHint().width() > limit) { @@ -493,15 +477,9 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title control->document()->setDefaultTextOption(opt); } } -#ifdef Q_OS_WINCE - // Make sure that the text isn't wrapped "somewhere" in the balloon widget - // in the case that we have a long title label. - setMaximumWidth(limit); -#else // Here we allow the text being much smaller than the balloon widget // to emulate the weird standard windows behavior. msgLabel->setFixedSize(limit, msgLabel->heightForWidth(limit)); -#endif } QIcon si; @@ -753,9 +731,8 @@ void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const // The recursion depth is the same as menu depth, so should not // be higher than 3 levels. - QListIterator<QAction *> it(menu->actions()); - while (it.hasNext()) { - QAction *action = it.next(); + const auto actions = menu->actions(); + for (QAction *action : actions) { if (action->menu()) addPlatformMenu(action->menu()); } diff --git a/src/widgets/util/qsystemtrayicon.h b/src/widgets/util/qsystemtrayicon.h index 105e25f44e..fb238c92b0 100644 --- a/src/widgets/util/qsystemtrayicon.h +++ b/src/widgets/util/qsystemtrayicon.h @@ -40,6 +40,7 @@ #ifndef QSYSTEMTRAYICON_H #define QSYSTEMTRAYICON_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #ifndef QT_NO_SYSTEMTRAYICON diff --git a/src/widgets/util/qsystemtrayicon_p.h b/src/widgets/util/qsystemtrayicon_p.h index 396a91eea6..79e824f4b7 100644 --- a/src/widgets/util/qsystemtrayicon_p.h +++ b/src/widgets/util/qsystemtrayicon_p.h @@ -44,13 +44,14 @@ // W A R N I N G // ------------- // -// This file is not part of the Qt API. It exists for the convenience -// of a number of Qt sources files. This header file may change from -// version to version without notice, or even be removed. +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qsystemtrayicon.h" #include "private/qobject_p.h" diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp index 7cbf979901..2da24e482b 100644 --- a/src/widgets/util/qsystemtrayicon_win.cpp +++ b/src/widgets/util/qsystemtrayicon_win.cpp @@ -200,7 +200,7 @@ QSystemTrayIconSys::QSystemTrayIconSys(HWND hwnd, QSystemTrayIcon *object) MYWM_TASKBARCREATED = RegisterWindowMessage(L"TaskbarCreated"); } - // Allow the WM_TASKBARCREATED message through the UIPI filter on Windows Vista and higher + // Allow the WM_TASKBARCREATED message through the UIPI filter on Windows 7 and higher static PtrChangeWindowMessageFilterEx pChangeWindowMessageFilterEx = (PtrChangeWindowMessageFilterEx)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilterEx"); @@ -208,13 +208,14 @@ QSystemTrayIconSys::QSystemTrayIconSys(HWND hwnd, QSystemTrayIcon *object) // Call the safer ChangeWindowMessageFilterEx API if available (Windows 7 onwards) pChangeWindowMessageFilterEx(m_hwnd, MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW, 0); } else { + // Call the deprecated ChangeWindowMessageFilter API otherwise (Vista onwards) + // May 2016: Still resolved at runtime since the definition is not present in MinGW 4.9. + // TODO: Replace by direct invocation when upgrading MinGW. static PtrChangeWindowMessageFilter pChangeWindowMessageFilter = (PtrChangeWindowMessageFilter)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilter"); - if (pChangeWindowMessageFilter) { - // Call the deprecated ChangeWindowMessageFilter API otherwise + if (pChangeWindowMessageFilter) pChangeWindowMessageFilter(MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW); - } } } @@ -416,6 +417,7 @@ QRect QSystemTrayIconSys::findIconGeometry(UINT iconId) UINT uID; }; + // Windows 7 onwards. static PtrShell_NotifyIconGetRect Shell_NotifyIconGetRect = (PtrShell_NotifyIconGetRect)QSystemLibrary::resolve(QLatin1String("shell32"), "Shell_NotifyIconGetRect"); diff --git a/src/widgets/util/qsystemtrayicon_wince.cpp b/src/widgets/util/qsystemtrayicon_wince.cpp deleted file mode 100644 index fa876574f8..0000000000 --- a/src/widgets/util/qsystemtrayicon_wince.cpp +++ /dev/null @@ -1,301 +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 "qsystemtrayicon_p.h" -#ifndef QT_NO_SYSTEMTRAYICON -#define _WIN32_IE 0x0600 //required for NOTIFYICONDATA_V2_SIZE - -#include <qt_windows.h> -#include <shlwapi.h> -#include <QApplication> - -QT_BEGIN_NAMESPACE - -static const UINT q_uNOTIFYICONID = 13; // IDs from 0 to 12 are reserved on WinCE. -#define MYWM_NOTIFYICON (WM_APP+101) - -struct Q_NOTIFYICONIDENTIFIER { - DWORD cbSize; - HWND hWnd; - UINT uID; - GUID guidItem; -}; - -class QSystemTrayIconSys : QWidget -{ -public: - QSystemTrayIconSys(QSystemTrayIcon *object); - ~QSystemTrayIconSys(); - bool winEvent( MSG *m, long *result ); - bool trayMessage(DWORD msg); - void setIconContents(NOTIFYICONDATA &data); - void createIcon(); - QRect findTrayGeometry(); - HICON hIcon; - QPoint globalPos; - QSystemTrayIcon *q; -private: - uint notifyIconSize; - int maxTipLength; - bool ignoreNextMouseRelease; -}; - -QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object) - : hIcon(0), q(object), ignoreNextMouseRelease(false) - -{ - notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, szTip[64]); // NOTIFYICONDATAW_V1_SIZE; - maxTipLength = 64; -} - -QSystemTrayIconSys::~QSystemTrayIconSys() -{ - if (hIcon) - DestroyIcon(hIcon); -} - -QRect QSystemTrayIconSys::findTrayGeometry() -{ - // Use lower right corner as fallback - QPoint brCorner = qApp->desktop()->screenGeometry().bottomRight(); - QRect ret(brCorner.x() - 10, brCorner.y() - 10, 10, 10); - return ret; -} - -void QSystemTrayIconSys::setIconContents(NOTIFYICONDATA &tnd) -{ - tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; - tnd.uCallbackMessage = MYWM_NOTIFYICON; - tnd.hIcon = hIcon; - QString tip = q->toolTip(); - - if (!tip.isNull()) { - tip = tip.left(maxTipLength - 1) + QChar(); - memcpy(tnd.szTip, tip.utf16(), qMin(tip.length() + 1, maxTipLength) * sizeof(wchar_t)); - } -} - -bool QSystemTrayIconSys::trayMessage(DWORD msg) -{ - NOTIFYICONDATA tnd; - memset(&tnd, 0, notifyIconSize); - tnd.uID = q_uNOTIFYICONID; - tnd.cbSize = notifyIconSize; - tnd.hWnd = winId(); - - Q_ASSERT(testAttribute(Qt::WA_WState_Created)); - - if (msg != NIM_DELETE) { - setIconContents(tnd); - } - - return Shell_NotifyIcon(msg, &tnd); -} - -void QSystemTrayIconSys::createIcon() -{ - hIcon = 0; - QIcon icon = q->icon(); - if (icon.isNull()) - return; - - //const QSize preferredSize(GetSystemMetrics(SM_CXSMICON) * 2, GetSystemMetrics(SM_CYSMICON) * 2); - const QSize preferredSize(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON)); - QPixmap pm = icon.pixmap(preferredSize); - if (pm.isNull()) - return; - - hIcon = pm.toWinHICON(); -} - -bool QSystemTrayIconSys::winEvent( MSG *m, long *result ) -{ - switch(m->message) { - case WM_CREATE: - SetWindowLong(winId(), GWL_USERDATA, (LONG)((CREATESTRUCTW*)m->lParam)->lpCreateParams); - break; - - case MYWM_NOTIFYICON: - { - QPoint gpos = QCursor::pos(); - - switch (m->lParam) { - case WM_LBUTTONUP: - if (ignoreNextMouseRelease) - ignoreNextMouseRelease = false; - else - emit q->activated(QSystemTrayIcon::Trigger); - break; - - case WM_LBUTTONDBLCLK: - ignoreNextMouseRelease = true; // Since DBLCLICK Generates a second mouse - // release we must ignore it - emit q->activated(QSystemTrayIcon::DoubleClick); - break; - - case WM_RBUTTONUP: - if (q->contextMenu()) { - q->contextMenu()->popup(gpos); - - // We must ensure that the popup menu doesn't show up behind the task bar. - QRect desktopRect = qApp->desktop()->availableGeometry(); - int maxY = desktopRect.y() + desktopRect.height() - q->contextMenu()->height(); - if (gpos.y() > maxY) { - gpos.ry() = maxY; - q->contextMenu()->move(gpos); - } - } - emit q->activated(QSystemTrayIcon::Context); - break; - - case WM_MBUTTONUP: - emit q->activated(QSystemTrayIcon::MiddleClick); - break; - - default: - break; - } - break; - } - default: - return QWidget::winEvent(m, result); - } - return 0; -} - -QSystemTrayIconPrivate::QSystemTrayIconPrivate() - : sys(0), - visible(false) -{ -} - -QSystemTrayIconPrivate::~QSystemTrayIconPrivate() -{ -} - -void QSystemTrayIconPrivate::install_sys() -{ - Q_Q(QSystemTrayIcon); - if (!sys) { - sys = new QSystemTrayIconSys(q); - sys->createIcon(); - sys->trayMessage(NIM_ADD); - } -} - -void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, int timeOut) -{ - if (!sys) - return; - - uint uSecs = 0; - if ( timeOut < 0) - uSecs = 10000; //10 sec default - else uSecs = (int)timeOut; - - //message is limited to 255 chars + NULL - QString messageString; - if (message.isEmpty() && !title.isEmpty()) - messageString = QLatin1Char(' '); //ensures that the message shows when only title is set - else - messageString = message.left(255) + QChar(); - - //title is limited to 63 chars + NULL - QString titleString = title.left(63) + QChar(); - - //show QBalloonTip - QRect trayRect = sys->findTrayGeometry(); - QBalloonTip::showBalloon(type, title, message, sys->q, QPoint(trayRect.left(), - trayRect.center().y()), uSecs, false); -} - -QRect QSystemTrayIconPrivate::geometry_sys() const -{ - return QRect(); -} - -void QSystemTrayIconPrivate::remove_sys() -{ - if (!sys) - return; - - sys->trayMessage(NIM_DELETE); - delete sys; - sys = 0; -} - -void QSystemTrayIconPrivate::updateIcon_sys() -{ - if (!sys) - return; - - HICON hIconToDestroy = sys->hIcon; - - sys->createIcon(); - sys->trayMessage(NIM_MODIFY); - - if (hIconToDestroy) - DestroyIcon(hIconToDestroy); -} - -void QSystemTrayIconPrivate::updateMenu_sys() -{ - -} - -void QSystemTrayIconPrivate::updateToolTip_sys() -{ - // Calling sys->trayMessage(NIM_MODIFY) on an existing icon is broken on Windows CE. - // So we need to call updateIcon_sys() which creates a new icon handle. - updateIcon_sys(); -} - -bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys() -{ - return true; -} - -bool QSystemTrayIconPrivate::supportsMessages_sys() -{ - return true; -} - -QT_END_NAMESPACE - -#endif diff --git a/src/widgets/util/qundogroup.h b/src/widgets/util/qundogroup.h index f4243d483e..4e2fdeed26 100644 --- a/src/widgets/util/qundogroup.h +++ b/src/widgets/util/qundogroup.h @@ -40,6 +40,7 @@ #ifndef QUNDOGROUP_H #define QUNDOGROUP_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #include <QtCore/qstring.h> diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp index 307debc03f..18f85ca505 100644 --- a/src/widgets/util/qundostack.cpp +++ b/src/widgets/util/qundostack.cpp @@ -110,10 +110,8 @@ QT_BEGIN_NAMESPACE */ QUndoCommand::QUndoCommand(const QString &text, QUndoCommand *parent) + : QUndoCommand(parent) { - d = new QUndoCommandPrivate; - if (parent != 0) - parent->d->child_list.append(this); setText(text); } diff --git a/src/widgets/util/qundostack.h b/src/widgets/util/qundostack.h index fbd8f237ee..f4db78300b 100644 --- a/src/widgets/util/qundostack.h +++ b/src/widgets/util/qundostack.h @@ -40,6 +40,7 @@ #ifndef QUNDOSTACK_H #define QUNDOSTACK_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #include <QtCore/qstring.h> diff --git a/src/widgets/util/qundostack_p.h b/src/widgets/util/qundostack_p.h index 9bfe527306..1bfe992426 100644 --- a/src/widgets/util/qundostack_p.h +++ b/src/widgets/util/qundostack_p.h @@ -40,6 +40,7 @@ #ifndef QUNDOSTACK_P_H #define QUNDOSTACK_P_H +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <private/qobject_p.h> #include <QtCore/qlist.h> #include <QtCore/qstring.h> diff --git a/src/widgets/util/qundoview.h b/src/widgets/util/qundoview.h index fab040ba0e..3ed9ea5989 100644 --- a/src/widgets/util/qundoview.h +++ b/src/widgets/util/qundoview.h @@ -40,6 +40,7 @@ #ifndef QUNDOVIEW_H #define QUNDOVIEW_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qlistview.h> #include <QtCore/qstring.h> diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri index 9f43dc42f0..cb19c1fc95 100644 --- a/src/widgets/util/util.pri +++ b/src/widgets/util/util.pri @@ -27,9 +27,9 @@ SOURCES += \ util/qundostack.cpp \ util/qundoview.cpp -win32:!wince:!winrt { +win32:!winrt { SOURCES += util/qsystemtrayicon_win.cpp -} else:contains(QT_CONFIG, xcb) { +} else: qtConfig(xcb) { SOURCES += util/qsystemtrayicon_x11.cpp } else { SOURCES += util/qsystemtrayicon_qpa.cpp |