Brush up tst_QApplication
- Use nullptr - Fix C-style casts - Use range-based for - Use correct static invocation - Set a title on shown windows to make it possible to identify slow tests - Fix the class declarations, use override, member initializations - Use Qt 5 connection syntax; use lambdas where applicable to remove helper slots - Streamline code in some cases - Replace helper function to convert touch points by the one in QWindowSystemInterfacePrivate - Use a logging category for the debug outpt, silencing some output Change-Id: Ia46c7ad7c08f3afc8e5869ea99b66e406de97781 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This commit is contained in:
parent
d441f6bba7
commit
ef3b585ddf
@ -32,9 +32,8 @@ base::base(QWidget *parent) :
|
|||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
m_timer = new QTimer(this);
|
m_timer = new QTimer(this);
|
||||||
m_modalStarted = false;
|
|
||||||
m_timer->setSingleShot(false);
|
m_timer->setSingleShot(false);
|
||||||
connect(m_timer, SIGNAL(timeout()), this, SLOT(periodicTimer()));
|
connect(m_timer, &QTimer::timeout, this, &base::periodicTimer);
|
||||||
m_timer->start(5000);
|
m_timer->start(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,6 +42,7 @@ void base::periodicTimer()
|
|||||||
if(m_modalStarted)
|
if(m_modalStarted)
|
||||||
exit(0);
|
exit(0);
|
||||||
m_modalDialog = new QDialog(this);
|
m_modalDialog = new QDialog(this);
|
||||||
|
m_modalDialog->setWindowTitle(QLatin1String("modal"));
|
||||||
m_modalDialog->setModal(true);
|
m_modalDialog->setModal(true);
|
||||||
m_modalDialog->show();
|
m_modalDialog->show();
|
||||||
m_modalStarted = true;
|
m_modalStarted = true;
|
||||||
|
@ -37,12 +37,10 @@ class base : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
QTimer *m_timer;
|
QTimer *m_timer;
|
||||||
bool m_modalStarted;
|
bool m_modalStarted = false;
|
||||||
QDialog *m_modalDialog;
|
QDialog *m_modalDialog = nullptr;
|
||||||
public:
|
public:
|
||||||
explicit base(QWidget *parent = 0);
|
explicit base(QWidget *parent = nullptr);
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void periodicTimer();
|
void periodicTimer();
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QtGui>
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include "base.h"
|
#include "base.h"
|
||||||
|
|
||||||
@ -35,7 +33,6 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
QApplication::setAttribute(Qt::AA_NativeWindows); //QTBUG-15774
|
QApplication::setAttribute(Qt::AA_NativeWindows); //QTBUG-15774
|
||||||
base *b = new base();
|
base b;
|
||||||
Q_UNUSED(b);
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user