diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-11-08 13:49:49 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-11-15 16:23:21 +0100 |
commit | e8a4f4a92cfbab9fd43aea326dc5a7c88dbe390a (patch) | |
tree | 368c889fe1a1be32eea35730c7722cb6d04db8de /src/designer/src/components/formeditor/templateoptionspage.cpp | |
parent | ec4b367cc41375564b6869cea833b60484965ac9 (diff) |
Qt Designer: Fix Qt API usage
Replace:
empty() by isEmpty()
front()/back() by constFirst()/constLast(), preventing detaching
Streamline some code.
Task-number: QTBUG-79896
Change-Id: Ic3f8414db79a83a30b55369a9352f332b41aa621
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/designer/src/components/formeditor/templateoptionspage.cpp')
-rw-r--r-- | src/designer/src/components/formeditor/templateoptionspage.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/designer/src/components/formeditor/templateoptionspage.cpp b/src/designer/src/components/formeditor/templateoptionspage.cpp index b1c0dc2d4..e50260406 100644 --- a/src/designer/src/components/formeditor/templateoptionspage.cpp +++ b/src/designer/src/components/formeditor/templateoptionspage.cpp @@ -79,7 +79,7 @@ void TemplateOptionsWidget::setTemplatePaths(const QStringList &l) { // add paths and select 0 m_ui->m_templatePathListWidget->clear(); - if (l.empty()) { + if (l.isEmpty()) { // disable button templatePathSelectionChanged(); } else { @@ -98,7 +98,7 @@ void TemplateOptionsWidget::addTemplatePath() const QList<QListWidgetItem *> existing = m_ui->m_templatePathListWidget->findItems(templatePath, Qt::MatchExactly); - if (!existing.empty()) + if (!existing.isEmpty()) return; QListWidgetItem *newItem = new QListWidgetItem(templatePath); @@ -110,15 +110,15 @@ void TemplateOptionsWidget::removeTemplatePath() { const QList<QListWidgetItem *> selectedPaths = m_ui->m_templatePathListWidget->selectedItems(); - if (selectedPaths.empty()) + if (selectedPaths.isEmpty()) return; - delete selectedPaths.front(); + delete selectedPaths.constFirst(); } void TemplateOptionsWidget::templatePathSelectionChanged() { const QList<QListWidgetItem *> selectedPaths = m_ui->m_templatePathListWidget->selectedItems(); - m_ui->m_removeTemplatePathButton->setEnabled(!selectedPaths.empty()); + m_ui->m_removeTemplatePathButton->setEnabled(!selectedPaths.isEmpty()); } QString TemplateOptionsWidget::chooseTemplatePath(QDesignerFormEditorInterface *core, QWidget *parent) |