PDA

View Full Version : There is no event(Signal) after using insertWidget() method on stackedWidget



erichong81
26th March 2010, 01:38
hi there!
when i have made a application with imagebutton which come from Qpushbutton.

and I have just made stackedWidget in QtDesigner.
and i put my button widget in editor. like this...


QPixmap *sImg1 = new QPixmap("images/go_contact.png");
QPixmap *sImg2 = new QPixmap("images/go_contact_press.png");
QString *startTitle = new QString("Start");
startBtn = new CImageButton(startTitle, this);
startBtn->setGeometry((width()-373)/2, 200, 373, 71);
startBtn->setImage(sImg1, sImg2);
ui.stackedWidget->insertWidget(0, startBtn);
startBtn->show();
connect(startBtn, SIGNAL(clicked()), this, SLOT(clicked_start_btn())


nomally most widget is show state in QtDesigner.
the button is my own button so i realized that i need show() method to draw button on screen.
so that i can see the button.. but the button doesn't work.. no event.... what happen~~~

please give me a hint as soon as possible.. thank you!

wysota
26th March 2010, 08:36
Did you change the current index of the stacked widget to the one that represents the page holding the button?

erichong81
29th March 2010, 02:30
Did you change the current index of the stacked widget to the one that represents the page holding the button?

sure! i have used curentIndex(0) for stackedWidget in initiate method

wysota
29th March 2010, 09:18
In that case I don't know what you want... Please try to focus at one thing at a time and describe what you would like to get and what the current result is. insertWidget() doesn't emit any signals so obviously there are none emitted.