Qtreeview header mouse entered



  • Hello,

    i have a qtreeview, when the mouse enteres the header line, the signal of QHeaderView is not emited? Why?

    @connect(view->header(), SIGNAL(sectionClicked(int)), &_retrospectiveBackupPopup, SLOT(doHide()));@

    The slot is never called :(!



  • first of all, when having problems with signals and slots and you have no idea where to start it is always a good idea to check if Qt really connected the signal/slot. The connect function returns a boolean value to indicate that.
    The main thing that pops-up are the arguments in your slot! The slot may never have other arguments then the signal provides! So the slot must have a int value as argument. That might do the trick. I'm also unsure if the sender can be only the header, but if the code compiles it might work.
    Hope this helps a bit, otherwise show a bit more code of your creation of the view and your slot to be called.
    Greetz



  • use signal sectionEntered (int)



  • you can use signal sectionEntered



  • +1

    [quote author="Jeroentje@home" date="1360146421"]first of all, when having problems with signals and slots and you have no idea where to start it is always a good idea to check if Qt really connected the signal/slot. The connect function returns a boolean value to indicate that.
    The main thing that pops-up are the arguments in your slot! The slot may never have other arguments then the signal provides! So the slot must have a int value as argument. That might do the trick.
    Greetz[/quote]



  • Thanks!

    when i use

    @connect(view->header(), SIGNAL(sectionEntered(int)), &_retrospectiveBackupPopup, SLOT(doHide(int)));@
    And i move with the mouse over the header, nothing happens.

    When i use sectionClicked(int), and i click on the header, it works...



  • you can then reimplement widgets mouse event



  • Maybe enable the mousetrack option? Might do the trick.


Log in to reply
 

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