Hi guys, I have a question. I'm making a widget (let's call it myWidget) which inherits from QWidget and my window widget (the top one in the parent hierarchy) is a MainWindow (made by me) which inherits from QMainWindow. The question is, why something like this doesn't work ?
...
public:
...
};
// a slot I made
void myslot() {
...
MainWindow* p = static_cast<MainWindow*>(window());
...
}
class myWidget : public QWidget {
...
public:
myWidget(QWidget* parent =0) {}
...
};
// a slot I made
void myslot() {
...
MainWindow* p = static_cast<MainWindow*>(window());
...
}
To copy to clipboard, switch view to plain text mode
The cast doesn't work, even with a dynamic_cast its the same. Why ?
Bookmarks