From 115d4fc8cc1816d70f41c839d7eaa4e24ff86db2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 8 Mar 2016 15:51:15 +0100 Subject: QtWidgets: Remove Windows CE. Remove Windows CE-specific files, #ifdef sections for Q_OS_WINCE and wince .pro file clauses in library, examples and tests. Task-number: QTBUG-51673 Change-Id: I102745aaca9d9737f2108fe7618111743d5ae980 Reviewed-by: Marc Mutz --- src/widgets/dialogs/qcolordialog.cpp | 10 +- src/widgets/dialogs/qdialog.cpp | 25 - src/widgets/dialogs/qdialog.h | 7 - src/widgets/dialogs/qdialog_p.h | 4 - src/widgets/dialogs/qerrormessage.cpp | 28 -- src/widgets/dialogs/qfiledialog.cpp | 12 +- src/widgets/dialogs/qfiledialog_p.h | 4 - src/widgets/dialogs/qfileinfogatherer.cpp | 2 +- src/widgets/dialogs/qfilesystemmodel.cpp | 15 +- src/widgets/dialogs/qfilesystemmodel_p.h | 2 +- src/widgets/dialogs/qfontdialog.cpp | 4 - src/widgets/dialogs/qmessagebox.cpp | 72 --- src/widgets/dialogs/qmessagebox.h | 4 - src/widgets/dialogs/qwizard.cpp | 8 - src/widgets/itemviews/qdirmodel.cpp | 20 +- src/widgets/itemviews/qfileiconprovider.cpp | 2 +- src/widgets/kernel/qapplication.cpp | 41 +- src/widgets/kernel/qapplication.h | 7 - src/widgets/kernel/qapplication_p.h | 8 +- src/widgets/kernel/qlayout.cpp | 5 - src/widgets/kernel/qwidget.cpp | 12 +- src/widgets/kernel/qwidgetsfunctions_wince.cpp | 120 ----- src/widgets/kernel/qwidgetsfunctions_wince.h | 60 --- src/widgets/kernel/win.pri | 4 +- src/widgets/styles/qstyle_wince.qrc | 97 ---- src/widgets/styles/qwindowsstyle.cpp | 25 +- src/widgets/styles/styles.pri | 6 +- src/widgets/util/qcompleter.cpp | 12 +- src/widgets/util/qsystemtrayicon.cpp | 22 - src/widgets/util/qsystemtrayicon_wince.cpp | 301 ----------- src/widgets/util/util.pri | 2 +- src/widgets/widgets.pro | 1 - src/widgets/widgets/qdockwidget.cpp | 2 +- src/widgets/widgets/qeffects.cpp | 12 +- src/widgets/widgets/qmdisubwindow.cpp | 2 +- src/widgets/widgets/qmenu.cpp | 11 - src/widgets/widgets/qmenu.h | 10 - src/widgets/widgets/qmenu_p.h | 42 +- src/widgets/widgets/qmenu_wince.cpp | 666 ------------------------- src/widgets/widgets/qmenu_wince.rc | 231 --------- src/widgets/widgets/qmenu_wince_resource_p.h | 89 ---- src/widgets/widgets/qmenubar.cpp | 85 +--- src/widgets/widgets/qmenubar.h | 11 - src/widgets/widgets/qmenubar_p.h | 53 +- src/widgets/widgets/qscrollbar.cpp | 6 - src/widgets/widgets/qtoolbar.cpp | 11 - src/widgets/widgets/widgets.pri | 16 - 47 files changed, 50 insertions(+), 2139 deletions(-) delete mode 100644 src/widgets/kernel/qwidgetsfunctions_wince.cpp delete mode 100644 src/widgets/kernel/qwidgetsfunctions_wince.h delete mode 100644 src/widgets/styles/qstyle_wince.qrc delete mode 100644 src/widgets/util/qsystemtrayicon_wince.cpp delete mode 100644 src/widgets/widgets/qmenu_wince.cpp delete mode 100644 src/widgets/widgets/qmenu_wince.rc delete mode 100644 src/widgets/widgets/qmenu_wince_resource_p.h (limited to 'src') diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index ad13deb044..bc1a0365c7 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -1203,14 +1203,10 @@ QColorShower::QColorShower(QColorDialog *parent) gl->setMargin(gl->spacing()); lab = new QColorShowLabel(this); -#ifndef Q_OS_WINCE #ifdef QT_SMALL_COLORDIALOG lab->setMinimumHeight(60); #endif lab->setMinimumWidth(60); -#else - lab->setMinimumWidth(20); -#endif // For QVGA screens only the comboboxes and color label are visible. // For nHD screens only color and luminence pickers and color label are visible. @@ -1725,7 +1721,7 @@ void QColorDialogPrivate::initWidgets() leftLay = 0; -#if defined(Q_OS_WINCE) || defined(QT_SMALL_COLORDIALOG) +#if defined(QT_SMALL_COLORDIALOG) smallDisplay = true; const int lumSpace = 20; #else @@ -1748,7 +1744,7 @@ void QColorDialogPrivate::initWidgets() leftLay->addWidget(lblBasicColors); leftLay->addWidget(standard); -#if !defined(Q_OS_WINCE) && !defined(QT_SMALL_COLORDIALOG) +#if !defined(QT_SMALL_COLORDIALOG) // The screen color picker button screenColorPickerButton = new QPushButton(); leftLay->addWidget(screenColorPickerButton); @@ -1757,9 +1753,7 @@ void QColorDialogPrivate::initWidgets() q->connect(screenColorPickerButton, SIGNAL(clicked()), SLOT(_q_pickScreenColor())); #endif -#if !defined(Q_OS_WINCE) leftLay->addStretch(); -#endif custom = new QColorWell(q, customColorRows, colorColumns, QColorDialogOptions::customColors()); custom->setAcceptDrops(true); diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 5eb6130a45..74d138442a 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -427,31 +427,6 @@ void QDialogPrivate::resetModalitySetByOpen() resetModalityTo = -1; } -#if defined(Q_OS_WINCE) -#ifdef Q_OS_WINCE_WM -void QDialogPrivate::_q_doneAction() -{ - //Done... - QApplication::postEvent(q_func(), new QEvent(QEvent::OkRequest)); -} -#endif - -/*! - \reimp -*/ -bool QDialog::event(QEvent *e) -{ - bool result = QWidget::event(e); -#ifdef Q_OS_WINCE - if (e->type() == QEvent::OkRequest) { - accept(); - result = true; - } -#endif - return result; -} -#endif - /*! In general returns the modal dialog's result code, \c Accepted or \c Rejected. diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h index db5baf24f9..562fbb63bb 100644 --- a/src/widgets/dialogs/qdialog.h +++ b/src/widgets/dialogs/qdialog.h @@ -98,9 +98,6 @@ public Q_SLOTS: protected: QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags()); -#if defined(Q_OS_WINCE) - bool event(QEvent *e); -#endif void keyPressEvent(QKeyEvent *); void closeEvent(QCloseEvent *); void showEvent(QShowEvent *); @@ -113,10 +110,6 @@ protected: private: Q_DECLARE_PRIVATE(QDialog) Q_DISABLE_COPY(QDialog) - -#ifdef Q_OS_WINCE_WM - Q_PRIVATE_SLOT(d_func(), void _q_doneAction()) -#endif }; QT_END_NAMESPACE diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h index 6a9b5bae57..6fe4b602a1 100644 --- a/src/widgets/dialogs/qdialog_p.h +++ b/src/widgets/dialogs/qdialog_p.h @@ -99,10 +99,6 @@ public: void hideDefault(); void resetModalitySetByOpen(); -#ifdef Q_OS_WINCE_WM - void _q_doneAction(); -#endif - int rescode; int resetModalityTo; bool wasModalitySet; diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp index 77d9eb29ac..5fcbe3fe9d 100644 --- a/src/widgets/dialogs/qerrormessage.cpp +++ b/src/widgets/dialogs/qerrormessage.cpp @@ -60,11 +60,6 @@ #include #include -#ifdef Q_OS_WINCE -extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp -extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp -#endif - QT_BEGIN_NAMESPACE class QErrorMessagePrivate : public QDialogPrivate @@ -100,32 +95,12 @@ public: QSize QErrorMessageTextView::minimumSizeHint() const { -#ifdef Q_OS_WINCE - if (qt_wince_is_mobile()) - if (qt_wince_is_high_dpi()) - return QSize(200, 200); - else - return QSize(100, 100); - else - return QSize(70, 70); -#else return QSize(50, 50); -#endif } QSize QErrorMessageTextView::sizeHint() const { -#ifdef Q_OS_WINCE - if (qt_wince_is_mobile()) - if (qt_wince_is_high_dpi()) - return QSize(400, 200); - else - return QSize(320, 120); - else - return QSize(300, 100); -#else return QSize(250, 75); -#endif //Q_OS_WINCE } /*! @@ -248,9 +223,6 @@ QErrorMessage::QErrorMessage(QWidget * parent) d->icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop); #endif d->again->setChecked(true); -#if defined(Q_OS_WINCE) - d->ok->setFixedSize(0,0); -#endif d->ok->setFocus(); d->retranslateStrings(); diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index defc0539c9..51177750d4 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -60,15 +60,7 @@ #include #include #include -#if !defined(Q_OS_WINCE) #include "ui_qfiledialog.h" -#else -#define Q_EMBEDDED_SMALLSCREEN -#include "ui_qfiledialog_embedded.h" -#if defined(Q_OS_WINCE) -extern bool qt_priv_ptr_valid; -#endif -#endif #if defined(Q_OS_UNIX) #include #include // for pathconf() on OS X @@ -1750,7 +1742,7 @@ int QFileDialogPrivate::maxNameLength(const QString &path) { #if defined(Q_OS_UNIX) return ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX); -#elif defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#elif defined(Q_OS_WINRT) Q_UNUSED(path); return MAX_PATH; #elif defined(Q_OS_WIN) @@ -4015,7 +4007,7 @@ QString QFSCompleter::pathFromIndex(const QModelIndex &index) const QString currentLocation = dirModel->rootPath(); QString path = index.data(QFileSystemModel::FilePathRole).toString(); if (!currentLocation.isEmpty() && path.startsWith(currentLocation)) { -#if defined(Q_OS_UNIX) || defined(Q_OS_WINCE) +#if defined(Q_OS_UNIX) if (currentLocation == QDir::separator()) return path.mid(currentLocation.length()); #endif diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index f273a4fb37..d10f6d7065 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -177,10 +177,6 @@ public: #if defined(Q_OS_WIN) QString n(path); n.replace(QLatin1Char('\\'), QLatin1Char('/')); -#if defined(Q_OS_WINCE) - if ((n.size() > 1) && (n.startsWith(QLatin1String("//")))) - n = n.mid(1); -#endif return n; #else // the compile should optimize away this return path; diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp index 014792ea93..6df020dd58 100644 --- a/src/widgets/dialogs/qfileinfogatherer.cpp +++ b/src/widgets/dialogs/qfileinfogatherer.cpp @@ -263,7 +263,7 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const static QString translateDriveName(const QFileInfo &drive) { QString driveName = drive.absoluteFilePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (driveName.startsWith(QLatin1Char('/'))) // UNC host return drive.fileName(); if (driveName.endsWith(QLatin1Char('/'))) diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index c72761f2ae..2f7edd8d07 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -366,13 +366,13 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS // ### TODO can we use bool QAbstractFileEngine::caseSensitive() const? QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts); if ((pathElements.isEmpty()) -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) && QDir::fromNativeSeparators(longPath) != QLatin1String("/") #endif ) return const_cast(&root); QModelIndex index = QModelIndex(); // start with "My Computer" -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path QString host = QLatin1String("\\\\") + pathElements.constFirst(); if (absolutePath == QDir::fromNativeSeparators(host)) @@ -398,7 +398,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS } else #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) { if (!pathElements.at(0).contains(QLatin1Char(':'))) { QString rootPath = QDir(longPath).rootPath(); @@ -831,7 +831,7 @@ QString QFileSystemModelPrivate::name(const QModelIndex &index) const */ QString QFileSystemModelPrivate::displayName(const QModelIndex &index) const { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) QFileSystemNode *dirNode = node(index); if (!dirNode->volumeName.isNull()) return dirNode->volumeName + QLatin1String(" (") + name(index) + QLatin1Char(')'); @@ -1281,11 +1281,10 @@ QString QFileSystemModelPrivate::filePath(const QModelIndex &index) const idx = idx.parent(); } QString fullPath = QDir::fromNativeSeparators(path.join(QDir::separator())); -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) if ((fullPath.length() > 2) && fullPath[0] == QLatin1Char('/') && fullPath[1] == QLatin1Char('/')) fullPath = fullPath.mid(1); -#endif -#if defined(Q_OS_WIN) +#else if (fullPath.length() == 2 && fullPath.endsWith(QLatin1Char(':'))) fullPath.append(QLatin1Char('/')); #endif @@ -1676,7 +1675,7 @@ QFileSystemModelPrivate::QFileSystemNode* QFileSystemModelPrivate::addNode(QFile #else Q_UNUSED(info) #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //The parentNode is "" so we are listing the drives if (parentNode->fileName.isEmpty()) { wchar_t name[MAX_PATH + 1]; diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h index af3406b699..beb25f665d 100644 --- a/src/widgets/dialogs/qfilesystemmodel_p.h +++ b/src/widgets/dialogs/qfilesystemmodel_p.h @@ -95,7 +95,7 @@ public: } QString fileName; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) QString volumeName; #endif diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index c130998198..b831a9006d 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -321,11 +321,7 @@ void QFontDialogPrivate::init() buttonBox->addButton(QDialogButtonBox::Cancel); QObject::connect(buttonBox, SIGNAL(rejected()), q, SLOT(reject())); -#if defined(Q_OS_WINCE) - q->resize(180, 120); -#else q->resize(500, 360); -#endif // Q_OS_WINCE sizeEdit->installEventFilter(q); familyList->installEventFilter(q); diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index ee760c38a0..994015030f 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -218,9 +218,6 @@ public: int layoutMinimumWidth(); void retranslateStrings(); -#ifdef Q_OS_WINCE - void hideSpecial(); -#endif static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, int button0, int button1, int button2); @@ -362,24 +359,15 @@ void QMessageBoxPrivate::updateSize() return; QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); -#if defined(Q_OS_WINCE) - // the width of the screen, less the window border. - int hardLimit = screenSize.width() - (q->frameGeometry().width() - q->geometry().width()); -#else int hardLimit = qMin(screenSize.width() - 480, 1000); // can never get bigger than this // on small screens allows the messagebox be the same size as the screen if (screenSize.width() <= 1024) hardLimit = screenSize.width(); -#endif #ifdef Q_OS_MAC int softLimit = qMin(screenSize.width()/2, 420); #else // note: ideally on windows, hard and soft limits but it breaks compat -#ifndef Q_OS_WINCE int softLimit = qMin(screenSize.width()/2, 500); -#else - int softLimit = qMin(screenSize.width() * 3 / 4, 500); -#endif //Q_OS_WINCE #endif if (informativeLabel) @@ -436,28 +424,6 @@ void QMessageBoxPrivate::updateSize() QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest); } - -#ifdef Q_OS_WINCE -/*! - \internal - Hides special buttons which are rather shown in the title bar - on WinCE, to conserve screen space. -*/ - -void QMessageBoxPrivate::hideSpecial() -{ - Q_Q(QMessageBox); - QList list = q->findChildren(); - for (int i=0; itext(); - text.remove(QChar::fromLatin1('&')); - if (text == QApplication::translate("QMessageBox", "OK" )) - pb->setFixedSize(0,0); - } -} -#endif - static int oldButton(int button) { switch (button & QMessageBox::ButtonMask) { @@ -1368,24 +1334,6 @@ bool QMessageBox::event(QEvent *e) case QEvent::LanguageChange: d_func()->retranslateStrings(); break; -#ifdef Q_OS_WINCE - case QEvent::OkRequest: - case QEvent::HelpRequest: { - QString bName = - (e->type() == QEvent::OkRequest) - ? QApplication::translate("QMessageBox", "OK") - : QApplication::translate("QMessageBox", "Help"); - QList list = findChildren(); - for (int i=0; itext() == bName) { - if (pb->isEnabled()) - pb->click(); - return pb->isEnabled(); - } - } - } -#endif default: break; } @@ -1525,20 +1473,6 @@ void QMessageBox::keyPressEvent(QKeyEvent *e) QDialog::keyPressEvent(e); } -#ifdef Q_OS_WINCE -/*! - \reimp -*/ -void QMessageBox::setVisible(bool visible) -{ - Q_D(QMessageBox); - if (visible) - d->hideSpecial(); - QDialog::setVisible(visible); -} -#endif - - /*! \overload @@ -1596,9 +1530,6 @@ void QMessageBox::showEvent(QShowEvent *e) Q_D(QMessageBox); if (d->autoAddOkButton) { addButton(Ok); -#if defined(Q_OS_WINCE) - d->hideSpecial(); -#endif } if (d->detailsButton) addButton(d->detailsButton, QMessageBox::ActionRole); @@ -1915,9 +1846,6 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title) QPixmap pm(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png")); if (!pm.isNull()) msgBox->setIconPixmap(pm); -#if defined(Q_OS_WINCE) - msgBox->setDefaultButton(msgBox->addButton(QMessageBox::Ok)); -#endif // should perhaps be a style hint #ifdef Q_OS_MAC diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h index c958e4c352..8cded63a3c 100644 --- a/src/widgets/dialogs/qmessagebox.h +++ b/src/widgets/dialogs/qmessagebox.h @@ -142,10 +142,6 @@ public: QPushButton *addButton(StandardButton button); void removeButton(QAbstractButton *button); -#ifdef Q_OS_WINCE - void setVisible(bool visible); -#endif - using QDialog::open; void open(QObject *receiver, const char *member); diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 53f947354c..f3d27ff77f 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -69,10 +69,6 @@ #include "private/qdialog_p.h" #include -#ifdef Q_OS_WINCE -extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp -#endif - #include // for memset() #include @@ -2215,10 +2211,6 @@ QWizard::QWizard(QWidget *parent, Qt::WindowFlags flags) { Q_D(QWizard); d->init(); -#ifdef Q_OS_WINCE - if (!qt_wince_is_mobile()) - setWindowFlags(windowFlags() & ~Qt::WindowOkButtonHint); -#endif } /*! diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp index dfb1d7619e..315d2503a4 100644 --- a/src/widgets/itemviews/qdirmodel.cpp +++ b/src/widgets/itemviews/qdirmodel.cpp @@ -858,7 +858,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const return QModelIndex(); QString absolutePath = QDir(path).absolutePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) absolutePath = absolutePath.toLower(); // On Windows, "filename......." and "filename" are equivalent if (absolutePath.endsWith(QLatin1Char('.'))) { @@ -873,7 +873,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts); if ((pathElements.isEmpty() || !QFileInfo::exists(path)) -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) && path != QLatin1String("/") #endif ) @@ -883,7 +883,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const if (!d->root.populated) // make sure the root is populated d->populate(&d->root); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path QString host = pathElements.first(); int r = 0; @@ -901,7 +901,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const emit const_cast(this)->layoutChanged(); } else #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (pathElements.at(0).endsWith(QLatin1Char(':'))) { pathElements[0] += QLatin1Char('/'); } @@ -925,7 +925,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const const QFileInfo& fi = parent->children.at(j).info; QString childFileName; childFileName = idx.isValid() ? fi.fileName() : fi.absoluteFilePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) childFileName = childFileName.toLower(); #endif if (childFileName == element) { @@ -938,15 +938,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const // we couldn't find the path element, we create a new node since we _know_ that the path is valid if (row == -1) { -#if defined(Q_OS_WINCE) - QString newPath; - if (parent->info.isRoot()) - newPath = parent->info.absoluteFilePath() + element; - else - newPath = parent->info.absoluteFilePath() + QLatin1Char('/') + element; -#else QString newPath = parent->info.absoluteFilePath() + QLatin1Char('/') + element; -#endif if (!d->allowAppendChild || !QFileInfo(newPath).isDir()) return QModelIndex(); d->appendChild(parent, newPath); @@ -1290,7 +1282,7 @@ QString QDirModelPrivate::name(const QModelIndex &index) const const QFileInfo info = n->info; if (info.isRoot()) { QString name = info.absoluteFilePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (name.startsWith(QLatin1Char('/'))) // UNC host return info.fileName(); if (name.endsWith(QLatin1Char('/'))) diff --git a/src/widgets/itemviews/qfileiconprovider.cpp b/src/widgets/itemviews/qfileiconprovider.cpp index 66c0ffcd58..78ff5f79ab 100644 --- a/src/widgets/itemviews/qfileiconprovider.cpp +++ b/src/widgets/itemviews/qfileiconprovider.cpp @@ -365,7 +365,7 @@ QIcon QFileIconProvider::icon(const QFileInfo &info) const return retIcon; if (info.isRoot()) -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) { UINT type = GetDriveType((wchar_t *)info.absoluteFilePath().utf16()); diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 141f15637c..0c7934ceaf 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 //#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) @@ -654,17 +639,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 @@ -1058,19 +1032,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; @@ -3777,7 +3738,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) if (receiver->isWidgetType()) { QWidget *widget = static_cast(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())) diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index b27fba620e..db690a3539 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -83,9 +83,6 @@ class Q_WIDGETS_EXPORT QApplication : public QGuiApplication Q_PROPERTY(int startDragDistance READ startDragDistance WRITE setStartDragDistance) #ifndef QT_NO_STYLE_STYLESHEET Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet) -#endif -#ifdef Q_OS_WINCE - Q_PROPERTY(int autoMaximizeThreshold READ autoMaximizeThreshold WRITE setAutoMaximizeThreshold) #endif Q_PROPERTY(bool autoSipEnabled READ autoSipEnabled WRITE setAutoSipEnabled) @@ -194,10 +191,6 @@ public: public Q_SLOTS: #ifndef QT_NO_STYLE_STYLESHEET void setStyleSheet(const QString& sheet); -#endif -#ifdef Q_OS_WINCE - void setAutoMaximizeThreshold(const int threshold); - int autoMaximizeThreshold() const; #endif void setAutoSipEnabled(const bool enabled); bool autoSipEnabled() const; diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 3358cce744..34da6586fa 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -90,11 +90,8 @@ extern Q_GUI_EXPORT bool qt_is_gui_used; extern QClipboard *qt_clipboard; #endif -#if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN) || defined(Q_OS_WINCE) +#if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN) extern QSysInfo::WinVersion qt_winver; -# ifdef Q_OS_WINCE - extern DWORD qt_cever; -# endif #elif defined (Q_OS_MAC) extern QSysInfo::MacVersion qt_macver; #endif @@ -125,9 +122,6 @@ public: static bool x11_apply_settings(); #endif static void reset_instance_pointer(); -#endif -#ifdef Q_OS_WINCE - static int autoMaximizeThreshold; #endif static bool autoSipEnabled; static QString desktopStyleKey(); diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index 240f525722..86c1628e22 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -945,12 +945,7 @@ void QLayout::addChildWidget(QWidget *w) void QLayout::setMenuBar(QWidget *widget) { Q_D(QLayout); - -#ifdef Q_OS_WINCE_WM - if (widget && widget->size().height() > 0) -#else if (widget) -#endif addChildWidget(widget); d->menubar = widget; } diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 986f1d0218..426f206480 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1107,11 +1107,7 @@ void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w) if (customize) ; // don't modify window flags if the user explicitly set them. else if (type == Qt::Dialog || type == Qt::Sheet) -#ifndef Q_OS_WINCE flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint; -#else - flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint; -#endif else if (type == Qt::Tool) flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint; else @@ -4551,7 +4547,7 @@ const QPalette &QWidget::palette() const if (!isEnabled()) { data->pal.setCurrentColorGroup(QPalette::Disabled); } else if ((!isVisible() || isActiveWindow()) -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !QApplicationPrivate::isBlockedByModal(const_cast(this)) #endif ) { @@ -8552,13 +8548,9 @@ QSize QWidgetPrivate::adjustedSize() const #else // all others QRect screen = QApplication::desktop()->screenGeometry(q->pos()); #endif -#if defined (Q_OS_WINCE) - s.setWidth(qMin(s.width(), screen.width())); - s.setHeight(qMin(s.height(), screen.height())); -#else s.setWidth(qMin(s.width(), screen.width()*2/3)); s.setHeight(qMin(s.height(), screen.height()*2/3)); -#endif + if (QTLWExtra *extra = maybeTopData()) extra->sizeAdjusted = true; } diff --git a/src/widgets/kernel/qwidgetsfunctions_wince.cpp b/src/widgets/kernel/qwidgetsfunctions_wince.cpp deleted file mode 100644 index 2bf8c6563b..0000000000 --- a/src/widgets/kernel/qwidgetsfunctions_wince.cpp +++ /dev/null @@ -1,120 +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 "qwidgetsfunctions_wince.h" -#include - -QT_USE_NAMESPACE - -#ifndef ShellExecute -HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCWSTR, LPCWSTR file, LPCWSTR params, LPCWSTR dir, int showCmd) -{ - SHELLEXECUTEINFO info; - info.hwnd = hwnd; - info.lpVerb = L"Open"; - info.lpFile = file; - info.lpParameters = params; - info.lpDirectory = dir; - info.nShow = showCmd; - info.cbSize = sizeof(info); - ShellExecuteEx(&info); - return info.hInstApp; -} -#endif - -// Internal Qt ----------------------------------------------------- -bool qt_wince_is_platform(const QString &platformString) { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMNAME, sizeof(tszPlatform) / sizeof(wchar_t), tszPlatform, 0)) - if (0 == _tcsicmp(reinterpret_cast (platformString.utf16()), tszPlatform)) - return true; - return false; -} - -int qt_wince_get_build() -{ - OSVERSIONINFO osvi; - osvi.dwOSVersionInfoSize = sizeof(osvi); - if (GetVersionEx(&osvi)) - return osvi.dwBuildNumber; - return 0; -} - -int qt_wince_get_version() -{ - OSVERSIONINFO osvi; - osvi.dwOSVersionInfoSize = sizeof(osvi); - if (GetVersionEx(&osvi)) - return (osvi.dwMajorVersion * 10 + osvi.dwMinorVersion); - return 0; -} - -bool qt_wince_is_windows_mobile_65() -{ - const DWORD dwFirstWM65BuildNumber = 21139; - OSVERSIONINFO osvi; - osvi.dwOSVersionInfoSize = sizeof(osvi); - if (!GetVersionEx(&osvi)) - return false; - return osvi.dwMajorVersion > 5 - || (osvi.dwMajorVersion == 5 && (osvi.dwMinorVersion > 2 || - (osvi.dwMinorVersion == 2 && osvi.dwBuildNumber >= dwFirstWM65BuildNumber))); -} - -bool qt_wince_is_pocket_pc() { - return qt_wince_is_platform(QString::fromLatin1("PocketPC")); -} - -bool qt_wince_is_smartphone() { - return qt_wince_is_platform(QString::fromLatin1("Smartphone")); -} -bool qt_wince_is_mobile() { - return (qt_wince_is_smartphone() || qt_wince_is_pocket_pc()); -} - -bool qt_wince_is_high_dpi() { - if (!qt_wince_is_pocket_pc()) - return false; - HDC deviceContext = GetDC(0); - int dpi = GetDeviceCaps(deviceContext, LOGPIXELSX); - ReleaseDC(0, deviceContext); - if ((dpi < 1000) && (dpi > 0)) - return dpi > 96; - else - return false; -} diff --git a/src/widgets/kernel/qwidgetsfunctions_wince.h b/src/widgets/kernel/qwidgetsfunctions_wince.h deleted file mode 100644 index f2c620a966..0000000000 --- a/src/widgets/kernel/qwidgetsfunctions_wince.h +++ /dev/null @@ -1,60 +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$ -** -****************************************************************************/ -#ifndef QWIDGETSFUNCTIONS_WCE_H -#define QWIDGETSFUNCTIONS_WCE_H - -#include - -#ifdef Q_OS_WINCE -#include - -#ifdef QT_BUILD_GUI_LIB -QT_BEGIN_NAMESPACE -QT_END_NAMESPACE -#endif - - -//WinCe 7 has shell support -#ifndef ShellExecute -HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCWSTR operation, LPCWSTR file, LPCWSTR params, LPCWSTR dir, int showCmd); -#define ShellExecute(a,b,c,d,e,f) qt_wince_ShellExecute(a,b,c,d,e,f) -#endif - -#endif // Q_OS_WINCE -#endif // QWIDGETSFUNCTIONS_WCE_H diff --git a/src/widgets/kernel/win.pri b/src/widgets/kernel/win.pri index e2d5afdeec..a3121287b3 100644 --- a/src/widgets/kernel/win.pri +++ b/src/widgets/kernel/win.pri @@ -2,6 +2,4 @@ # -------------------------------------------------------------------- INCLUDEPATH += ../3rdparty/wintab -!wince:!winrt { - LIBS_PRIVATE *= -lshell32 -} +!winrt: LIBS_PRIVATE *= -lshell32 diff --git a/src/widgets/styles/qstyle_wince.qrc b/src/widgets/styles/qstyle_wince.qrc deleted file mode 100644 index c3d643fac7..0000000000 --- a/src/widgets/styles/qstyle_wince.qrc +++ /dev/null @@ -1,97 +0,0 @@ - - -images/filelink-16.png -images/filelink-32.png -images/file-16.png -images/file-32.png -images/newdirectory-16.png -images/newdirectory-32.png -images/parentdir-16.png -images/parentdir-32.png -images/dvd-16.png -images/dvd-32.png -images/cdr-16.png -images/cdr-32.png -images/floppy-16.png -images/floppy-32.png -images/harddrive-16.png -images/harddrive-32.png -images/trash-16.png -images/trash-32.png -images/networkdrive-16.png -images/networkdrive-32.png -images/computer-16.png -images/computer-32.png -images/desktop-16.png -images/desktop-32.png -images/dirclosed-16.png -images/dirclosed-32.png -images/dirlink-16.png -images/dirlink-32.png -images/diropen-16.png -images/diropen-32.png -images/left-16.png -images/left-32.png -images/right-16.png -images/right-32.png -images/up-16.png -images/up-32.png -images/down-16.png -images/down-32.png -images/filecontents-16.png -images/filecontents-32.png -images/fileinfo-16.png -images/fileinfo-32.png -images/viewdetailed-16.png -images/viewdetailed-32.png -images/viewlist-16.png -images/viewlist-32.png -images/fontbitmap-16.png -images/fonttruetype-16.png -images/standardbutton-apply-16.png -images/standardbutton-apply-32.png -images/standardbutton-cancel-16.png -images/standardbutton-cancel-32.png -images/standardbutton-clear-16.png -images/standardbutton-clear-32.png -images/standardbutton-close-16.png -images/standardbutton-close-32.png -images/standardbutton-delete-16.png -images/standardbutton-delete-32.png -images/standardbutton-help-16.png -images/standardbutton-help-32.png -images/standardbutton-no-16.png -images/standardbutton-no-32.png -images/standardbutton-ok-16.png -images/standardbutton-ok-32.png -images/standardbutton-open-16.png -images/standardbutton-open-32.png -images/standardbutton-save-16.png -images/standardbutton-save-32.png -images/standardbutton-yes-16.png -images/standardbutton-yes-32.png -images/standardbutton-closetab-16.png -images/standardbutton-closetab-down-16.png -images/standardbutton-closetab-hover-16.png -images/refresh-24.png -images/refresh-32.png -images/stop-24.png -images/stop-32.png -images/media-stop-16.png -images/media-stop-32.png -images/media-play-16.png -images/media-play-32.png -images/media-pause-16.png -images/media-pause-32.png -images/media-seek-forward-16.png -images/media-seek-forward-32.png -images/media-seek-backward-16.png -images/media-seek-backward-32.png -images/media-skip-forward-16.png -images/media-skip-forward-32.png -images/media-skip-backward-16.png -images/media-skip-backward-32.png -images/media-volume-16.png -images/media-volume-muted-16.png - - diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 36aa312ce8..fa1ba80402 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -122,7 +122,7 @@ int QWindowsStylePrivate::m_appDevicePixelRatio = 0; QWindowsStylePrivate::QWindowsStylePrivate() : alt_down(false), menuBarTimer(0) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { QSystemLibrary shellLib(QLatin1String("shell32")); @@ -308,25 +308,15 @@ int QWindowsStylePrivate::pixelMetricFromSystemDp(QStyle::PixelMetric pm, const #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) switch (pm) { case QStyle::PM_DockWidgetFrameWidth: -# ifndef Q_OS_WINCE return GetSystemMetrics(SM_CXFRAME); -# else - return GetSystemMetrics(SM_CXDLGFRAME); -# endif - break; case QStyle::PM_TitleBarHeight: if (widget && (widget->windowType() == Qt::Tool)) { // MS always use one less than they say -# ifndef Q_OS_WINCE return GetSystemMetrics(SM_CYSMCAPTION) - 1; -# else - return GetSystemMetrics(SM_CYCAPTION) - 1; -# endif } return GetSystemMetrics(SM_CYCAPTION) - 1; -# ifndef Q_OS_WINCE case QStyle::PM_ScrollBarExtent: { NONCLIENTMETRICS ncm; @@ -335,14 +325,9 @@ int QWindowsStylePrivate::pixelMetricFromSystemDp(QStyle::PixelMetric pm, const return qMax(ncm.iScrollHeight, ncm.iScrollWidth); } break; -# endif // !Q_OS_WINCE case QStyle::PM_MdiSubWindowFrameWidth: -# ifndef Q_OS_WINCE return GetSystemMetrics(SM_CYFRAME); -# else - return GetSystemMetrics(SM_CYDLGFRAME); -# endif default: break; @@ -479,7 +464,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QPixmap desktopIcon; switch(standardPixmap) { case SP_DriveCDIcon: @@ -518,7 +503,7 @@ QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyl if (!desktopIcon.isNull()) { return desktopIcon; } -#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT +#endif // Q_OS_WIN && !Q_OS_WINRT return QCommonStyle::standardPixmap(standardPixmap, opt, widget); } @@ -595,12 +580,12 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid #endif // Q_OS_WIN && !Q_OS_WINRT case SH_Menu_SubMenuSloppyCloseTimeout: case SH_Menu_SubMenuPopupDelay: { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) DWORD delay; if (SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &delay, 0)) ret = delay; else -#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT +#endif // Q_OS_WIN && !Q_OS_WINRT ret = 400; break; } diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri index 11f7d973cc..3492492782 100644 --- a/src/widgets/styles/styles.pri +++ b/src/widgets/styles/styles.pri @@ -33,11 +33,7 @@ SOURCES += \ styles/qstylesheetstyle_default.cpp \ styles/qpixmapstyle.cpp -wince* { - RESOURCES += styles/qstyle_wince.qrc -} else { - RESOURCES += styles/qstyle.qrc -} +RESOURCES += styles/qstyle.qrc contains( styles, all ) { styles = fusion mac windows windowsxp windowsvista diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 083a4a4f27..5425644b41 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 ) @@ -1051,7 +1051,7 @@ void QCompleter::setModel(QAbstractItemModel *model) delete oldModel; #ifndef QT_NO_DIRMODEL if (qobject_cast(model)) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) setCaseSensitivity(Qt::CaseInsensitive); #else setCaseSensitivity(Qt::CaseSensitive); @@ -1061,7 +1061,7 @@ void QCompleter::setModel(QAbstractItemModel *model) #ifndef QT_NO_FILESYSTEMMODEL QFileSystemModel *fsModel = qobject_cast(model); if (fsModel) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) setCaseSensitivity(Qt::CaseInsensitive); #else setCaseSensitivity(Qt::CaseSensitive); @@ -1786,7 +1786,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 @@ -1826,7 +1826,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("\\\\")); @@ -1837,7 +1837,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/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 3606b7c773..1f1b7a17b5 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -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; 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 -#include -#include - -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/util.pri b/src/widgets/util/util.pri index 9f43dc42f0..700831771d 100644 --- a/src/widgets/util/util.pri +++ b/src/widgets/util/util.pri @@ -27,7 +27,7 @@ SOURCES += \ util/qundostack.cpp \ util/qundoview.cpp -win32:!wince:!winrt { +win32:!winrt { SOURCES += util/qsystemtrayicon_win.cpp } else:contains(QT_CONFIG, xcb) { SOURCES += util/qsystemtrayicon_x11.cpp diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro index b609e4c434..e4f7640a10 100644 --- a/src/widgets/widgets.pro +++ b/src/widgets/widgets.pro @@ -1,5 +1,4 @@ TARGET = QtWidgets -wince: ORIG_TARGET = $$TARGET QT = core-private gui-private MODULE_CONFIG = uic diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 293a04ef88..3ddf5d4dc6 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -230,7 +230,7 @@ bool QDockWidgetLayout::nativeWindowDeco() const */ bool QDockWidgetLayout::wmSupportsNativeWindowDeco() { -#if defined(Q_OS_WINCE) || defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) return false; #else static const bool xcb = !QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive); diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp index a2ba50695a..b02651767c 100644 --- a/src/widgets/widgets/qeffects.cpp +++ b/src/widgets/widgets/qeffects.cpp @@ -110,7 +110,7 @@ QAlphaWidget::QAlphaWidget(QWidget* w, Qt::WindowFlags f) QAlphaWidget::~QAlphaWidget() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) // Restore user-defined opacity value if (widget) widget->setWindowOpacity(1); @@ -144,7 +144,7 @@ void QAlphaWidget::run(int time) checkTime.start(); showWidget = true; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) qApp->installEventFilter(this); widget->setWindowOpacity(0.0); widget->show(); @@ -251,7 +251,7 @@ void QAlphaWidget::render() else alpha = 1; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (alpha >= 1 || !showWidget) { anim.stop(); qApp->removeEventFilter(this); @@ -268,10 +268,6 @@ void QAlphaWidget::render() if (widget) { if (!showWidget) { -#ifdef Q_OS_WIN - setEnabled(true); - setFocus(); -#endif // Q_OS_WIN widget->hide(); } else { //Since we are faking the visibility of the widget @@ -288,7 +284,7 @@ void QAlphaWidget::render() pm = QPixmap::fromImage(mixedImage); repaint(); } -#endif // defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#endif // defined(Q_OS_WIN) } /* diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 610cb1201f..bc364b1a26 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -1769,7 +1769,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const if (isChildOfTabbedQMdiArea(q)) return false; -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) || defined(Q_OS_WINCE_WM) +#if defined(Q_OS_DARWIN) && !defined(QT_NO_STYLE_MAC) Q_UNUSED(isChildOfQMdiSubWindow); return true; #else diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 274570b22a..8df083f75e 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -3353,17 +3353,6 @@ void QMenu::actionEvent(QActionEvent *e) d->platformMenu->syncSeparatorsCollapsible(d->collapsibleSeparators); } -#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR) - if (!d->wce_menu) - d->wce_menu = new QMenuPrivate::QWceMenuPrivate; - if (e->type() == QEvent::ActionAdded) - d->wce_menu->addAction(e->action(), d->wce_menu->findAction(e->before())); - else if (e->type() == QEvent::ActionRemoved) - d->wce_menu->removeAction(e->action()); - else if (e->type() == QEvent::ActionChanged) - d->wce_menu->syncAction(e->action()); -#endif - if (isVisible()) { d->updateActionRects(); resize(sizeHint()); diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h index 2e579899bc..fd931e3d5b 100644 --- a/src/widgets/widgets/qmenu.h +++ b/src/widgets/widgets/qmenu.h @@ -45,9 +45,6 @@ #include #include -#ifdef Q_OS_WINCE -#include // for HMENU -#endif #ifdef Q_OS_OSX Q_FORWARD_DECLARE_OBJC_CLASS(NSMenu); #endif @@ -214,9 +211,6 @@ public: QPlatformMenu *platformMenu(); void setPlatformMenu(QPlatformMenu *platformMenu); -#ifdef Q_OS_WINCE - HMENU wceMenu(); -#endif #ifdef Q_OS_OSX NSMenu* toNSMenu(); void setAsDockMenu(); @@ -255,10 +249,6 @@ protected: bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE; void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const; -#ifdef Q_OS_WINCE - QAction* wceCommands(uint command); -#endif - private Q_SLOTS: void internalDelayedPopup(); diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index 0705cd12ea..3ad7c3c7c5 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -68,15 +68,6 @@ QT_BEGIN_NAMESPACE class QTornOffMenu; class QEventLoop; -#ifdef Q_OS_WINCE -struct QWceMenuAction { - uint command; - QPointer action; - HMENU menuHandle; - QWceMenuAction() : menuHandle(0), command(0) {} -}; -#endif - template class QSetValueOnDestroy { @@ -301,19 +292,13 @@ public: #endif scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0), hasCheckableItems(0), doChildEffects(false), platformMenu(0) - -#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR) - ,wce_menu(0) -#endif { } + ~QMenuPrivate() { delete scroll; if (!platformMenu.isNull() && !platformMenu->parent()) delete platformMenu.data(); -#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR) - delete wce_menu; -#endif } void init(); void setPlatformMenu(QPlatformMenu *menu); @@ -473,31 +458,6 @@ public: QPointer actionAboutToTrigger; -#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR) - struct QWceMenuPrivate { - QList actionItems; - HMENU menuHandle; - QWceMenuPrivate(); - ~QWceMenuPrivate(); - void addAction(QAction *, QWceMenuAction* =0); - void addAction(QWceMenuAction *, QWceMenuAction* =0); - void syncAction(QWceMenuAction *); - inline void syncAction(QAction *a) { syncAction(findAction(a)); } - void removeAction(QWceMenuAction *); - void rebuild(); - inline void removeAction(QAction *a) { removeAction(findAction(a)); } - inline QWceMenuAction *findAction(QAction *a) { - for(int i = 0; i < actionItems.size(); i++) { - QWceMenuAction *act = actionItems[i]; - if(a == act->action) - return act; - } - return 0; - } - } *wce_menu; - HMENU wceMenu(); - QAction* wceCommands(uint command); -#endif QPointer noReplayFor; static QPointer previousMouseMenu; }; diff --git a/src/widgets/widgets/qmenu_wince.cpp b/src/widgets/widgets/qmenu_wince.cpp deleted file mode 100644 index d7397746fc..0000000000 --- a/src/widgets/widgets/qmenu_wince.cpp +++ /dev/null @@ -1,666 +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$ -** -****************************************************************************/ - -//Native menubars are only supported for Windows Mobile not the standard SDK/generic WinCE -#ifdef Q_OS_WINCE -#include "qmenu.h" -#include "qt_windows.h" -#include "qapplication.h" -#include "qmainwindow.h" -#include "qtoolbar.h" -#include "qevent.h" -#include "qstyle.h" -#include "qdebug.h" -#include "qwidgetaction.h" -#include -#include -#include - -#include "qmenu_wince_resource_p.h" - -#include -#include -#if Q_OS_WINCE_WM -# include -#endif - -#ifndef QT_NO_MENUBAR - -#ifndef SHCMBF_EMPTYBAR -#define SHCMBF_EMPTYBAR 0x0001 -#endif - -#ifndef SHCMBM_GETSUBMENU -#define SHCMBM_GETSUBMENU (WM_USER + 401) -#endif - -#ifdef Q_OS_WINCE_WM -# define SHMBOF_NODEFAULT 0x00000001 -# define SHMBOF_NOTIFY 0x00000002 -# define SHCMBM_OVERRIDEKEY (WM_USER + 0x193) -#endif - -extern bool qt_wince_is_smartphone();//defined in qguifunctions_wce.cpp -extern bool qt_wince_is_pocket_pc(); //defined in qguifunctions_wce.cpp - -QT_BEGIN_NAMESPACE - -static uint qt_wce_menu_static_cmd_id = 200; -static QList nativeMenuBars; - -struct qt_SHMENUBARINFO -{ - DWORD cbSize; - HWND hwndParent; - DWORD dwFlags; - UINT nToolBarId; - HINSTANCE hInstRes; - int nBmpId; - int cBmpImages; - HWND hwndMB; - COLORREF clrBk; -}; - -typedef BOOL (WINAPI *AygCreateMenuBar)(qt_SHMENUBARINFO*); -typedef HRESULT (WINAPI *AygEnableSoftKey)(HWND,UINT,BOOL,BOOL); - -static bool aygResolved = false; -static AygCreateMenuBar ptrCreateMenuBar = 0; -static AygEnableSoftKey ptrEnableSoftKey = 0; - -static void resolveAygLibs() -{ - if (!aygResolved) { - aygResolved = true; - QLibrary aygLib(QLatin1String("aygshell")); - ptrCreateMenuBar = (AygCreateMenuBar) aygLib.resolve("SHCreateMenuBar"); - ptrEnableSoftKey = (AygEnableSoftKey) aygLib.resolve("SHEnableSoftkey"); - } -} - -static void qt_wce_enable_soft_key(HWND handle, uint command) -{ - resolveAygLibs(); - if (ptrEnableSoftKey) - ptrEnableSoftKey(handle, command, false, true); -} - -static void qt_wce_disable_soft_key(HWND handle, uint command) -{ - resolveAygLibs(); - if (ptrEnableSoftKey) - ptrEnableSoftKey(handle, command, false, false); -} - -static void qt_wce_delete_action_list(QList *list) -{ - for(QList::Iterator it = list->begin(); it != list->end(); ++it) { - QWceMenuAction *action = (*it); - delete action; - action = 0; - } - list->clear(); -} - -//search for first QuitRole in QMenuBar -static QAction* qt_wce_get_quit_action(QList actionItems) -{ - QAction *returnAction = 0; - for (int i = 0; i < actionItems.size(); ++i) { - QAction *action = actionItems.at(i); - if (action->menuRole() == QAction::QuitRole) - returnAction = action; - else - if (action->menu()) - returnAction = qt_wce_get_quit_action(action->menu()->actions()); - if (returnAction) - return returnAction; //return first action found - } - return 0; //nothing found; -} - -static QAction* qt_wce_get_quit_action(QList actionItems) -{ - for (int i = 0; i < actionItems.size(); ++i) { - if (actionItems.at(i)->action->menuRole() == QAction::QuitRole) - return actionItems.at(i)->action; - else if (actionItems.at(i)->action->menu()) { - QAction *returnAction = qt_wce_get_quit_action(actionItems.at(i)->action->menu()->actions()); - if (returnAction) - return returnAction; - } - } - return 0; -} - -static HMODULE qt_wce_get_module_handle() -{ - HMODULE module = 0; //handle to resources - if (!(module = GetModuleHandle(L"QtGui4"))) //release dynamic - if (!(module = GetModuleHandle(L"QtGuid4"))) //debug dynamic - module = (HINSTANCE)qWinAppInst(); //static - Q_ASSERT_X(module, "qt_wce_get_module_handle()", "cannot get handle to module?"); - return module; -} - -static void qt_wce_change_command(HWND menuHandle, int item, int command) -{ -TBBUTTONINFOA tbbi; - memset(&tbbi,0,sizeof(tbbi)); - tbbi.cbSize = sizeof(tbbi); - tbbi.dwMask = TBIF_COMMAND; - tbbi.idCommand = command; - SendMessage(menuHandle, TB_SETBUTTONINFO, item, (LPARAM)&tbbi); -} - -static void qt_wce_rename_menu_item(HWND menuHandle, int item, const QString &newText) -{ - TBBUTTONINFOA tbbi; - memset(&tbbi,0,sizeof(tbbi)); - tbbi.cbSize = sizeof(tbbi); - tbbi.dwMask = TBIF_TEXT; - QString text = newText; - text.remove(QChar::fromLatin1('&')); - tbbi.pszText = (LPSTR) text.utf16(); - SendMessage(menuHandle, TB_SETBUTTONINFO, item, (LPARAM)&tbbi); -} - -static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, int toolbarID, int flags = 0) -{ - resolveAygLibs(); - - if (ptrCreateMenuBar) { - qt_SHMENUBARINFO mbi; - memset(&mbi, 0, sizeof(qt_SHMENUBARINFO)); - mbi.cbSize = sizeof(qt_SHMENUBARINFO); - mbi.hwndParent = parentHandle; - mbi.hInstRes = resourceHandle; - mbi.dwFlags = flags; - mbi.nToolBarId = toolbarID; - - if (ptrCreateMenuBar(&mbi)) { -#ifdef Q_OS_WINCE_WM - // Tell the menu bar that we want to override hot key behaviour. - LPARAM lparam = MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY, - SHMBOF_NODEFAULT | SHMBOF_NOTIFY); - SendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK, lparam); -#endif - return mbi.hwndMB; - } - } - return 0; -} - -static void qt_wce_insert_action(HMENU menu, QWceMenuAction *action) -{ - Q_ASSERT_X(menu, "AppendMenu", "menu is 0"); - if (action->action->isVisible()) { - int flags; - action->action->isEnabled() ? flags = MF_ENABLED : flags = MF_GRAYED; - - QString text = action->action->iconText(); - text.remove(QChar::fromLatin1('&')); - if (action->action->isSeparator()) { - AppendMenu (menu, MF_SEPARATOR , 0, 0); - } - else if (action->action->menu()) { - text.remove(QChar::fromLatin1('&')); - AppendMenu (menu, MF_STRING | flags | MF_POPUP, - (UINT) action->action->menu()->wceMenu(), reinterpret_cast (text.utf16())); - } - else { - AppendMenu (menu, MF_STRING | flags, action->command, reinterpret_cast (text.utf16())); - } - if (action->action->isCheckable()) - if (action->action->isChecked()) - CheckMenuItem(menu, action->command, MF_BYCOMMAND | MF_CHECKED); - else - CheckMenuItem(menu, action->command, MF_BYCOMMAND | MF_UNCHECKED); - } -} - -// Removes all items from the menu without destroying the handles. -static void qt_wce_clear_menu(HMENU hMenu) -{ - while (RemoveMenu(hMenu, 0, MF_BYPOSITION)); -} - -/*! - \internal - - This function refreshes the native Windows CE menu. -*/ - -void QMenuBar::wceRefresh() -{ - for (int i = 0; i < nativeMenuBars.size(); ++i) - nativeMenuBars.at(i)->d_func()->wceRefresh(); -} - -void QMenuBarPrivate::wceRefresh() -{ - DrawMenuBar(wce_menubar->menubarHandle); -} - -/*! - \internal - - This function sends native Windows CE commands to Qt menus. -*/ - -QAction* QMenu::wceCommands(uint command) -{ - Q_D(QMenu); - return d->wceCommands(command); -} - -/*! - \internal - - This function sends native Windows CE commands to Qt menu bars - and all their child menus. -*/ - -void QMenuBar::wceCommands(uint command) -{ - const HWND hwndActiveWindow = GetActiveWindow(); - for (int i = 0; i < nativeMenuBars.size(); ++i) { - QMenuBarPrivate* nativeMenuBar = nativeMenuBars.at(i)->d_func(); - if (hwndActiveWindow == nativeMenuBar->wce_menubar->parentWindowHandle) - nativeMenuBar->wceCommands(command); - } -} - -bool QMenuBarPrivate::wceEmitSignals(QList actions, uint command) -{ - QAction *foundAction = 0; - for (int i = 0; i < actions.size(); ++i) { - QWceMenuAction *action = actions.at(i); - if (action->action->menu()) { - foundAction = action->action->menu()->wceCommands(command); - if (foundAction) - break; - } - else if (action->command == command) { - action->action->activate(QAction::Trigger); - return true; - } - } - if (foundAction) { - emit q_func()->triggered(foundAction); - return true; - } - return false; -} - -void QMenuBarPrivate::wceCommands(uint command) -{ - if (wceClassicMenu) { - for (int i = 0; i < wce_menubar->actionItemsClassic.size(); ++i) - wceEmitSignals(wce_menubar->actionItemsClassic.at(i), command); - } else { - if (wceEmitSignals(wce_menubar->actionItems, command)) { - return; - } - else if (wce_menubar->leftButtonIsMenu) {//check if command is on the left quick button - wceEmitSignals(wce_menubar->actionItemsLeftButton, command); - } - else if ((wce_menubar->leftButtonAction) && (command == wce_menubar->leftButtonCommand)) { - emit q_func()->triggered(wce_menubar->leftButtonAction); - wce_menubar->leftButtonAction->activate(QAction::Trigger); - } - } -} - -QAction *QMenuPrivate::wceCommands(uint command) -{ - QAction *foundAction = 0; - for (int i = 0; i < wce_menu->actionItems.size(); ++i) { - if (foundAction) - break; - QWceMenuAction *action = wce_menu->actionItems.at(i); - if (action->action->menu()) { - foundAction = action->action->menu()->d_func()->wceCommands(command); - } - else if (action->command == command) { - activateAction(action->action, QAction::Trigger); - return action->action; - } - } - if (foundAction) - emit q_func()->triggered(foundAction); - return foundAction; -} - -void QMenuBarPrivate::wceCreateMenuBar(QWidget *parent) -{ - Q_Q(QMenuBar); - wce_menubar = new QWceMenuBarPrivate(this); - - wce_menubar->parentWindowHandle = parent ? QApplicationPrivate::getHWNDForWidget(parent) : - QApplicationPrivate::getHWNDForWidget(q); - wce_menubar->leftButtonAction = defaultAction; - - wce_menubar->menubarHandle = qt_wce_create_menubar(wce_menubar->parentWindowHandle, (HINSTANCE)qWinAppInst(), 0, SHCMBF_EMPTYBAR); - Q_ASSERT_X(wce_menubar->menubarHandle, "wceCreateMenuBar", "cannot create empty menu bar"); - DrawMenuBar(wce_menubar->menubarHandle); - nativeMenuBars.append(q); - wceClassicMenu = (!qt_wince_is_smartphone() && !qt_wince_is_pocket_pc()); -} - -void QMenuBarPrivate::wceDestroyMenuBar() -{ - Q_Q(QMenuBar); - int index = nativeMenuBars.indexOf(q); - nativeMenuBars.removeAt(index); - if (wce_menubar) { - delete wce_menubar; - wce_menubar = 0; - } -} - -QMenuBarPrivate::QWceMenuBarPrivate::QWceMenuBarPrivate(QMenuBarPrivate *menubar) -: menubarHandle(0), menuHandle(0), leftButtonMenuHandle(0), - leftButtonAction(0), leftButtonIsMenu(false), d(menubar) -{ -} - -QMenuBarPrivate::QWceMenuBarPrivate::~QWceMenuBarPrivate() -{ - if (menubarHandle) - DestroyWindow(menubarHandle); - qt_wce_delete_action_list(&actionItems); - qt_wce_delete_action_list(&actionItemsLeftButton); - - for (int i=0; iaction = a; - action->command = qt_wce_menu_static_cmd_id++; - addAction(action, before); -} - -void QMenuPrivate::QWceMenuPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before) -{ - if (!action) - return; - int before_index = actionItems.indexOf(before); - if (before_index < 0) { - before = 0; - before_index = actionItems.size(); - } - actionItems.insert(before_index, action); - rebuild(); -} - -/*! - \internal - - This function will return the HMENU used to create the native - Windows CE menu bar bindings. -*/ - -HMENU QMenu::wceMenu() -{ - return d_func()->wceMenu(); -} - -HMENU QMenuPrivate::wceMenu() -{ - if (!wce_menu) - wce_menu = new QWceMenuPrivate; - if (!wce_menu->menuHandle) - wce_menu->rebuild(); - return wce_menu->menuHandle; -} - -void QMenuPrivate::QWceMenuPrivate::rebuild() -{ - if (!menuHandle) - menuHandle = CreatePopupMenu(); - else - qt_wce_clear_menu(menuHandle); - - for (int i = 0; i < actionItems.size(); ++i) { - QWceMenuAction *action = actionItems.at(i); - action->menuHandle = menuHandle; - qt_wce_insert_action(menuHandle, action); - } - QMenuBar::wceRefresh(); -} - -void QMenuPrivate::QWceMenuPrivate::syncAction(QWceMenuAction *) -{ - rebuild(); -} - -void QMenuPrivate::QWceMenuPrivate::removeAction(QWceMenuAction *action) -{ - actionItems.removeAll(action); - delete action; - rebuild(); -} - -void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QAction *before) -{ - QWceMenuAction *action = new QWceMenuAction; - action->action = a; - action->command = qt_wce_menu_static_cmd_id++; - addAction(action, findAction(before)); -} - -void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before) -{ - if (!action) - return; - int before_index = actionItems.indexOf(before); - if (before_index < 0) { - before = 0; - before_index = actionItems.size(); - } - actionItems.insert(before_index, action); - rebuild(); -} - -void QMenuBarPrivate::QWceMenuBarPrivate::syncAction(QWceMenuAction*) -{ - QMenuBar::wceRefresh(); - rebuild(); -} - -void QMenuBarPrivate::QWceMenuBarPrivate::removeAction(QWceMenuAction *action) -{ - actionItems.removeAll(action); - delete action; - rebuild(); -} - -void QMenuBarPrivate::_q_updateDefaultAction() -{ - if (wce_menubar) - wce_menubar->rebuild(); -} - -void QMenuBarPrivate::QWceMenuBarPrivate::rebuild() -{ - d->q_func()->resize(0,0); - parentWindowHandle = d->q_func()->parentWidget() ? QApplicationPrivate::getHWNDForWidget(d->q_func()->parentWidget()) : - QApplicationPrivate::getHWNDForWidget(d->q_func()); - if (d->wceClassicMenu) { - QList actions = d->actions; - int maxEntries; - int resourceHandle; - if (actions.size() < 5) { - maxEntries = 4; - resourceHandle = IDR_MAIN_MENU3; - } else if (actions.size() < 7) { - maxEntries = 6; - resourceHandle = IDR_MAIN_MENU4; - } - else { - maxEntries = 8; - resourceHandle = IDR_MAIN_MENU5; - } - Q_ASSERT_X(menubarHandle, "rebuild !created", "menubar already deleted"); - qt_wce_clear_menu(menuHandle); - DestroyWindow(menubarHandle); - menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), resourceHandle); - Q_ASSERT_X(menubarHandle, "rebuild classic menu", "cannot create menubar from resource"); - DrawMenuBar(menubarHandle); - QList menu_ids; - QList item_ids; - menu_ids << IDM_MENU1 << IDM_MENU2 << IDM_MENU3 << IDM_MENU4 << IDM_MENU5 << IDM_MENU6 << IDM_MENU7 << IDM_MENU8; - item_ids << IDM_ITEM1 << IDM_ITEM2 << IDM_ITEM3 << IDM_ITEM4 << IDM_ITEM5 << IDM_ITEM6 << IDM_ITEM7 << IDM_ITEM8; - - for (int i = 0; i < actionItemsClassic.size(); ++i) - if (!actionItemsClassic.value(i).empty()) - qt_wce_delete_action_list(&actionItemsClassic[i]); - actionItemsClassic.clear(); - - for (int i = 0; i < actions.size(); ++i) { - qt_wce_rename_menu_item(menubarHandle, menu_ids.at(i), actions.at(i)->text()); - QList subActions = actions.at(i)->menu()->actions(); - HMENU subMenuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0 , menu_ids.at(i)); - DeleteMenu(subMenuHandle, item_ids.at(i), MF_BYCOMMAND); - for (int c = 0; c < subActions.size(); ++c) { - QList list; - actionItemsClassic.append(list); - QWceMenuAction *action = new QWceMenuAction; - action->action = subActions.at(c); - action->command = qt_wce_menu_static_cmd_id++; - action->menuHandle = subMenuHandle; - actionItemsClassic.last().append(action); - qt_wce_insert_action(subMenuHandle, action); - } - } - for (int i = actions.size();idefaultAction; - if (!leftButtonAction) - leftButtonAction = qt_wce_get_quit_action(actionItems); - - leftButtonIsMenu = (leftButtonAction && leftButtonAction->menu()); - Q_ASSERT_X(menubarHandle, "rebuild !created", "menubar already deleted"); - qt_wce_clear_menu(menuHandle); - DestroyWindow(menubarHandle); - if (leftButtonIsMenu) { - menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), IDR_MAIN_MENU2); - Q_ASSERT_X(menubarHandle, "rebuild !created left menubar", "cannot create menubar from resource"); - menuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0,IDM_MENU); - Q_ASSERT_X(menuHandle, "rebuild !created", "IDM_MENU not found - invalid resource?"); - DeleteMenu(menuHandle, IDM_ABOUT, MF_BYCOMMAND); - leftButtonMenuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0,IDM_LEFTMENU); - Q_ASSERT_X(leftButtonMenuHandle, "rebuild !created", "IDM_LEFTMENU not found - invalid resource?"); - DeleteMenu(leftButtonMenuHandle, IDM_VIEW, MF_BYCOMMAND); - } else { - menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), IDR_MAIN_MENU); - Q_ASSERT_X(menubarHandle, "rebuild !created no left menubar", "cannot create menubar from resource"); - menuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0,IDM_MENU); - Q_ASSERT_X(menuHandle, "rebuild !created", "IDM_MENU not found - invalid resource?"); - DeleteMenu(menuHandle, IDM_ABOUT, MF_BYCOMMAND); - leftButtonMenuHandle = 0; - leftButtonCommand = qt_wce_menu_static_cmd_id++; - qt_wce_change_command(menubarHandle, IDM_EXIT, leftButtonCommand); - } - - if (actionItems.size() == 0) { - qt_wce_rename_menu_item(menubarHandle, IDM_MENU, QLatin1String("")); - qt_wce_disable_soft_key(menubarHandle, IDM_MENU); - } - for (int i = 0; i < actionItems.size(); ++i) { - QWceMenuAction *action = actionItems.at(i); - action->menuHandle = menuHandle; - qt_wce_insert_action(menuHandle, action); - } - if (!leftButtonIsMenu) { - if (leftButtonAction) { - qt_wce_rename_menu_item(menubarHandle, leftButtonCommand, leftButtonAction->text()); - qt_wce_enable_soft_key(menubarHandle, leftButtonCommand); - } else { - qt_wce_rename_menu_item(menubarHandle, leftButtonCommand, QLatin1String("")); - qt_wce_disable_soft_key(menubarHandle, leftButtonCommand); - } - } else { - qt_wce_rename_menu_item(menubarHandle, IDM_LEFTMENU, leftButtonAction->text()); - QList actions = leftButtonAction->menu()->actions(); - qt_wce_delete_action_list(&actionItemsLeftButton); - for (int i=0; iaction = actions.at(i); - action->command = qt_wce_menu_static_cmd_id++; - action->menuHandle = leftButtonMenuHandle; - actionItemsLeftButton.append(action); - qt_wce_insert_action(leftButtonMenuHandle, action); - } - } - } - DrawMenuBar(menubarHandle); -} - -QT_END_NAMESPACE - -#endif //QT_NO_MENUBAR -#endif //Q_OS_WINCE diff --git a/src/widgets/widgets/qmenu_wince.rc b/src/widgets/widgets/qmenu_wince.rc deleted file mode 100644 index 0bcd32c7e5..0000000000 --- a/src/widgets/widgets/qmenu_wince.rc +++ /dev/null @@ -1,231 +0,0 @@ -#include "qmenu_wince_resource_p.h" - -#include -#include "winuser.h" - -#if defined (_DEBUG) && defined(QT_SHARED) -#include "Qt5Widgetsd_resource.rc" -#elif defined(QT_SHARED) -#include "Qt5Widgets_resource.rc" -#endif - -#define DIALOGEX DIALOG DISCARDABLE -#define SHMENUBAR RCDATA -#define I_IMAGENONE (-2) -#define NOMENU 0xFFFF - -IDR_MAIN_MENU MENU DISCARDABLE -BEGIN - POPUP "Menu" - BEGIN - MENUITEM "About", IDM_ABOUT - END -END - -IDR_MAIN_MENU2 MENU DISCARDABLE -BEGIN - POPUP "Menu" - BEGIN - MENUITEM "About", IDM_ABOUT - END - POPUP "Display" - BEGIN - MENUITEM "View", IDM_VIEW - END -END - - -IDR_MAIN_MENU3 MENU DISCARDABLE -BEGIN - POPUP "Menu1" - BEGIN - MENUITEM "Item1", IDM_ITEM1 - END - POPUP "Menu2" - BEGIN - MENUITEM "Item2", IDM_ITEM2 - END - POPUP "Menu3" - BEGIN - MENUITEM "Item3", IDM_ITEM3 - END - POPUP "Menu4" - BEGIN - MENUITEM "Item4", IDM_ITEM4 - END -END - -IDR_MAIN_MENU4 MENU DISCARDABLE -BEGIN - POPUP "Menu1" - BEGIN - MENUITEM "Item1", IDM_ITEM1 - END - POPUP "Menu2" - BEGIN - MENUITEM "Item2", IDM_ITEM2 - END - POPUP "Menu3" - BEGIN - MENUITEM "Item3", IDM_ITEM3 - END - POPUP "Menu4" - BEGIN - MENUITEM "Item4", IDM_ITEM4 - END - POPUP "Menu5" - BEGIN - MENUITEM "Item5", IDM_ITEM5 - END - POPUP "Menu6" - BEGIN - MENUITEM "Item6", IDM_ITEM6 - END -END - -IDR_MAIN_MENU5 MENU DISCARDABLE -BEGIN - POPUP "Menu1" - BEGIN - MENUITEM "Item1", IDM_ITEM1 - END - POPUP "Menu2" - BEGIN - MENUITEM "Item2", IDM_ITEM2 - END - POPUP "Menu3" - BEGIN - MENUITEM "Item3", IDM_ITEM3 - END - POPUP "Menu4" - BEGIN - MENUITEM "Item4", IDM_ITEM4 - END - POPUP "Menu5" - BEGIN - MENUITEM "Item5", IDM_ITEM5 - END - POPUP "Menu6" - BEGIN - MENUITEM "Item6", IDM_ITEM6 - END - POPUP "Menu7" - BEGIN - MENUITEM "Item7", IDM_ITEM7 - END - POPUP "Menu8" - BEGIN - MENUITEM "Item8", IDM_ITEM8 - END -END - -STRINGTABLE -BEGIN - IDS_EXIT "Exit" - IDS_MENU "Menu" - IDS_LEFTMENU "Display" - IDS_MENU1 "Menu__1" - IDS_MENU2 "Menu__2" - IDS_MENU3 "Menu__3" - IDS_MENU4 "Menu__4" - IDS_MENU5 "Menu__5" - IDS_MENU6 "Menu__6" - IDS_MENU7 "Menu__7" - IDS_MENU8 "Menu__8" -END - -IDR_MAIN_MENU SHMENUBAR DISCARDABLE -BEGIN - IDR_MAIN_MENU, - 2, - - I_IMAGENONE, IDM_EXIT, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, - IDS_EXIT, 0, NOMENU, - - I_IMAGENONE, IDM_MENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU, 0, 0, -END - -IDR_MAIN_MENU2 SHMENUBAR DISCARDABLE -BEGIN - IDR_MAIN_MENU2, - 2, - - I_IMAGENONE, IDM_LEFTMENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_LEFTMENU, 0, 1, - - I_IMAGENONE, IDM_MENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU, 0, 0, -END - -IDR_MAIN_MENU3 SHMENUBAR DISCARDABLE -BEGIN - IDR_MAIN_MENU3, - 4, - - I_IMAGENONE, IDM_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU1, 0, 0, - - I_IMAGENONE, IDM_MENU2, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU2, 0, 1, - - I_IMAGENONE, IDM_MENU3, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU3, 0, 2, - - I_IMAGENONE, IDM_MENU4, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU4, 0, 3, -END - -IDR_MAIN_MENU4 SHMENUBAR DISCARDABLE -BEGIN - IDR_MAIN_MENU4, - 6, - - I_IMAGENONE, IDM_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU1, 0, 0, - - I_IMAGENONE, IDM_MENU2, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU2, 0, 1, - - I_IMAGENONE, IDM_MENU3, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU3, 0, 2, - - I_IMAGENONE, IDM_MENU4, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU4, 0, 3, - - I_IMAGENONE, IDM_MENU5, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU5, 0, 4, - - I_IMAGENONE, IDM_MENU6, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU6, 0, 5, -END - -IDR_MAIN_MENU5 SHMENUBAR DISCARDABLE -BEGIN - IDR_MAIN_MENU5, - 8, - - I_IMAGENONE, IDM_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU1, 0, 0, - - I_IMAGENONE, IDM_MENU2, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU2, 0, 1, - - I_IMAGENONE, IDM_MENU3, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU3, 0, 2, - - I_IMAGENONE, IDM_MENU4, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU4, 0, 3, - - I_IMAGENONE, IDM_MENU5, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU5, 0, 4, - - I_IMAGENONE, IDM_MENU6, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU6, 0, 5, - - I_IMAGENONE, IDM_MENU7, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU7, 0, 6, - - I_IMAGENONE, IDM_MENU8, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU8, 0, 7, -END diff --git a/src/widgets/widgets/qmenu_wince_resource_p.h b/src/widgets/widgets/qmenu_wince_resource_p.h deleted file mode 100644 index 3bd83d934f..0000000000 --- a/src/widgets/widgets/qmenu_wince_resource_p.h +++ /dev/null @@ -1,89 +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$ -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// 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. -// - - -#define IDR_MAIN_MENU 102 -#define IDR_MAIN_MENU2 103 -#define IDR_MAIN_MENU3 104 -#define IDS_EXIT 105 -#define IDS_MENU 106 -#define IDS_LEFTMENU 107 -#define IDM_ABOUT 108 -#define IDM_VIEW 109 -#define IDM_ITEM1 108 -#define IDM_ITEM2 109 -#define IDM_ITEM3 110 -#define IDM_ITEM4 111 -#define IDM_ITEM5 112 -#define IDM_ITEM6 113 -#define IDM_ITEM7 114 -#define IDM_ITEM8 115 -#define IDS_MENU1 116 -#define IDS_MENU2 117 -#define IDS_MENU3 118 -#define IDS_MENU4 119 -#define IDS_MENU5 120 -#define IDS_MENU6 121 -#define IDS_MENU7 122 -#define IDS_MENU8 123 -#define IDR_MAIN_MENU4 124 -#define IDR_MAIN_MENU5 125 -#define IDM_EXIT 40000 -#define IDM_MENU 40001 -#define IDM_LEFTMENU 40002 -#define IDM_MENU1 40003 -#define IDM_MENU2 40004 -#define IDM_MENU3 40005 -#define IDM_MENU4 40006 -#define IDM_MENU5 40007 -#define IDM_MENU6 40008 -#define IDM_MENU7 40009 -#define IDM_MENU8 40010 - diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 85d0c54357..59cf9c9aee 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -64,10 +64,6 @@ #include "qmenubar_p.h" #include "qdebug.h" -#ifdef Q_OS_WINCE -extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp -#endif - QT_BEGIN_NAMESPACE class QMenuBarExtension : public QToolButton @@ -701,16 +697,6 @@ void QMenuBarPrivate::init() if (platformMenuBar) q->hide(); -#ifdef Q_OS_WINCE - if (qt_wince_is_mobile()) { - wceCreateMenuBar(q->parentWidget()); - if(wce_menubar) - q->hide(); - } - else { - QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); - } -#endif q->setBackgroundRole(QPalette::Button); oldWindow = oldParent = 0; handleReparent(); @@ -761,11 +747,6 @@ QMenuBar::~QMenuBar() Q_D(QMenuBar); delete d->platformMenuBar; d->platformMenuBar = 0; - -#ifdef Q_OS_WINCE - if (qt_wince_is_mobile()) - d->wceDestroyMenuBar(); -#endif } /*! @@ -1017,7 +998,7 @@ void QMenuBar::paintEvent(QPaintEvent *e) */ void QMenuBar::setVisible(bool visible) { -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) +#if defined(Q_OS_DARWIN) if (isNativeMenuBar()) { if (!visible) QWidget::setVisible(false); @@ -1234,11 +1215,7 @@ void QMenuBar::actionEvent(QActionEvent *e) d->itemsDirty = true; if (d->platformMenuBar) { -#if !defined(Q_OS_WINCE) QPlatformMenuBar *nativeMenuBar = d->platformMenuBar; -#else - QMenuBarPrivate::QWceMenuBarPrivate *nativeMenuBar = d->wce_menubar; -#endif if (!nativeMenuBar) return; @@ -1379,11 +1356,6 @@ void QMenuBarPrivate::handleReparent() platformMenuBar->handleReparent(0); } } - -#ifdef Q_OS_WINCE - if (qt_wince_is_mobile() && wce_menubar) - wce_menubar->rebuild(); -#endif } /*! @@ -1563,7 +1535,7 @@ QRect QMenuBar::actionGeometry(QAction *act) const QSize QMenuBar::minimumSizeHint() const { Q_D(const QMenuBar); -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) +#if defined(Q_OS_DARWIN) const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; @@ -1619,7 +1591,7 @@ QSize QMenuBar::minimumSizeHint() const QSize QMenuBar::sizeHint() const { Q_D(const QMenuBar); -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) +#if defined(Q_OS_DARWIN) const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; @@ -1677,7 +1649,7 @@ QSize QMenuBar::sizeHint() const int QMenuBar::heightForWidth(int) const { Q_D(const QMenuBar); -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) +#if defined(Q_OS_DARWIN) const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; @@ -1861,55 +1833,6 @@ QPlatformMenuBar *QMenuBar::platformMenuBar() return d->platformMenuBar; } -/*! - \since 4.4 - - Sets the default action to \a act. - - The default action is assigned to the left soft key. The menu is assigned - to the right soft key. - - Currently there is only support for the default action on Windows - Mobile. On all other platforms this method is not available. - - \sa defaultAction() -*/ - -#ifdef Q_OS_WINCE -void QMenuBar::setDefaultAction(QAction *act) -{ - Q_D(QMenuBar); - if (d->defaultAction == act) - return; - if (qt_wince_is_mobile()) - if (d->defaultAction) { - disconnect(d->defaultAction, SIGNAL(changed()), this, SLOT(_q_updateDefaultAction())); - disconnect(d->defaultAction, SIGNAL(destroyed()), this, SLOT(_q_updateDefaultAction())); - } - d->defaultAction = act; - if (qt_wince_is_mobile()) - if (d->defaultAction) { - connect(d->defaultAction, SIGNAL(changed()), this, SLOT(_q_updateDefaultAction())); - connect(d->defaultAction, SIGNAL(destroyed()), this, SLOT(_q_updateDefaultAction())); - } - if (d->wce_menubar) { - d->wce_menubar->rebuild(); - } -} - -/*! - \since 4.4 - - Returns the current default action. - - \sa setDefaultAction() -*/ -QAction *QMenuBar::defaultAction() const -{ - return d_func()->defaultAction; -} -#endif - /*! \fn void QMenuBar::triggered(QAction *action) diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h index d3f5e503ac..404bd13332 100644 --- a/src/widgets/widgets/qmenubar.h +++ b/src/widgets/widgets/qmenubar.h @@ -95,13 +95,6 @@ public: void setCornerWidget(QWidget *w, Qt::Corner corner = Qt::TopRightCorner); QWidget *cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const; -#ifdef Q_OS_WINCE - void setDefaultAction(QAction *); - QAction *defaultAction() const; - - static void wceCommands(uint command); - static void wceRefresh(); -#endif #ifdef Q_OS_OSX NSMenu* toNSMenu(); #endif @@ -141,10 +134,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_internalShortcutActivated(int)) Q_PRIVATE_SLOT(d_func(), void _q_updateLayout()) -#ifdef Q_OS_WINCE - Q_PRIVATE_SLOT(d_func(), void _q_updateDefaultAction()) -#endif - friend class QMenu; friend class QMenuPrivate; friend class QWindowsStyle; diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h index 05b1878c20..8a01cb3233 100644 --- a/src/widgets/widgets/qmenubar_p.h +++ b/src/widgets/widgets/qmenubar_p.h @@ -66,17 +66,11 @@ public: QMenuBarPrivate() : itemsDirty(0), currentAction(0), mouseDown(0), closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0), nativeMenuBar(-1), doChildEffects(false), platformMenuBar(0) + { } -#ifdef Q_OS_WINCE - , wce_menubar(0), wceClassicMenu(false) -#endif - { } ~QMenuBarPrivate() { delete platformMenuBar; -#ifdef Q_OS_WINCE - delete wce_menubar; -#endif } void init(); @@ -118,10 +112,6 @@ public: void _q_internalShortcutActivated(int); void _q_updateLayout(); -#ifdef Q_OS_WINCE - void _q_updateDefaultAction(); -#endif - //extra widgets in the menubar QPointer leftWidget, rightWidget; QMenuBarExtension *extension; @@ -146,47 +136,6 @@ public: QPlatformMenu *getPlatformMenu(QAction *action); inline int indexOf(QAction *act) const { return q_func()->actions().indexOf(act); } - -#ifdef Q_OS_WINCE - void wceCreateMenuBar(QWidget *); - void wceDestroyMenuBar(); - struct QWceMenuBarPrivate { - QList actionItems; - QList actionItemsLeftButton; - QList> actionItemsClassic; - HMENU menuHandle; - HMENU leftButtonMenuHandle; - HWND menubarHandle; - HWND parentWindowHandle; - bool leftButtonIsMenu; - QPointer leftButtonAction; - QMenuBarPrivate *d; - int leftButtonCommand; - - QWceMenuBarPrivate(QMenuBarPrivate *menubar); - ~QWceMenuBarPrivate(); - void addAction(QAction *, QAction *); - void addAction(QAction *, QWceMenuAction* =0); - void addAction(QWceMenuAction *, QWceMenuAction* =0); - void syncAction(QWceMenuAction *); - inline void syncAction(QAction *a) { syncAction(findAction(a)); } - void removeAction(QWceMenuAction *); - void rebuild(); - inline void removeAction(QAction *a) { removeAction(findAction(a)); } - inline QWceMenuAction *findAction(QAction *a) { - for(int i = 0; i < actionItems.size(); i++) { - QWceMenuAction *act = actionItems[i]; - if(a == act->action) - return act; - } - return 0; - } - } *wce_menubar; - bool wceClassicMenu; - void wceCommands(uint command); - void wceRefresh(); - bool wceEmitSignals(QList actions, uint command); -#endif }; #endif // QT_NO_MENUBAR diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp index 7dd41f6a0c..0490aa7bc8 100644 --- a/src/widgets/widgets/qscrollbar.cpp +++ b/src/widgets/widgets/qscrollbar.cpp @@ -397,12 +397,6 @@ void QScrollBarPrivate::init() q->setSizePolicy(sp); q->setAttribute(Qt::WA_WState_OwnSizePolicy, false); q->setAttribute(Qt::WA_OpaquePaintEvent); - -#if !defined(QT_NO_CONTEXTMENU) && defined(Q_OS_WINCE) - if (!q->style()->styleHint(QStyle::SH_ScrollBar_ContextMenu, 0, q)) { - q->setContextMenuPolicy(Qt::PreventContextMenu); - } -#endif } #ifndef QT_NO_CONTEXTMENU diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp index c74372cfa4..2e67276047 100644 --- a/src/widgets/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -1186,17 +1186,6 @@ bool QToolBar::event(QEvent *event) if (d->mouseMoveEvent(static_cast(event))) return true; break; -#ifdef Q_OS_WINCE - case QEvent::ContextMenu: - { - QContextMenuEvent* contextMenuEvent = static_cast(event); - QWidget* child = childAt(contextMenuEvent->pos()); - QAbstractButton* button = qobject_cast(child); - if (button) - button->setDown(false); - } - break; -#endif case QEvent::Leave: if (d->state != 0 && d->state->dragging) { #ifdef Q_OS_WIN diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 784055ed62..abba3e0472 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -155,19 +155,3 @@ macx { widgets/qmacnativewidget_mac.mm \ widgets/qmaccocoaviewcontainer_mac.mm } - -wince { - SOURCES += widgets/qmenu_wince.cpp - HEADERS += widgets/qmenu_wince_resource_p.h - RC_FILE = widgets/qmenu_wince.rc - !static: QMAKE_WRITE_DEFAULT_RC = 1 - !isEmpty(QT_LIBINFIX) { - ORIG_RCFILE = $${TARGET}_resource.rc - copyrcc.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} - copyrcc.input = ORIG_RCFILE - CONFIG(debug, debug|release):copyrcc.output = $${ORIG_TARGET}d_resource.rc - else:copyrcc.output = $${ORIG_TARGET}_resource.rc - copyrcc.CONFIG = target_predeps no_link - QMAKE_EXTRA_COMPILERS += copyrcc - } -} -- cgit v1.2.3