Where does the code for a new slot created using QT designer go? -


i total newbie qt.

i working qt 4.7.1 on visual studio 2008.

i trying implement button covered image, , when pressed, image changes. (image-button) trying use qt designer put button in currect layout programmatically handle pressed event (..signal..) change icon on button.

create new mainwindow. put tool button in it. switch slots&signals mode. created signal-slot button pressed() new slot1() on window. put code of slot1()?

sry english. rly bad, i'll try you.

you have use inheritance approach. so:
• created form, added connection slot1() on form.
• include form in project, compile it. file named ui_formname.h generated. @ bottom of file find code like:
namespace ui {
class mainwindow: public ui_mainwindow {};
} // namespace ui

you have to:
1) create new class, inherit class qmainwindow.
2) in header include generated h-file, add member of type ui::mainwindow, declared in generated .h-file (e.g.: ui::mainwindow* m_puitmp; ).
3) add code:
public slots: // or private slots:, or protected slots: ... whatever.
void slot1();

then create implementation functions in new class. don't forget add m_puitmp->setupui( ); in constructor, , create implementation slot1() slot.

you can describe slots , signals in derived class, , connect them signals , slots in qtdesigner. when adding slot or signal in designer, rename them in accordance names, set in code.

hope you. if can't solve problem, write me message. i'll try help.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -