Can i have a custom slot at Qt designer, Signals & Slot Editor?



  • For example when i push a button i want a stacked_widget to change it's currend index to 1.
    Instead of doing it via "Go to slot" i would like to try and hide some useless code from my cpp thus i am trying to make this possible by the designer

    So i right clicked at mainwindow, went at Change Signals & slots and added my own slot like this:
    !http://i.imgur.com/Ea0y8k5.png(1)!

    But i still cannot see it at the Signals & Slot Editor..
    !http://i.imgur.com/kQQ64gI.png(2)!

    I only see some basic slots like hide, show etc



  • You can only use types within your signal and slot declarations, not values. So your '1' in there won't work. In Qt 5 with a c++/11 capable compiler, you could use a lambda function instead in a connect call, so you don't have to define the slot at all.

    Note that slots you add in Designer are not created for you. They are just some type of forward declaration. You promise Designer that you'll create a slot or a signal with the given signature, so Designer may create the code to connect to it.



  • [quote author="Andre" date="1371217755"]You can only use types within your signal and slot declarations, not values. So your '1' in there won't work. In Qt 5 with a c++/11 capable compiler, you could use a lambda function instead in a connect call, so you don't have to define the slot at all.

    Note that slots you add in Designer are not created for you. They are just some type of forward declaration. You promise Designer that you'll create a slot or a signal with the given signature, so Designer may create the code to connect to it. [/quote]

    I thought programming languages were stable. Didn't know that c++11 existed and i just found out the book that i have bought 4 years ago is c++98.

    Well i will buy a c++11 book and start reading it. I will answer to this trhead in about 2-3 months.

    Thanks andre ;)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.