Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
how to pass ui::windows as parameter.
rafael last edited by rafael
i have multiple windows created from ui_designer.
window 1 for example is ui::window1 *ui
and window 2 is ui::window2 *ui
i want to update labels items located on the status bar for each indiviual ui.
i created a class that has common code for all ui.
is there a generic paremeter which i can pass to the function to make it take any ui or i just have to override each function to take a different window.
ie ui::window1 *ui
footer( **** ui ****)
QPixmap cimage = QPixmap(":/images/OnOff.png");
each window inherits from the common class qobject.
class Mainwindow : public QMainWindow, public common
commonis a base class then it makes no sense that it would know about members of derived classes (the
uimember). The type of that member is different for each derived class and they don't have a common base class so you can't get a "universal" pointer to it (apart from void* which you should definitely not do).
One way to arrange this is make a pure virtual method in
commonthat will return a button pointer i.e.
virtual QPushButton* closeButton() = 0. then, in each derived class implement that method to return the button from its ui member. In your
commonclass access the button via