Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
i will try to make it very simple
i have 2 classes:
this is the class_1.ui
the tab element is promoted to second class "tab_content"
the tab_content.ui have a QPushButton named title_pb
when the button clicked the tab in class_1 must change to ui->title_pb->text() in the tab_content
how to do that ?
Not sure what you mean, but...
One approach would be to create custom signal in your tab_content class, and emit it when a button is pressed.
In your class_1 you can just connect to the custom signal and forward it to a method for changing the title.
Check "signals & slots":http://qt-project.org/doc/qt-5/signalsandslots.html in Qt documentation.
arsinte_andrei last edited by
as already advised using signal and slots and as far as I can see because you are using creator and designer, than you can right click on the button and then <go to Slot> followed by <clicked()> and there you can create your code to @ui->title_pb->setText("<what ever you whant here>") @
thank you i get it :
in the tab_content.h :
void change_title(QString title);
void change_tab_name(QString title);
void class_1::change_tab_name(QString title)
and the contructor :
connect(ui->tab, SIGNAL(change_title(QString)), this, SLOT(change_tab_name(QString)));
Exactly. Don't forget to mark this thread Solved
how to do that :p
Just edit your original post, and in the front of your title add "[SOLVED]"
ok tnx :)