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/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 - 15 files changed, 12 insertions(+), 1235 deletions(-) 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/widgets/widgets') 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