Important: Please read the Qt Code of Conduct -

Hover Problem with QToolBar/QAction

  • Hi there,

    I've got a QToolbar with some buttons on it. Clicking one of them shows a custom modal window of mine, which was derived from QDialog and shown by calling exec(). This window has two buttons - OK & Cancel. The triggers of both call accept() and reject() on the Window respectively.

    The problem is that when I click the toolbutton and then close the window - and when I then move the mouse over the toolbar, ALL the buttons show their "hovered/activate" state simultaneously and stay that way. However, showing another/different child window in the application seems to then allow the toolbutton states to clear.

    Any ideas any one? Cos this is driving me mental.


    PS - Am running QT4.7 on Windows Vista.

  • Could you post a zip with the code?

  • Could you post a zip with the code?

    Yup. I would really appreciate help on this because it's still a problem and I don't know how go about solving it.

    ! bug)!


    I was at a loss to decide what code to post, as I don't want to end up posting the entire app. But here's the cpp code to the file dialog window in the video, as I suspect that it is doing some which is preventing the toolbar from receiving an event. (Note that when a toolbutton press displays a QMessageBox window or other windows of mine, the problem does not happen - it's just with this file dialog.)

    My custom window is derived from QDialog and has it's own execute() method, which simply calls QDialog::exec(). I have overridden the showEvent() and hideEvent() methods, but have tried disabling this methods, and the problem still remains. The window calls on QFileSystemModel and QTreeView etc.

    In terms of the code to show the window, there's nothing special. There's a trigger-slot method which creates the dialog and then calls it's execute() method. The icons in the buttons are loaded at runtime rather than being in the form.

    Thanks for getting back to me. Hope someone can help. :)

  • PS - almost forgot to give the code. It's here:

    "ZIP FILE":

Log in to reply