Fixed build breaks that result after disabling "contextmenu" feature
Change-Id: I261f927ee720e0c65abd18417e1ac48dbee820df Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
This commit is contained in:
parent
933e3e886f
commit
924d4aefd5
@ -468,11 +468,13 @@ void ColorSwatch::tabInto(QAction *action)
|
||||
mainWindow->tabifyDockWidget(target, this);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
void ColorSwatch::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
event->accept();
|
||||
menu->exec(event->globalPos());
|
||||
}
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
|
||||
void ColorSwatch::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
|
@ -51,7 +51,9 @@ public:
|
||||
QMenu *colorSwatchMenu() const { return menu; }
|
||||
|
||||
protected:
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
|
@ -83,6 +83,7 @@ MainWindow::MainWindow()
|
||||
//! [2]
|
||||
|
||||
//! [3]
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
void MainWindow::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
QMenu menu(this);
|
||||
@ -91,6 +92,7 @@ void MainWindow::contextMenuEvent(QContextMenuEvent *event)
|
||||
menu.addAction(pasteAct);
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
//! [3]
|
||||
|
||||
void MainWindow::newFile()
|
||||
|
@ -59,7 +59,9 @@ public:
|
||||
MainWindow();
|
||||
|
||||
protected:
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
//! [0]
|
||||
|
||||
//! [1]
|
||||
|
@ -3940,9 +3940,11 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
|
||||
QtDebugUtils::formatQEnum(dbg, static_cast<const QApplicationStateChangeEvent *>(e)->applicationState());
|
||||
dbg << ')';
|
||||
break;
|
||||
# ifndef QT_NO_CONTEXTMENU
|
||||
case QEvent::ContextMenu:
|
||||
dbg << "QContextMenuEvent(" << static_cast<const QContextMenuEvent *>(e)->pos() << ')';
|
||||
break;
|
||||
# endif // !QT_NO_CONTEXTMENU
|
||||
# ifndef QT_NO_TABLETEVENT
|
||||
case QEvent::TabletEnterProximity:
|
||||
case QEvent::TabletLeaveProximity:
|
||||
|
@ -366,6 +366,7 @@ void QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher *cal
|
||||
bool retval = reply.value();
|
||||
qCDebug(qtQpaInputMethods) << "filterEventFinished return" << code << sym << state << retval;
|
||||
if (!retval) {
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
QWindow *window = dynamic_cast<QWindow *>(input);
|
||||
if (type == QEvent::KeyPress && qtcode == Qt::Key_Menu
|
||||
&& window != NULL) {
|
||||
@ -374,6 +375,7 @@ void QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher *cal
|
||||
QWindowSystemInterface::handleContextMenuEvent(window, false, pos,
|
||||
globalPos, modifiers);
|
||||
}
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
QKeyEvent event(type, qtcode, modifiers, code, sym,
|
||||
state, string, isAutoRepeat, count);
|
||||
event.setTimestamp(time);
|
||||
|
@ -1511,11 +1511,13 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type,
|
||||
|
||||
QWindow *window = targetWindow->window();
|
||||
if (!filtered) {
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
if (type == QEvent::KeyPress && qtcode == Qt::Key_Menu) {
|
||||
const QPoint globalPos = window->screen()->handle()->cursor()->pos();
|
||||
const QPoint pos = window->mapFromGlobal(globalPos);
|
||||
QWindowSystemInterface::handleContextMenuEvent(window, false, pos, globalPos, modifiers);
|
||||
}
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
QWindowSystemInterface::handleExtendedKeyEvent(window, time, type, qtcode, modifiers,
|
||||
code, sym, state, string, isAutoRepeat);
|
||||
}
|
||||
|
@ -89,16 +89,14 @@ public:
|
||||
{
|
||||
public:
|
||||
TextEdit(QWidget *parent=0) : QTextEdit(parent) { }
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
void contextMenuEvent(QContextMenuEvent * e) Q_DECL_OVERRIDE
|
||||
{
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
QMenu *menu = createStandardContextMenu();
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose);
|
||||
menu->popup(e->globalPos());
|
||||
#else
|
||||
Q_UNUSED(e);
|
||||
#endif
|
||||
}
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
};
|
||||
|
||||
QMessageBoxDetailsText(QWidget *parent=0)
|
||||
|
@ -283,7 +283,7 @@ bool QWidgetWindow::event(QEvent *event)
|
||||
case QEvent::ContextMenu:
|
||||
handleContextMenuEvent(static_cast<QContextMenuEvent *>(event));
|
||||
return true;
|
||||
#endif
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
|
||||
// Handing show events to widgets (see below) here would cause them to be triggered twice
|
||||
case QEvent::Show:
|
||||
@ -510,8 +510,12 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
|
||||
popupEvent = popupChild;
|
||||
QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers());
|
||||
QApplication::sendSpontaneousEvent(popupEvent, &e);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(contextMenuTrigger)
|
||||
Q_UNUSED(oldOpenPopupCount)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (releaseAfter) {
|
||||
qt_button_down = 0;
|
||||
|
@ -170,7 +170,9 @@ void QSystemTrayIconSys::mousePressEvent(QMouseEvent *ev)
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
if (ev->button() == Qt::RightButton && q->contextMenu())
|
||||
q->contextMenu()->popup(globalPos);
|
||||
#endif
|
||||
#else
|
||||
Q_UNUSED(globalPos)
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
|
||||
if (QBalloonTip::isBalloonVisible()) {
|
||||
emit q->messageClicked();
|
||||
|
@ -229,7 +229,9 @@ protected:
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
|
||||
#endif
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
void contextMenuEvent(QContextMenuEvent *e) Q_DECL_OVERRIDE;
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
void inputMethodEvent(QInputMethodEvent *) Q_DECL_OVERRIDE;
|
||||
void initStyleOption(QStyleOptionComboBox *option) const;
|
||||
|
||||
|
@ -882,13 +882,11 @@ void QLabel::mouseReleaseEvent(QMouseEvent *ev)
|
||||
d->sendControlEvent(ev);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
/*!\reimp
|
||||
*/
|
||||
void QLabel::contextMenuEvent(QContextMenuEvent *ev)
|
||||
{
|
||||
#ifdef QT_NO_CONTEXTMENU
|
||||
Q_UNUSED(ev);
|
||||
#else
|
||||
Q_D(QLabel);
|
||||
if (!d->isTextLabel) {
|
||||
ev->ignore();
|
||||
@ -902,8 +900,8 @@ void QLabel::contextMenuEvent(QContextMenuEvent *ev)
|
||||
ev->accept();
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose);
|
||||
menu->popup(ev->globalPos());
|
||||
#endif
|
||||
}
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
|
||||
/*!
|
||||
\reimp
|
||||
|
@ -132,7 +132,9 @@ protected:
|
||||
void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
|
||||
void mouseMoveEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
void contextMenuEvent(QContextMenuEvent *ev) Q_DECL_OVERRIDE;
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
void focusInEvent(QFocusEvent *ev) Q_DECL_OVERRIDE;
|
||||
void focusOutEvent(QFocusEvent *ev) Q_DECL_OVERRIDE;
|
||||
bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
|
||||
|
@ -1060,6 +1060,8 @@ bool QTextEdit::event(QEvent *e)
|
||||
|| e->type() == QEvent::ToolTip) {
|
||||
d->sendControlEvent(e);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(d)
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
if (e->type() == QEvent::EnterEditFocus || e->type() == QEvent::LeaveEditFocus) {
|
||||
|
@ -385,7 +385,9 @@ private slots:
|
||||
void itemContainsChildrenInShape2();
|
||||
void ancestorFlags();
|
||||
void untransformable();
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
void contextMenuEventPropagation();
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
void itemIsMovable();
|
||||
void boundingRegion_data();
|
||||
void boundingRegion();
|
||||
@ -5193,6 +5195,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
void contextMenuEvent(QGraphicsSceneContextMenuEvent *)
|
||||
{
|
||||
if (harakiri == 3) {
|
||||
@ -5200,6 +5203,7 @@ protected:
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
|
||||
void dragEnterEvent(QGraphicsSceneDragDropEvent *event)
|
||||
{
|
||||
@ -5378,11 +5382,13 @@ void tst_QGraphicsItem::deleteItemInEventHandlers()
|
||||
if (!item->dead)
|
||||
scene.advance();
|
||||
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
if (!item->dead) {
|
||||
QContextMenuEvent event(QContextMenuEvent::Other,
|
||||
view.mapFromScene(item->scenePos()));
|
||||
QCoreApplication::sendEvent(view.viewport(), &event);
|
||||
}
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
if (!item->dead)
|
||||
QTest::mouseMove(view.viewport(), view.mapFromScene(item->scenePos()));
|
||||
if (!item->dead)
|
||||
@ -6276,6 +6282,7 @@ void tst_QGraphicsItem::untransformable()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
class ContextMenuItem : public QGraphicsRectItem
|
||||
{
|
||||
public:
|
||||
@ -6339,6 +6346,7 @@ void tst_QGraphicsItem::contextMenuEventPropagation()
|
||||
QCOMPARE(bottomItem->gotEvent, false);
|
||||
QCOMPARE(topItem->eventWasAccepted, true);
|
||||
}
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
|
||||
void tst_QGraphicsItem::itemIsMovable()
|
||||
{
|
||||
|
@ -162,7 +162,9 @@ private slots:
|
||||
void fontPropagation();
|
||||
void dontCrashWhenDie();
|
||||
void createProxyForChildWidget();
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
void actionsContextMenu();
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
void actionsContextMenu_data();
|
||||
void deleteProxyForChildWidget();
|
||||
void bypassGraphicsProxyWidget_data();
|
||||
@ -3071,6 +3073,7 @@ void tst_QGraphicsProxyWidget::createProxyForChildWidget()
|
||||
delete boxProxy;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
class ContextMenuWidget : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -3119,6 +3122,7 @@ private:
|
||||
bool m_embeddedPopupSet;
|
||||
QTimer *m_timer;
|
||||
};
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
|
||||
void tst_QGraphicsProxyWidget::actionsContextMenu_data()
|
||||
{
|
||||
@ -3131,6 +3135,7 @@ void tst_QGraphicsProxyWidget::actionsContextMenu_data()
|
||||
QTest::newRow("with actionsContextMenu without focus") << true << false;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
void tst_QGraphicsProxyWidget::actionsContextMenu()
|
||||
{
|
||||
QFETCH(bool, hasFocus);
|
||||
@ -3185,7 +3190,7 @@ void tst_QGraphicsProxyWidget::actionsContextMenu()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
|
||||
void tst_QGraphicsProxyWidget::deleteProxyForChildWidget()
|
||||
{
|
||||
|
@ -227,8 +227,10 @@ private slots:
|
||||
void render_data();
|
||||
void render();
|
||||
void renderItemsWithNegativeWidthOrHeight();
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
void contextMenuEvent();
|
||||
void contextMenuEvent_ItemIgnoresTransformations();
|
||||
#endif
|
||||
void update();
|
||||
void update2();
|
||||
void views();
|
||||
@ -2712,6 +2714,7 @@ void tst_QGraphicsScene::renderItemsWithNegativeWidthOrHeight()
|
||||
QCOMPARE(actual, expected);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
void tst_QGraphicsScene::contextMenuEvent()
|
||||
{
|
||||
QGraphicsScene scene;
|
||||
@ -2794,6 +2797,7 @@ void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations()
|
||||
QVERIFY(!event.isAccepted());
|
||||
}
|
||||
}
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
|
||||
void tst_QGraphicsScene::update()
|
||||
{
|
||||
|
@ -469,10 +469,12 @@ void tst_QGraphicsView::interactive()
|
||||
QCOMPARE(item->events.size(), i * 5 + 5);
|
||||
QCOMPARE(item->events.at(item->events.size() - 2), QEvent::GraphicsSceneMouseRelease);
|
||||
QCOMPARE(item->events.at(item->events.size() - 1), QEvent::UngrabMouse);
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, itemPoint, view.mapToGlobal(itemPoint));
|
||||
QApplication::sendEvent(view.viewport(), &contextEvent);
|
||||
QCOMPARE(item->events.size(), i * 5 + 6);
|
||||
QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu);
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
}
|
||||
|
||||
view.setInteractive(false);
|
||||
@ -484,10 +486,12 @@ void tst_QGraphicsView::interactive()
|
||||
sendMouseRelease(view.viewport(), itemPoint);
|
||||
QCOMPARE(item->events.size(), 501);
|
||||
QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu);
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, itemPoint, view.mapToGlobal(itemPoint));
|
||||
QApplication::sendEvent(view.viewport(), &contextEvent);
|
||||
QCOMPARE(item->events.size(), 501);
|
||||
QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu);
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1471,12 +1471,14 @@ void tst_QStyleSheetStyle::embeddedFonts()
|
||||
QCOMPARE(spin.font().pixelSize(), 32);
|
||||
QCOMPARE(embedded->font().pixelSize(), 32);
|
||||
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
QMenu *menu = embedded->createStandardContextMenu();
|
||||
menu->show();
|
||||
QTest::qWait(20);
|
||||
QVERIFY(menu);
|
||||
QVERIFY(menu->font().pixelSize() != 32);
|
||||
QCOMPARE(menu->font().pixelSize(), qApp->font(menu).pixelSize());
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
|
||||
//task 242556
|
||||
QComboBox box;
|
||||
|
@ -2243,6 +2243,7 @@ void tst_QLineEdit::deleteSelectedText()
|
||||
edit.setText(text);
|
||||
edit.selectAll();
|
||||
|
||||
#ifndef QT_NO_CONTEXTMENU
|
||||
QMenu *menu = edit.createStandardContextMenu();
|
||||
for (int i = 0; i < menu->actions().count(); ++i) {
|
||||
QAction *current = menu->actions().at(i);
|
||||
@ -2251,6 +2252,7 @@ void tst_QLineEdit::deleteSelectedText()
|
||||
QVERIFY(edit.text().isEmpty());
|
||||
}
|
||||
}
|
||||
#endif // QT_NO_CONTEXTMENU
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user