0

I have a qt designer ui form, which has a qwidget at the bottom of the form. The qwidget has a promoted widget.

The promoted widget has a number of labels and buttons. One of the buttons is a home button. On clicking this button the user needs to close the form and open the home form.

If i use traditional methods of implementing clicked() slot and say this->close();, only the promoted widget will be closed.

I want the entire ui to be closed and then open the Home form. How do I go about it? Is there a call to the qt designer ui form from the promoted widget to indicate that the home pushbutton is clicked?

Any help is appreciated. Thank you

gfernandes
  • 1,156
  • 3
  • 12
  • 29

1 Answers1

0

You need to add a SIGNAL to your class (let's say named close()) and then whenever the button is pressed this SIGNAL goes off and by connecting your class to this signal you can set you form to close. Here you can find a basic tutorial on SIGNALS. If you put your code in the question I could guide you through the code as well.

Vahid Nateghi
  • 576
  • 5
  • 14
  • well.. These are promoted widgets. It is a part of the ui. So the traditional emit signal and connecting in main ui slot does not work. I did try that earlier. On the button click i wrote emit this->home() and in main ui i connected the signal of this class to the slot gotoHome() where i indicated this->close(); It does not work. – gfernandes Nov 25 '13 at 13:25
  • i used the object as the base class of the promoted widget and then took the signal home() from there. This worked. Earlier I had instantiated the promoted widget class and tried to connect the emitted signal. I didnt realise the base class qwidget in the main ui form was the actual object. Thank you for helping. :) – gfernandes Nov 25 '13 at 13:54
  • @DmitrySazonov The problem is solved. Should I post the solution? As in the sample code? – gfernandes Nov 25 '13 at 13:56
  • @Giz : I'm sorry I was not online to answer to your first question. No problem :) – Vahid Nateghi Nov 25 '13 at 14:08