diff options
Diffstat (limited to 'src/designer/src/lib/shared/newformwidget.cpp')
-rw-r--r-- | src/designer/src/lib/shared/newformwidget.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/designer/src/lib/shared/newformwidget.cpp b/src/designer/src/lib/shared/newformwidget.cpp index b3853ae21..67e08c475 100644 --- a/src/designer/src/lib/shared/newformwidget.cpp +++ b/src/designer/src/lib/shared/newformwidget.cpp @@ -129,8 +129,6 @@ NewFormWidget::NewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent m_currentItem(nullptr), m_acceptedItem(nullptr) { - using DeviceProfileList = QList<qdesigner_internal::DeviceProfile>; - m_ui->setupUi(this); m_ui->treeWidget->setItemDelegate(new qdesigner_internal::SheetDelegate(m_ui->treeWidget, this)); m_ui->treeWidget->header()->hide(); @@ -181,14 +179,13 @@ NewFormWidget::NewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent m_deviceProfiles = settings.deviceProfiles(); m_ui->profileComboBox->addItem(tr("None")); connect(m_ui->profileComboBox, - QOverload<int>::of(&QComboBox::currentIndexChanged), + QOverload<int, const QString &>::of(&QComboBox::currentIndexChanged), this, &NewFormWidget::slotDeviceProfileIndexChanged); - if (m_deviceProfiles.empty()) { + if (m_deviceProfiles.isEmpty()) { m_ui->profileComboBox->setEnabled(false); } else { - const DeviceProfileList::const_iterator dcend = m_deviceProfiles.constEnd(); - for (DeviceProfileList::const_iterator it = m_deviceProfiles.constBegin(); it != dcend; ++it) - m_ui->profileComboBox->addItem(it->name()); + for (const auto &deviceProfile : qAsConst(m_deviceProfiles)) + m_ui->profileComboBox->addItem(deviceProfile.name()); const int ci = settings.currentDeviceProfileIndex(); if (ci >= 0) m_ui->profileComboBox->setCurrentIndex(ci + profileComboIndexOffset); @@ -446,7 +443,7 @@ void NewFormWidget::loadFrom(const QString &path, bool resourceFile, const QStri void NewFormWidget::loadFrom(const QString &title, const QStringList &nameList, const QString &selectedItem, QTreeWidgetItem *&selectedItemFound) { - if (nameList.empty()) + if (nameList.isEmpty()) return; QTreeWidgetItem *root = new QTreeWidgetItem(m_ui->treeWidget); root->setFlags(root->flags() & ~Qt::ItemIsSelectable); |