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:
Friedemann Kleint 2019-05-10 11:08:11 +02:00
parent d441f6bba7
commit ef3b585ddf
4 changed files with 330 additions and 370 deletions

View File

@ -32,9 +32,8 @@ base::base(QWidget *parent) :
QWidget(parent)
{
m_timer = new QTimer(this);
m_modalStarted = 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);
}
@ -43,6 +42,7 @@ void base::periodicTimer()
if(m_modalStarted)
exit(0);
m_modalDialog = new QDialog(this);
m_modalDialog->setWindowTitle(QLatin1String("modal"));
m_modalDialog->setModal(true);
m_modalDialog->show();
m_modalStarted = true;

View File

@ -37,12 +37,10 @@ class base : public QWidget
{
Q_OBJECT
QTimer *m_timer;
bool m_modalStarted;
QDialog *m_modalDialog;
bool m_modalStarted = false;
QDialog *m_modalDialog = nullptr;
public:
explicit base(QWidget *parent = 0);
signals:
explicit base(QWidget *parent = nullptr);
public slots:
void periodicTimer();

View File

@ -26,8 +26,6 @@
**
****************************************************************************/
#include <QtGui>
#include <QApplication>
#include "base.h"
@ -35,7 +33,6 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QApplication::setAttribute(Qt::AA_NativeWindows); //QTBUG-15774
base *b = new base();
Q_UNUSED(b);
base b;
return app.exec();
}

File diff suppressed because it is too large Load Diff