]> sigrok.org Git - pulseview.git/commitdiff
Replace deprecated qVariantFromValue
authorSoeren Apel <redacted>
Sun, 3 May 2020 15:10:20 +0000 (17:10 +0200)
committerUwe Hermann <redacted>
Sun, 3 May 2020 15:20:55 +0000 (17:20 +0200)
pv/dialogs/connect.cpp
pv/prop/enum.cpp
pv/toolbars/mainbar.cpp
pv/views/decoder_binary/view.cpp
pv/views/tabular_decoder/view.cpp
pv/views/trace/decodetrace.cpp
pv/widgets/decodermenu.cpp
pv/widgets/devicetoolbutton.cpp
pv/widgets/exportmenu.cpp
pv/widgets/importmenu.cpp
pv/widgets/sweeptimingwidget.cpp

index d238d681097bc5fcfd87c2351e87949f09dc16de..be418df29cc24ddac4ab050855ab168dbb30f59e 100644 (file)
@@ -188,7 +188,7 @@ void Connect::populate_drivers()
                if (supported_device)
                        drivers_.addItem(QString("%1 (%2)").arg(
                                driver->long_name().c_str(), name.c_str()),
-                               qVariantFromValue(driver));
+                               QVariant::fromValue(driver));
        }
 }
 
@@ -276,7 +276,7 @@ void Connect::scan_pressed()
                text += QString(" with %1 channels").arg(device->device()->channels().size());
 
                QListWidgetItem *const item = new QListWidgetItem(text, &device_list_);
-               item->setData(Qt::UserRole, qVariantFromValue(device));
+               item->setData(Qt::UserRole, QVariant::fromValue(device));
                device_list_.addItem(item);
        }
 
index d62c901cf4c70d2c3848b3a3875d9d088596b794..8243f32d0a1b63512d364ef4aea227c05d0bce35 100644 (file)
@@ -153,7 +153,7 @@ QWidget* Enum::get_widget(QWidget *parent, bool auto_commit)
                selector_ = new QComboBox(parent);
                for (unsigned int i = 0; i < values_.size(); i++) {
                        const pair<Glib::VariantBase, QString> &v = values_[i];
-                       selector_->addItem(v.second, qVariantFromValue(v.first));
+                       selector_->addItem(v.second, QVariant::fromValue(v.first));
                }
 
                update_widget();
index a7998b4046511077502a4971bdfa7bc55d3e21d0..18790f54e4bd750be12f02fad722f23cb323672f 100644 (file)
@@ -175,7 +175,7 @@ MainBar::MainBar(Session &session, QWidget *parent, pv::views::trace::View *view
 
        for (int i = 0; i < views::ViewTypeCount; i++) {
                QAction *const action = menu_new_view->addAction(tr(views::ViewTypeNames[i]));
-               action->setData(qVariantFromValue(i));
+               action->setData(QVariant::fromValue(i));
        }
 
        new_view_button_->setMenu(menu_new_view);
index 94e9cc673004e75e52195e79a3f980a7af6f37dd..b5daaf0f84ef472dd7586cb9ab423a13cec6f156 100644 (file)
@@ -90,7 +90,7 @@ View::View(Session &session, bool is_main_view, QMainWindow *parent) :
        toolbar->addWidget(save_button_);
 
        // Add format types
-       format_selector_->addItem(tr("Hexdump"), qVariantFromValue(QString("text/hexdump")));
+       format_selector_->addItem(tr("Hexdump"), QVariant(QString("text/hexdump")));
 
        // Add widget stack
        root_layout->addWidget(stacked_widget_);
@@ -120,7 +120,7 @@ View::View(Session &session, bool is_main_view, QMainWindow *parent) :
 
        for (int i = 0; i < SaveTypeCount; i++) {
                QAction *const action = save_menu->addAction(tr(SaveTypeNames[i]));
-               action->setData(qVariantFromValue(i));
+               action->setData(QVariant::fromValue(i));
        }
 
        save_button_->setMenu(save_menu);
index 3f1c3939c946c7bef1d69ba484e1ae6329208df6..2283d68ce780d0300f9d4b3a05464ff88f2089b8 100644 (file)
@@ -146,7 +146,7 @@ View::View(Session &session, bool is_main_view, QMainWindow *parent) :
 
        for (int i = 0; i < SaveTypeCount; i++) {
                QAction *const action = save_menu->addAction(tr(SaveTypeNames[i]));
-               action->setData(qVariantFromValue(i));
+               action->setData(QVariant::fromValue(i));
        }
 
        save_button_->setMenu(save_menu);
index 52ba83d64ddb94a4063bd46d5973d22591fd67f5..0b09439bb8bb4e28976b30102995aa5e60607d8d 100644 (file)
@@ -1142,7 +1142,7 @@ QComboBox* DecodeTrace::create_channel_selector(QWidget *parent, const DecodeCha
 
        QComboBox *selector = new QComboBox(parent);
 
-       selector->addItem("-", qVariantFromValue((void*)nullptr));
+       selector->addItem("-", QVariant::fromValue((void*)nullptr));
 
        if (!ch->assigned_signal)
                selector->setCurrentIndex(0);
@@ -1151,7 +1151,7 @@ QComboBox* DecodeTrace::create_channel_selector(QWidget *parent, const DecodeCha
                assert(b);
                if (b->logic_data() && b->enabled()) {
                        selector->addItem(b->name(),
-                               qVariantFromValue((void*)b.get()));
+                               QVariant::fromValue((void*)b.get()));
 
                        if (ch->assigned_signal == b.get())
                                selector->setCurrentIndex(selector->count() - 1);
@@ -1166,9 +1166,9 @@ QComboBox* DecodeTrace::create_channel_selector_init_state(QWidget *parent,
 {
        QComboBox *selector = new QComboBox(parent);
 
-       selector->addItem("0", qVariantFromValue((int)SRD_INITIAL_PIN_LOW));
-       selector->addItem("1", qVariantFromValue((int)SRD_INITIAL_PIN_HIGH));
-       selector->addItem("X", qVariantFromValue((int)SRD_INITIAL_PIN_SAME_AS_SAMPLE0));
+       selector->addItem("0", QVariant::fromValue((int)SRD_INITIAL_PIN_LOW));
+       selector->addItem("1", QVariant::fromValue((int)SRD_INITIAL_PIN_HIGH));
+       selector->addItem("X", QVariant::fromValue((int)SRD_INITIAL_PIN_SAME_AS_SAMPLE0));
 
        selector->setCurrentIndex(ch->initial_pin_state);
 
index 505a1f67e9e4179c756f2ae33f148cf793686738..34f4852c9edf4f0381fe661efe273b6debe2685e 100644 (file)
@@ -51,7 +51,7 @@ DecoderMenu::DecoderMenu(QWidget *parent, const char* input, bool first_level_de
                }
 
                QAction *const action = addAction(QString::fromUtf8(d->name));
-               action->setData(qVariantFromValue(l->data));
+               action->setData(QVariant::fromValue(l->data));
                mapper_.setMapping(action, action);
                connect(action, SIGNAL(triggered()), &mapper_, SLOT(map()));
        }
index 6a12aa25c446904651b60bfe6de58e13d27eaa12..d700b8b57cc0bdf471452ab6a8806e787c63f19c 100644 (file)
@@ -100,7 +100,7 @@ void DeviceToolButton::update_device_list()
                        dev->display_name(device_manager_)), this);
                a->setCheckable(true);
                a->setChecked(selected_device_ == dev);
-               a->setData(qVariantFromValue((void*)dev.get()));
+               a->setData(QVariant::fromValue((void*)dev.get()));
                a->setToolTip(QString::fromStdString(dev->full_name()));
                mapper_.setMapping(a, a);
 
index ff82b6aa2b13e206fba69e94dc5cf9fca3a4ed76..f5189d129fe02ad422750bb68233c18f38ca0f34 100644 (file)
@@ -70,7 +70,7 @@ ExportMenu::ExportMenu(QWidget *parent, shared_ptr<Context> context,
                assert(f.second);
                QAction *const action = addAction(tr("Export %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()));
        }
index e3034249769e66c73041b37af30fcab6f0ec1392..f827d35bff3935e69a4f453c04c12e4d78058898 100644 (file)
@@ -67,7 +67,7 @@ ImportMenu::ImportMenu(QWidget *parent, shared_ptr<Context> context,
                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()));
        }
index 12f5969eb707c9997c212e1d39f838541c1f5588..e655526c0b3f7a1a12fabb5af0c9e2383177488d 100644 (file)
@@ -95,7 +95,7 @@ void SweepTimingWidget::show_list(const uint64_t *vals, size_t count)
        list_.clear();
        for (size_t i = 0; i < count; i++) {
                char *const s = sr_si_string_u64(vals[i], suffix_);
-               list_.addItem(QString::fromUtf8(s), qVariantFromValue(vals[i]));
+               list_.addItem(QString::fromUtf8(s), QVariant::fromValue(vals[i]));
                g_free(s);
        }