From: Soeren Apel Date: Sun, 3 May 2020 15:10:20 +0000 (+0200) Subject: Replace deprecated qVariantFromValue X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=009fc9ae42ecccd3802f549b39c19a2ba895959d;p=pulseview.git Replace deprecated qVariantFromValue --- diff --git a/pv/dialogs/connect.cpp b/pv/dialogs/connect.cpp index d238d681..be418df2 100644 --- a/pv/dialogs/connect.cpp +++ b/pv/dialogs/connect.cpp @@ -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); } diff --git a/pv/prop/enum.cpp b/pv/prop/enum.cpp index d62c901c..8243f32d 100644 --- a/pv/prop/enum.cpp +++ b/pv/prop/enum.cpp @@ -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 &v = values_[i]; - selector_->addItem(v.second, qVariantFromValue(v.first)); + selector_->addItem(v.second, QVariant::fromValue(v.first)); } update_widget(); diff --git a/pv/toolbars/mainbar.cpp b/pv/toolbars/mainbar.cpp index a7998b40..18790f54 100644 --- a/pv/toolbars/mainbar.cpp +++ b/pv/toolbars/mainbar.cpp @@ -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); diff --git a/pv/views/decoder_binary/view.cpp b/pv/views/decoder_binary/view.cpp index 94e9cc67..b5daaf0f 100644 --- a/pv/views/decoder_binary/view.cpp +++ b/pv/views/decoder_binary/view.cpp @@ -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); diff --git a/pv/views/tabular_decoder/view.cpp b/pv/views/tabular_decoder/view.cpp index 3f1c3939..2283d68c 100644 --- a/pv/views/tabular_decoder/view.cpp +++ b/pv/views/tabular_decoder/view.cpp @@ -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); diff --git a/pv/views/trace/decodetrace.cpp b/pv/views/trace/decodetrace.cpp index 52ba83d6..0b09439b 100644 --- a/pv/views/trace/decodetrace.cpp +++ b/pv/views/trace/decodetrace.cpp @@ -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); diff --git a/pv/widgets/decodermenu.cpp b/pv/widgets/decodermenu.cpp index 505a1f67..34f4852c 100644 --- a/pv/widgets/decodermenu.cpp +++ b/pv/widgets/decodermenu.cpp @@ -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())); } diff --git a/pv/widgets/devicetoolbutton.cpp b/pv/widgets/devicetoolbutton.cpp index 6a12aa25..d700b8b5 100644 --- a/pv/widgets/devicetoolbutton.cpp +++ b/pv/widgets/devicetoolbutton.cpp @@ -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); diff --git a/pv/widgets/exportmenu.cpp b/pv/widgets/exportmenu.cpp index ff82b6aa..f5189d12 100644 --- a/pv/widgets/exportmenu.cpp +++ b/pv/widgets/exportmenu.cpp @@ -70,7 +70,7 @@ ExportMenu::ExportMenu(QWidget *parent, shared_ptr 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())); } diff --git a/pv/widgets/importmenu.cpp b/pv/widgets/importmenu.cpp index e3034249..f827d35b 100644 --- a/pv/widgets/importmenu.cpp +++ b/pv/widgets/importmenu.cpp @@ -67,7 +67,7 @@ ImportMenu::ImportMenu(QWidget *parent, shared_ptr 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())); } diff --git a/pv/widgets/sweeptimingwidget.cpp b/pv/widgets/sweeptimingwidget.cpp index 12f5969e..e655526c 100644 --- a/pv/widgets/sweeptimingwidget.cpp +++ b/pv/widgets/sweeptimingwidget.cpp @@ -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); }