Unsolved Clicked signal not emitted
-
@jay1 yup, it is
[...] private slots: void createDocument(); [...]
-
@dual
Hi
The name seems a bit odd Ui_MainWindow.
You are not editing the auto-generated file ?class Ui_MainWindow { public: QWidget *centralwidget; ..... void setupUi(QMainWindow *MainWindow) {
This one ?
it has this warning in top
maybe you must expand it.I would assume
void Ui_MainWindow::createDocument(){
qDebug()<<"i'm here";
}should be
void MainWindow::createDocument(){
qDebug()<<"i'm here";
} -
@mrjj yes I'm using the auto-generated file but I deleted from my project the .ui file in order to avoid the problem in the top comment.
I paste here the class declaration:class Ui_MainWindow : public QMainWindow { Q_OBJECT private: [...] QWidget *centralwidget; QWidget *verticalLayoutWidget; QVBoxLayout *verticalLayout; [...]
Btw emitting the "clicked" signal in code, the slot triggers.
-
Hi,
Do not edit the auto-generated file. It even has a warning on top saying so.
You have to edit the other on that makes use of that generated class.
-
@SGaist hi, thanks for the reply.
Can you explain better this concept? I've previously modified the auto-generated file with other stuff, but the only thing that doesn't work is the pushButton, the remaining stuff works well.Sorry for these silly questions, but I am a newbie in qt.
-
The most simple is to take a look at the Qt Designer Calculator Form Example.
-
@SGaist thank you again. So my last question is: how can I modify the gui obtained with the auto-generated file in a "legal" way? Is it possible in code or should I draw the .ui file and auto-generate the .h file again? And again, let's suppose I have to modify an auto-gen .h file in some way after some time, how can I do?
-
What modifications do you have in mind ?
Again, this is a generated file so do not even store in your version control system. It's created based on the .ui file and will be regenerated when that file is modified. -
@SGaist I need to change the displayed object dynamically: I have a scroll area, a grid layout and some labels in it, but the number of labels is not fixed and may change over time. How can I manage this problem?
-
@dual In your main window (MainWindow class or whatever name you gave it not Ui_MainWindow) you can access your UI widgets/layouts via ui->WIDGET_NAME.