c++ - Connection between Qt and Code in Visual Studio -


i have installed qt on visual studio 2013 , have question: how can make connection between button , code visual?. need make simple menu aplication.

i don't specifying connections in ui file using gui (where can select signal , slot , rest of work you). gui buggy. recommend calling connect method in code. example, in main window constructor or special method sets connections (and is, in turn, called constructor):

connect(ui->button, signal(clicked(void)), /* or other object */, slot(buttonclicked(void)); 

if use qt 5 , not qt 4, recommend new connection syntax. it's both easier debug (you're compile-time error instead of runtime error if connection can't made), and, suspect, might result in faster / smaller code:

connect(ui->button, &qpushbutton::clicked, /* or other object */, &cmainwindow::buttonclicked); 

the latter method has additional benefit of autocompletion working in visual studio , not in qt creator.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -