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. Connect Event to an HandlerFunction
Forum Updated to NodeBB v4.3 + New Features

Connect Event to an HandlerFunction

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.5k 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.
  • D Offline
    D Offline
    Danilo87
    wrote on last edited by
    #1

    Hi Guys,
    i've got a problem that is driving me crazy.
    I'm using the method 'sendEvent' to the MainWindow and when a new event is sent i have to connect it to a related Function. In the constructor of the MainWIndows i must to connect the received event using the command:

    connect(QObject* sender, *signal, *member, *MyFunction)

    How can i fill the 1° and the 2° field of the function?

    Thanks

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SetBetterPass
      wrote on last edited by
      #2

      that's simple for example if you have some button it can look like:

      @connect(ui->someNiceButton,SIGNAL(clicked()),this,SLOT(yourSlot()));@

      after someone clicks button someNiceButton (of course you have to create it first) it will perform action from slot yourSlot()

      and do not forget add yourSlot() to slots in your header file

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Danilo87
        wrote on last edited by
        #3

        Thanks, but my problem is a little bit different:

        • i have not a button to click, but i have to 'catch' an event sent using the function 'sendEvent'
        1 Reply Last reply
        0
        • T Offline
          T Offline
          tobias.hunger
          wrote on last edited by
          #4

          Signals and slots are not events.

          Implement one of the virtual *Event methods on the widget to work with events.

          There is a certain likelihood that you are doing something wrong here, especially if you have a strong windows-background. Windows uses events a lot where signals and slots make way more sense in Qt.

          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