diff options
author | Morten Sorvig <morten.sorvig@nokia.com> | 2011-09-07 11:44:00 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@nokia.com> | 2011-09-08 13:29:53 +0200 |
commit | 9abb38f5a693dfc30842c5c1aa012ab5d72e0d16 (patch) | |
tree | b3ba8b8ad39b254eb89d37c17d37b3c93d92cabb /src/widgets/widgets/qmenu.cpp | |
parent | 6f65a55fa9a5bf8a547dff2893d49ab405a16af0 (diff) |
Remove QT3_SUPPORT code from QMenu classes
Change-Id: I22df8f96ddca9784d6487a59a0c780ca9641fe23
Reviewed-on: http://codereview.qt-project.org/4434
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Liang Qi <liang.qi@nokia.com>
Diffstat (limited to 'src/widgets/widgets/qmenu.cpp')
-rw-r--r-- | src/widgets/widgets/qmenu.cpp | 465 |
1 files changed, 0 insertions, 465 deletions
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index cfcf0dc9ed..67dbd7e265 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -69,9 +69,6 @@ #include <private/qpushbutton_p.h> #include <private/qaction_p.h> #include <private/qsoftkeymanager_p.h> -#ifdef QT3_SUPPORT -#include <qmenudata.h> -#endif // QT3_SUPPORT #ifdef Q_WS_X11 # include <private/qt_x11_p.h> @@ -578,9 +575,6 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason #ifndef QT_NO_STATUSTIP QAction *previousAction = currentAction; #endif -#ifdef QT3_SUPPORT - emitHighlighted = action; -#endif currentAction = action; if (action) { @@ -1012,9 +1006,6 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e) void QMenuPrivate::activateCausedStack(const QList<QPointer<QWidget> > &causedStack, QAction *action, QAction::ActionEvent action_e, bool self) { QBoolBlocker guard(activationRecursionGuard); -#ifdef QT3_SUPPORT - const int actionId = q_func()->findIdForAction(action); -#endif if(self) action->activate(action_e); @@ -1029,28 +1020,13 @@ void QMenuPrivate::activateCausedStack(const QList<QPointer<QWidget> > &causedSt emit qmenu->triggered(action); } else if (action_e == QAction::Hover) { emit qmenu->hovered(action); -#ifdef QT3_SUPPORT - if (emitHighlighted) { - emit qmenu->highlighted(actionId); - emitHighlighted = false; - } -#endif } #ifndef QT_NO_MENUBAR } else if (QMenuBar *qmenubar = qobject_cast<QMenuBar*>(widget)) { if (action_e == QAction::Trigger) { emit qmenubar->triggered(action); -#ifdef QT3_SUPPORT - emit qmenubar->activated(actionId); -#endif } else if (action_e == QAction::Hover) { emit qmenubar->hovered(action); -#ifdef QT3_SUPPORT - if (emitHighlighted) { - emit qmenubar->highlighted(actionId); - emitHighlighted = false; - } -#endif } break; //nothing more.. #endif @@ -1130,15 +1106,7 @@ void QMenuPrivate::_q_actionTriggered() Q_Q(QMenu); if (QAction *action = qobject_cast<QAction *>(q->sender())) { QWeakPointer<QAction> actionGuard = action; -#ifdef QT3_SUPPORT - //we store it here because the action might be deleted/changed by connected slots - const int id = q->findIdForAction(action); -#endif emit q->triggered(action); -#ifdef QT3_SUPPORT - emit q->activated(id); -#endif - if (!activationRecursionGuard && actionGuard) { //in case the action has not been activated by the mouse //we check the parent hierarchy @@ -1164,17 +1132,7 @@ void QMenuPrivate::_q_actionHovered() { Q_Q(QMenu); if (QAction * action = qobject_cast<QAction *>(q->sender())) { -#ifdef QT3_SUPPORT - //we store it here because the action might be deleted/changed by connected slots - const int id = q->findIdForAction(action); -#endif emit q->hovered(action); -#ifdef QT3_SUPPORT - if (emitHighlighted) { - emit q->highlighted(id); - emitHighlighted = false; - } -#endif } } @@ -3133,429 +3091,6 @@ void QMenu::setSeparatorsCollapsible(bool collapse) d->platformMenu->syncSeparatorsCollapsible(collapse); } -#ifdef QT3_SUPPORT - -int QMenu::insertAny(const QIcon *icon, const QString *text, const QObject *receiver, const char *member, - const QKeySequence *shortcut, const QMenu *popup, int id, int index) -{ - QAction *act = popup ? popup->menuAction() : new QAction(this); - if (id != -1) - static_cast<QMenuItem*>(act)->setId(id); - if (icon) - act->setIcon(*icon); - if (text) - act->setText(*text); - if (shortcut) - act->setShortcut(*shortcut); - if (receiver && member) - QObject::connect(act, SIGNAL(activated(int)), receiver, member); - if (index == -1 || index >= actions().count()) - addAction(act); - else - insertAction(actions().value(index), act); - return findIdForAction(act); -} - -/*! - Use insertAction() or one of the addAction() overloads instead. -*/ -int QMenu::insertItem(QMenuItem *item, int id, int index) -{ - if (index == -1 || index >= actions().count()) - addAction(item); - else - insertAction(actions().value(index), item); - if (id > -1) - item->d_func()->id = id; - return findIdForAction(item); -} - -/*! - Use the insertSeparator() overload that takes a QAction * - parameter instead. -*/ -int QMenu::insertSeparator(int index) -{ - QAction *act = new QAction(this); - act->setSeparator(true); - if (index == -1 || index >= actions().count()) - addAction(act); - else - insertAction(actions().value(index), act); - return findIdForAction(act); -} - -QAction *QMenu::findActionForId(int id) const -{ - Q_D(const QMenu); - for (int i = 0; i < d->actions.size(); ++i) { - QAction *act = d->actions.at(i); - if (findIdForAction(act)== id) - return act; - } - return 0; -} - -/*! - Use QAction and actions() instead. -*/ -QMenuItem *QMenu::findPopup( QMenu *popup, int *index ) -{ - QList<QAction *> list = actions(); - for (int i = 0; i < list.size(); ++i) { - QAction *act = list.at(i); - if (act->menu() == popup) { - QMenuItem *item = static_cast<QMenuItem *>(act); - if (index) - *index = act->d_func()->id; - return item; - } - } - return 0; -} - - -/*! - Use QAction::setData() instead. -*/ -bool QMenu::setItemParameter(int id, int param) -{ - if (QAction *act = findActionForId(id)) { - act->d_func()->param = param; - return true; - } - return false; -} - -/*! - Use QAction::data() instead. -*/ -int QMenu::itemParameter(int id) const -{ - if (QAction *act = findActionForId(id)) - return act->d_func()->param; - return id; -} - -/*! - Use actions instead. -*/ -void QMenu::setId(int index, int id) -{ - if(QAction *act = actions().value(index)) - act->d_func()->id = id; -} - -/*! - Use style()->pixelMetric(QStyle::PM_MenuPanelWidth, this) instead. -*/ -int QMenu::frameWidth() const -{ - return style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this); -} - -int QMenu::findIdForAction(QAction *act) const -{ - if (!act) - return -1; - return act->d_func()->id; -} -#endif // QT3_SUPPORT - -/*! - \fn uint QMenu::count() const - - Use actions().count() instead. -*/ - -/*! - \fn int QMenu::insertItem(const QString &text, const QObject *receiver, const char* member, const QKeySequence& shortcut, int id, int index) - - Use insertAction() or one of the addAction() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QIcon& icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence& shortcut, int id, int index) - - Use insertAction() or one of the addAction() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QPixmap &pixmap, const QObject *receiver, const char* member, const QKeySequence& shortcut, int id, int index) - - Use insertAction() or one of the addAction() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QString &text, int id, int index) - - Use insertAction() or one of the addAction() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QIcon& icon, const QString &text, int id, int index) - - Use insertAction() or one of the addAction() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QString &text, QMenu *popup, int id, int index) - - Use insertMenu() or one of the addMenu() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QIcon& icon, const QString &text, QMenu *popup, int id, int index) - - Use insertMenu() or one of the addMenu() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QPixmap &pixmap, int id, int index) - - Use insertAction() or one of the addAction() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QPixmap &pixmap, QMenu *popup, int id, int index) - - Use insertMenu() or one of the addMenu() overloads instead. -*/ - -/*! - \fn void QMenu::removeItem(int id) - - Use removeAction() instead. -*/ - -/*! - \fn void QMenu::removeItemAt(int index) - - Use removeAction() instead. -*/ - -/*! - \fn QKeySequence QMenu::accel(int id) const - - Use shortcut() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::setAccel(const QKeySequence& key, int id) - - Use setShortcut() on the relevant QAction instead. -*/ - -/*! - \fn QIcon QMenu::iconSet(int id) const - - Use icon() on the relevant QAction instead. -*/ - -/*! - \fn QString QMenu::text(int id) const - - Use text() on the relevant QAction instead. -*/ - -/*! - \fn QPixmap QMenu::pixmap(int id) const - - Use QPixmap(icon()) on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::setWhatsThis(int id, const QString &w) - - Use setWhatsThis() on the relevant QAction instead. -*/ - -/*! - \fn QString QMenu::whatsThis(int id) const - - Use whatsThis() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::changeItem(int id, const QString &text) - - Use setText() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::changeItem(int id, const QPixmap &pixmap) - - Use setText() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::changeItem(int id, const QIcon &icon, const QString &text) - - Use setIcon() and setText() on the relevant QAction instead. -*/ - -/*! - \fn bool QMenu::isItemActive(int id) const - - Use activeAction() instead. -*/ - -/*! - \fn bool QMenu::isItemEnabled(int id) const - - Use isEnabled() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::setItemEnabled(int id, bool enable) - - Use setEnabled() on the relevant QAction instead. -*/ - -/*! - \fn bool QMenu::isItemChecked(int id) const - - Use isChecked() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::setItemChecked(int id, bool check) - - Use setChecked() on the relevant QAction instead. -*/ - -/*! - \fn bool QMenu::isItemVisible(int id) const - - Use isVisible() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::setItemVisible(int id, bool visible) - - Use setVisible() on the relevant QAction instead. -*/ - -/*! - \fn QRect QMenu::itemGeometry(int index) - - Use actionGeometry() on the relevant QAction instead. -*/ - -/*! - \fn QFont QMenu::itemFont(int id) const - - Use font() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::setItemFont(int id, const QFont &font) - - Use setFont() on the relevant QAction instead. -*/ - -/*! - \fn int QMenu::indexOf(int id) const - - Use actions().indexOf(action) on the relevant QAction instead. -*/ - -/*! - \fn int QMenu::idAt(int index) const - - Use actions instead. -*/ - -/*! - \fn void QMenu::activateItemAt(int index) - - Use activate() on the relevant QAction instead. -*/ - -/*! - \fn bool QMenu::connectItem(int id, const QObject *receiver, const char* member) - - Use connect() on the relevant QAction instead. -*/ - -/*! - \fn bool QMenu::disconnectItem(int id,const QObject *receiver, const char* member) - Use disconnect() on the relevant QAction instead. - -*/ - -/*! - \fn QMenuItem *QMenu::findItem(int id) const - - Use actions instead. -*/ - -/*! - \fn void QMenu::popup(const QPoint & pos, int indexAtPoint) - - Use popup() on the relevant QAction instead. -*/ - -/*! - \fn int QMenu::insertTearOffHandle(int a, int b) - - Use setTearOffEnabled() instead. -*/ - -/*! - \fn int QMenu::itemAtPos(const QPoint &p, bool ignoreSeparator) - - Use actions instead. -*/ - -/*! - \fn int QMenu::columns() const - - Use columnCount() instead. -*/ - -/*! - \fn int QMenu::itemHeight(int index) - - Use actionGeometry(actions().value(index)).height() instead. -*/ - -/*! - \fn int QMenu::itemHeight(QMenuItem *mi) - - Use actionGeometry() instead. -*/ - -/*! - \fn void QMenu::activated(int itemId); - - Use triggered() instead. -*/ - -/*! - \fn void QMenu::highlighted(int itemId); - - Use hovered() instead. -*/ - -/*! - \fn void QMenu::setCheckable(bool checkable) - - Not necessary anymore. The \a checkable parameter is ignored. -*/ - -/*! - \fn bool QMenu::isCheckable() const - - Not necessary anymore. Always returns true. -*/ - -/*! - \fn void QMenu::setActiveItem(int id) - - Use setActiveAction() instead. -*/ - QT_END_NAMESPACE // for private slots |