I am programming a GUI with Qt Creator (Qt5.10) under OSX. I have a QMainWindow
for the main app's window. Inside this I have a QTab
widget, in which I have entire widget (let's call it CaptureTabWidget
which contains some additional widgets AND a QFrame
(the parent of this QFrame
is the QTab
). In this last widget I will be drawing some stuff. The point is that I would like to write in the statusBar
of the QMainWindow
some values related to the position of the mouse in that QFrame
, but I do not have any idea about how to access the main window from a method inside the CaptureTabWidget
which contains the QFrame
.
The whole picture goes like this:
X
+-----------+ XXX
|MainWindow | XXXXXXXXX
+-----+-----+ XXX XXXXXX
| X XXX
+-----v------------+ XX
|QTabWidget | XX
|No parent | XX
+-----+------------+ XX
| X
+-----v-------------+ ?? X
|CaptureTabQWidget | X
|Parent:QTabWidget | X
+-----+-------------+ X
| X
+-----v-------------+ XX
|QFrame | XXXXXX
|Parent:CaptureTab | XXX
+-------------------+
I have tried modifying the CaptureTabWidget's constructor in order to receive a QMainWindow*
which points to the main window, but it seems Qt Creator doesn't allow custom constructors when promoting widgets in the Designer. I am wondering what is the right way to do this.