[Moved] Extending the Shape-Changing Dialog
I am a newbie to Qt and I'm trying to extend the Shape-Changing Dialog (Chapter 2, fig 2.11, Blanchette & Summerfield) example as suggested at the end of the section by calling setText() but have encountered some problems.
Following the example this is what I did in addition:
Called 'moreButton->setText(tr("Advanced"));' in the constructor. The button changes text from 'More' to 'Advanced' as expected.
Created the SLOT 'void Sort::on_moreButton_toggled(bool toggled)' thinking that if I test the bool within the method I can change the text accordingly.
However the SLOT never gets called! I have tried SLOTS 'void Sort::on_moreButton_toggled()' and 'void Sort::on_moreButton_clicked()' but neither are invoked!
I didn't specify the connect() call for these expecting them to be automatically setup. However, I added them to see if this was the problem but got the same results, i.e. the SLOTs are not invoked.
I even tried breaking the connection in QtDesigner between the moreButton and secondary & tertiary SLOTs setVisible(bool) and manually setting them, but to no avail.
I have looked at the example "Expandable dialog example":http://doc.trolltech.com/4.7/dialogs-extension.html but this is not what I want as I want Qt to automatically set this up.
Can someone suggest how to get this working and what I am doing wrong? Also, what is the term used to described the automatic creation and setup of signals to slots?
"I even tried breaking the connection in QtDesigner between the moreButton and secondary & tertiary SLOTs setVisible(bool) and manually setting them, but to no avail."
Just to make it clear. I had done the following that works:
connect(moreButton, SIGNAL(toggled(bool)), secondaryGroupBox, SLOT(setVisible(bool)));
But the automatic connections still didn't work! I.e. 'on_moreButton_toggled(bool toggled)'.
[EDIT: code formatting, please use @-tags, Volker]
Have you connected in the Qt Designer your new slot with the button clicked signal (as it is described for the in the same chapter in the book you mentioned)?
Yes and they all work as the example describes.
I simply want to extend the More button to be renamed to Advanced, and each time it is pressed have the 'on_moreButton_toggled(bool toggled)’ SLOT invoked.
I define it but do not connect it as this should be done automatically. It is never called! Even if I do manually connect it, it still isn't called!
Maybe you could try the example and see if you can get it to work :) I am not sure what I'm doing wrong.
yeah i had the same problem but realized that i should have removed the
private var ui for the program to run