[SOLVED]Is there a way to unset Qt::FramelessWindowHint?



  • Hi All,

    Is there a way to unset FramelessWindowHint?

    Why do i want this?:
    I want to show the window frame when my mouse is "over" the window, but when the mouse is somewhere else i want the window frame invissible.



  • The QWidget::enterEvent() and QWidget::leaveEvent() functions are called when mouse either enter or leaves the window. You can try to set/unset the FramelessWindowHint for mouse enter/leave events.

    [edit]
    You will have to call QWidget::setMouseTracking (bool enable) with parameter enable=true in order to always receive mouse events. By default they are delivered only if mouse button is pressed. But by aware that this will make hell of events being delivered to your QWidget which can result in performance drop.



  • Hi bergo.torino,
    Thanks for your reply.
    But i am not looking for a way to have focus on my mouse. :)
    I only want to know how to unset the framelesswindowhint.
    Altough, thanks for guiding me like this!



  • I agree, I may have missed the essence of your question - sorry about that.



  • Have you tried this approach:

    @Qt::WindowFlags flags = windowFlags();
    flags &= ~Qt::FramelessWindowHint;
    setWindowFlags(flags);@



  • Hi bergo.torino,

    Thanks for your reply again!

    -I tried your sollution, but now my whole window dissapears instead of showing it with frame.-

    i added the code " this->show();" to it and it worked!
    thanks alot!



  • Hi vonb,

    this is also stated in the "docs":http://doc.qt.nokia.com/4.7/qwidget.html#windowFlags-prop

    bq. Note: This function calls setParent() when changing the flags for a window, causing the widget to be hidden. You must call show() to make the widget visible again..

    so changing the windowFlags means, you have to call show again :-(


Log in to reply
 

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