setDefaultAction(connect_action_);
setMinimumWidth(QFontMetrics(font()).averageCharWidth() * 24);
+#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
connect(&menu_, SIGNAL(hovered(QAction*)),
this, SLOT(on_menu_hovered(QAction*)));
menu_.setDefaultAction(connect_action_);
menu_.addSeparator();
- for (weak_ptr<Device> dev_weak_ptr : devices_) {
+ for (weak_ptr<Device>& dev_weak_ptr : devices_) {
shared_ptr<Device> dev(dev_weak_ptr.lock());
if (!dev)
continue;
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);
selected_device_.reset();
Device *const dev = (Device*)((QAction*)action)->data().value<void*>();
- for (weak_ptr<Device> dev_weak_ptr : devices_) {
+ for (weak_ptr<Device>& dev_weak_ptr : devices_) {
shared_ptr<Device> dev_ptr(dev_weak_ptr);
if (dev_ptr.get() == dev) {
selected_device_ = shared_ptr<Device>(dev_ptr);