Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]Is there a way to unset Qt::FramelessWindowHint?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 6.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vinb
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bergo.torino
      wrote on last edited by
      #2

      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.

      It's compiling - mostly I'm slacking off ;)

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vinb
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bergo.torino
          wrote on last edited by
          #4

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

          It's compiling - mostly I'm slacking off ;)

          1 Reply Last reply
          0
          • B Offline
            B Offline
            bergo.torino
            wrote on last edited by
            #5

            Have you tried this approach:

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

            It's compiling - mostly I'm slacking off ;)

            1 Reply Last reply
            0
            • V Offline
              V Offline
              vinb
              wrote on last edited by
              #6

              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!

              1 Reply Last reply
              0
              • G Offline
                G Offline
                giesbert
                wrote on last edited by
                #7

                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 :-(

                Nokia Certified Qt Specialist.
                Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved