Connect Event to an HandlerFunction



  • 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



  • 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



  • 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'

  • Moderators

    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.


Log in to reply
 

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