summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp')
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
index b4985df8d4..54663ba3a3 100644
--- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
@@ -319,10 +319,11 @@ void tst_QFileDialog2::emptyUncPath()
}
#if !defined(QT_NO_CONTEXTMENU) && !defined(QT_NO_MENU)
-struct MenuCloser {
+struct MenuCloser : public QObject {
QWidget *w;
explicit MenuCloser(QWidget *w) : w(w) {}
- void operator()() const
+
+ void close()
{
QMenu *menu = qFindChild<QMenu*>(w);
if (!menu) {
@@ -342,7 +343,8 @@ static bool openContextMenu(QFileDialog &fd)
QTimer timer;
timer.setInterval(300);
timer.setSingleShot(true);
- QObject::connect(&timer, &QTimer::timeout, MenuCloser(&fd));
+ MenuCloser closer(&fd);
+ QObject::connect(&timer, &QTimer::timeout, &closer, &MenuCloser::close);
timer.start();
QContextMenuEvent cme(QContextMenuEvent::Mouse, QPoint(10, 10));
qApp->sendEvent(list->viewport(), &cme); // blocks until menu is closed again.