Let's get started by following these steps:
- Let's create a Qt Widgets Application project and open up mainwindow.cpp. After that, add the following headers to the top of the source code:
#include <QPushButton>#include <QGridLayout>#include <QMessageBox>#include <QTime>#include <QDebug>
- Create a QGridLayout object and set its parent as centralWidget:
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ ui->setupUi(this); QGridLayout *layout = new QGridLayout(ui->centralWidget);
- Create a QTime object. We will be using this to measure the performance of our next operation:
QTime* time = new QTime;time->start();
- We will use two loops to fill in 600 push buttons to our grid layout and connect ...