summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/xmlpatterns/recipes/querymainwindow.cpp17
-rw-r--r--examples/xmlpatterns/recipes/querymainwindow.h2
-rw-r--r--examples/xmlpatterns/shared/xmlsyntaxhighlighter.h2
3 files changed, 11 insertions, 10 deletions
diff --git a/examples/xmlpatterns/recipes/querymainwindow.cpp b/examples/xmlpatterns/recipes/querymainwindow.cpp
index 9a543d5..f24185b 100644
--- a/examples/xmlpatterns/recipes/querymainwindow.cpp
+++ b/examples/xmlpatterns/recipes/querymainwindow.cpp
@@ -38,15 +38,15 @@
**
****************************************************************************/
-#include <QMessageBox>
-#include <QFileDialog>
+#include <QtWidgets/QMessageBox>
+#include <QtWidgets/QFileDialog>
#include <QtXmlPatterns>
#include "querymainwindow.h"
#include "xmlsyntaxhighlighter.h"
//! [0]
-QueryMainWindow::QueryMainWindow() : ui_defaultQueries(0)
+QueryMainWindow::QueryMainWindow()
{
setupUi(this);
@@ -55,14 +55,15 @@ QueryMainWindow::QueryMainWindow() : ui_defaultQueries(0)
ui_defaultQueries = findChild<QComboBox*>("defaultQueries");
QMetaObject::connectSlotsByName(this);
- connect(ui_defaultQueries, SIGNAL(currentIndexChanged(int)), SLOT(displayQuery(int)));
+
+ connect(ui_defaultQueries, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &QueryMainWindow::displayQuery);
loadInputFile();
const QStringList queries(QDir(":/files/", "*.xq").entryList());
- int len = queries.count();
- for(int i = 0; i < len; ++i)
- ui_defaultQueries->addItem(queries.at(i));
- if (len > 0)
+ for (const auto &query : queries)
+ ui_defaultQueries->addItem(query);
+ if (queries.count() > 0)
displayQuery(0);
}
//! [0]
diff --git a/examples/xmlpatterns/recipes/querymainwindow.h b/examples/xmlpatterns/recipes/querymainwindow.h
index 25ffaab..7961d88 100644
--- a/examples/xmlpatterns/recipes/querymainwindow.h
+++ b/examples/xmlpatterns/recipes/querymainwindow.h
@@ -62,7 +62,7 @@ public slots:
void displayQuery(int index);
private:
- QComboBox* ui_defaultQueries;
+ QComboBox *ui_defaultQueries = nullptr;
void evaluate(const QString &str);
void loadInputFile();
diff --git a/examples/xmlpatterns/shared/xmlsyntaxhighlighter.h b/examples/xmlpatterns/shared/xmlsyntaxhighlighter.h
index 7a104d5..bdd379c 100644
--- a/examples/xmlpatterns/shared/xmlsyntaxhighlighter.h
+++ b/examples/xmlpatterns/shared/xmlsyntaxhighlighter.h
@@ -47,7 +47,7 @@
class XmlSyntaxHighlighter : public QSyntaxHighlighter
{
public:
- XmlSyntaxHighlighter(QTextDocument *parent = 0);
+ explicit XmlSyntaxHighlighter(QTextDocument *parent = nullptr);
protected:
virtual void highlightBlock(const QString &text);