Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

Access MainWindow from different class

$
0
0
I do have the following classes: #include <QApplication> #include <QComboBox> #include "mainwindow.h" MainWindow *w; int main(int argc, char *argv[]) {     QApplication a(argc, argv);     MainWindow w;     w.show();         return a.exec(); } and #include "mainwindow.h"   MainWindow::MainWindow() {     wtr = new WindowTitleReader();     this->setWindowTitle("Selected Window Title Demo"); }   MainWindow::~MainWindow() {   } In WindowTitleReader i would like to add a QComboBox to MainWindow. I tried this Code:     MainWindow * win = (MainWindow *) QApplication::activeWindow();     QComboBox * combo = new QComboBox(win); But it doesn’t add my QComboBox to MainWindow. Any idea?

Viewing all articles
Browse latest Browse all 18427

Trending Articles