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. How to set my layout to title bar in windows?
Forum Updated to NodeBB v4.3 + New Features

How to set my layout to title bar in windows?

Scheduled Pinned Locked Moved General and Desktop
11 Posts 5 Posters 5.4k 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.
  • J Offline
    J Offline
    jack smith
    wrote on last edited by
    #1

    http://we.tl/SCY1U7ibhs

    Please check this link to download the image file.
    Any help would be appreciated
    Thanks.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rahul Das
      wrote on last edited by
      #2

      Link is not working!


      Declaration of (Platform) independence.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jack smith
        wrote on last edited by
        #3

        yes i have updated the link.

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

          This is a custom title bar and the title bar is part of the OS and not directly manageable by Qt.
          You can customize the title bar in two ways:

          1.) use the OS way (overwrite e.g. winEvent and implement messages like WM_NCXXX)
          2.) remove the OS titlebar and create a widget instead.

          Using the second way, you can use Qt but you loose the OS integration on windows (like task bar button, window move, etc.)

          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
          • J Offline
            J Offline
            jack smith
            wrote on last edited by
            #5

            Okay Gerolf thanks
            But how can i achieve this by coding.
            if I use 1st way then,should I paint the title bar or any else.
            and if I use 2nd then can I mange the min,max close button on custom title bar and how to hide the orignal one.
            Please guide with some example.

            Thanks.

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

              Hi Jack,

              if you use the OS specific part, google a bit for windows custom titlebar, that should give you results (way 1).
              If you remove the standard header, use widget attributes (see QWidget docu and examples). The buttons must then be done by you on your own.

              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
              • V Offline
                V Offline
                vezprog
                wrote on last edited by
                #7

                I have done this a couple times. Set your Main Window Widget background to translucent. Use an QVBoxLayout to separate a title from the main window. Make a title bar widget subclass.

                For click and drag movement of the application, pick up the mouse click / move event, then send a signal to the main window telling where to move too (for the same functionality as the windows OS title bar).

                For Resizing, you can add a QSizeGrip on the bottom right in a custom widget as well and set its parent to the main window. It should do its job.

                When I did it, I had a title bar, the main section of the app, and a bottom bar. The title bar contained a QHBoxLayout with a label and a few buttons for minimize, help, and close, and a bottom bar contained a label and the size grip.

                1 Reply Last reply
                0
                • Chris KawaC Offline
                  Chris KawaC Offline
                  Chris Kawa
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  The downside of custom window borders rendering is that you have to be very careful to preserve the native OS feel. For some examples:

                  doubleclick on the title bar should maximize/demaximize the window but this is way to often handled wrong on multi-monitor configs ie. app always maximizes on the primary screen instead of the screen it was sitting.

                  Windows Vista/7 introduced some new windowing features like
                  window snap - windows snap to the side edges of screen, maximize when dragged to top edge and demaximize by dragging, new shortcuts like Win+arrows etc, this also works for resizing by grabbing edges.
                  window peek - new ways to "preview" app window eg. by hovering over taskbar thumbnail
                  window shake - closing all other opened windows by grabbing and shaking title bar

                  There are probably similar OS functions on linux and macos. By disabling native window frame you are obligated to provide those facilities yourself or your app will feel out of place no matter how pretty your window is.

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    jack smith
                    wrote on last edited by
                    #9

                    Hi dvez43,
                    I'm new to Qt - how can this be done?

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

                      Hi jack,

                      please use the search on the forum, those things hjave been discussed here already.
                      Additionally to what Krzysztof said, on Windows also things like task bar in tegration, task bar menu etc. do not work. Custom window title windows also sometimes (don't kwnow whether it's windows version dependant) maximize to full screen (and therefore hide a fixed windows task bar) instead of maximizied windows.

                      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
                      • J Offline
                        J Offline
                        jack smith
                        wrote on last edited by
                        #11

                        ohh sorry...!
                        I'm new to this forum.
                        But I'll take care about this for next time.

                        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