Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can i have a custom slot at Qt designer, Signals & Slot Editor?

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 4.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Leon
        wrote on last edited by
        #3

        [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 ;)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved