Mainwindow is empty without any widgets.
-
When i build and run, the mainwindow is empty without any widgets.
But i have created all the component in the mainwindow constructor.
why they never appear?
@
-----------------MainWindow constructor------------
ui->setupUi(this);
brightnessLabel= new QLabel(tr("Brightness :"));
brightnessName= new QLineEdit;
brightnessLabel->setBuddy(brightnessName);contrastLabel= new QLabel(tr("Brightness :")); contrastName= new QLineEdit; contrastLabel->setBuddy(contrastName); volumeLabel= new QLabel(tr("Brightness :")); volumeName= new QLineEdit; volumeLabel->setBuddy(volumeName); OutputsourceLabel= new QLabel(tr("Brightness :")); OutputsourceName= new QLineEdit; OutputsourceLabel->setBuddy(OutputsourceName); DownloadLabel= new QLabel(tr("Brightness :")); DownloadName= new QLineEdit; DownloadLabel->setBuddy(DownloadName); QHBoxLayout *layout =new QHBoxLayout; layout->addWidget(brightnessLabel); layout->addWidget(brightnessName);
----------------------main------------------------
QApplication a(argc, argv);
MainWindow w;
w.show();@
-
QMainWindow inherits a setlayout function.
-
Hi,
You can't change the layout of a QMainWindow. What you would do is create a main/container widget and set it as central widget.