Strange behaviour of QWidget::leaveEvent(QEvent *ev)



  • Hello, good afternoon,

    I have a QMainWindow that creates a QWidget wA borderless with QWidget::setWindowFlags(Qt::ToolTip|)Qt::WindowStaysOnTopHint), wA redeploys void leaveEvent(QEvent *ev)

    wA creates other two QWidget, wB and wC without edges with QWidget::setWindowFlags(Qt::ToolTip|)Qt::WindowStaysOnTopHint), and also redeploys void leaveEvent(QEvent *ev)

    Then, QMainWindow creates and displays wA and wA creates and displays wB and wC.

    QMainWindow launches wA when the mouse cursor passes over an edge of the desktop, and when the mouse cursor is outside of wA, and wB and WC, the QWidgets should hide but they are not hidden.

    So the leaveEvent event is thrown, each of the three QWidget should before I click

    I tried with activateWindow() and setFocus() but does not change the behavior.

    Is this normal? As I can do to make the QWidgets be concealed without having to click on each one of them?

    Thanks a lot.

    Dario.



  • where have you got such "leaveEvent(QHideEvent *ev)" for QWidget?
    leaveEvent and hideEvent both are separated implementable methods. we don't have leaveEvent with QHideEvent prototype.
    use the correct method based on "documents":http://qt-project.org/doc/qt-4.8/qwidget.html#leaveEvent

    @
    void QWidget::leaveEvent ( QEvent * event )
    @



  • Sorry, the correct is leaveEvent(QEvent *ev)
    was a mistake in drafting



  • so, did your problem solved after using "leaveEvent(QEvent *event)"?



  • Not because the mistake with "leaveEvent(QEvent *event) was to write the post
    The code use "leaveEvent(QEvent *event)


Log in to reply
 

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