Thanks, aamer4yu, but this is what is not working.
Let's assume I have the ui file: myproj.ui which generates ui_myproj.h (and is based on the QWidget class, called Cw).
In myproj.h I have:
#include ui_myproj.h
private:
Ui::Cw uicw;
#include ui_myproj.h
private:
Ui::Cw uicw;
QWidget wCw;
To copy to clipboard, switch view to plain text mode
In myproj.cpp, in the constructor, I do (myproj is a QMainWindow):
uicw.setupUi( &wCw);
setCentralWidget(uicw );
uicw.setupUi( &wCw);
setCentralWidget(uicw );
To copy to clipboard, switch view to plain text mode
Then I get:
error: no matching function for call to 'Myproj::setCentralWidget(Ui::Cw&)'
note: candidates are: void QMainWindow::setCentralWidget(QWidget*)
It wants a pointer, not a reference ? I assume I need a pointer to uicw or wCw (the widget), but I don't know how to get it.
***** Update:
Good that we talked about it... the following code works, not sure whether it is 'good', but it works:
In myproj.h I have:
#include ui_myproj.h
private:
Ui::Cw uicw;
#include ui_myproj.h
private:
Ui::Cw uicw;
QWidget wCw;
To copy to clipboard, switch view to plain text mode
In myproj.cpp, in the constructor, I do (myproj is a QMainWindow):
uicw.setupUi( &wCw);
QWidget * wCw2
= &wCw;
// creating the pointer setCentralWidget( wCw2 );
uicw.setupUi( &wCw);
QWidget * wCw2 = &wCw; // creating the pointer
setCentralWidget( wCw2 );
To copy to clipboard, switch view to plain text mode
This finally sets the ui QWidget as central widget.
Bookmarks