]> sigrok.org Git - pulseview.git/blobdiff - pv/widgets/importmenu.cpp
Session: Fix issue #67 by improving error handling
[pulseview.git] / pv / widgets / importmenu.cpp
index e3034249769e66c73041b37af30fcab6f0ec1392..dcca307ecc731bb01e6946fd9f38d4c0ec17f4ac 100644 (file)
@@ -63,17 +63,22 @@ ImportMenu::ImportMenu(QWidget *parent, shared_ptr<Context> context,
        const map<string, shared_ptr<InputFormat> > formats =
                context->input_formats();
 
-       for (const pair<string, shared_ptr<InputFormat> > &f : formats) {
+       for (const pair<const string, shared_ptr<InputFormat> > &f : formats) {
                assert(f.second);
                QAction *const action = addAction(tr("Import %1...")
                        .arg(QString::fromStdString(f.second->description())));
-               action->setData(qVariantFromValue((void*)f.second.get()));
+               action->setData(QVariant::fromValue((void*)f.second.get()));
                mapper_.setMapping(action, action);
                connect(action, SIGNAL(triggered()), &mapper_, SLOT(map()));
        }
 
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+       connect(&mapper_, SIGNAL(mappedObject(QObject*)),
+               this, SLOT(on_action(QObject*)));
+#else
        connect(&mapper_, SIGNAL(mapped(QObject*)),
                this, SLOT(on_action(QObject*)));
+#endif
 }
 
 void ImportMenu::on_action(QObject *action)