I have been trying to run the code. It runs successfully but and I can see the popup window but it doesn't show anything. You can see the popup image below.
And you can see my code below:
This is the Header file
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QWidget>
#include <QSpinBox>
#include <QSlider>
#include <QDial>
#include <QProgressBar>
class MainWindow : public QMainWindow
{
Q_OBJECT
private:
QSpinBox *spinbox;
QSlider *slider1;
QDial *dial;
QProgressBar *progressbar;
public:
MainWindow();
//~MainWindow();
};
#endif // MAINWINDOW_H
This is the MainWindow file
#include "mainwindow.h"
#include <QVBoxLayout>
#include <QGridLayout>
MainWindow::MainWindow()
{
spinbox = new QSpinBox;
slider1 = new QSlider(Qt::Horizontal);
dial = new QDial;
progressbar = new QProgressBar;
QVBoxLayout *lay1 = new QVBoxLayout(this);
//QGridLayout *lay1 = new QGridLayout(this);
lay1 -> addWidget(spinbox);
lay1 -> addWidget(slider1);
lay1 -> addWidget(dial);
lay1 -> addWidget(progressbar);
setLayout(lay1);
}
This is the Main file
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}