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. Custom QDialog titlebar and border
Forum Updated to NodeBB v4.3 + New Features

Custom QDialog titlebar and border

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 3.7k Views 2 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.
  • A Offline
    A Offline
    ANT1CS
    wrote on last edited by
    #1

    Hello

    I have an app that I’d like to have a custom look. I have used the frameless window hint and created my own window manager to manage moving and resizing the window, but it does not support Windows Aero features like Aero Snap and Aero Shake.

    Two questions:

    1. Is it possible to add Aero support to a QDialog while keeping the frameless window hint?
    2. If I remove the frameless window hint it shows a Windows-themed border and titlebar around the window, which on Windows 7 is pretty ugly (it looks like Notepad). Is there a way to customize the titlebar and border? None of the standard Win32 calls I’ve seen on the web to do this seem to work with a Qt window.

    Thanks!

    raven-worxR 1 Reply Last reply
    0
    • A ANT1CS

      Hello

      I have an app that I’d like to have a custom look. I have used the frameless window hint and created my own window manager to manage moving and resizing the window, but it does not support Windows Aero features like Aero Snap and Aero Shake.

      Two questions:

      1. Is it possible to add Aero support to a QDialog while keeping the frameless window hint?
      2. If I remove the frameless window hint it shows a Windows-themed border and titlebar around the window, which on Windows 7 is pretty ugly (it looks like Notepad). Is there a way to customize the titlebar and border? None of the standard Win32 calls I’ve seen on the web to do this seem to work with a Qt window.

      Thanks!

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @ANT1CS said in Custom QDialog titlebar and border:

      None of the standard Win32 calls I’ve seen on the web to do this seem to work with a Qt window.

      yes, of course they do not support a Qt window directly. But a QWindow lets you get a native window handle which you can then pass to the WinAPI.

      Also you might want to see this (untested, but worth a try)

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      4
      • A Offline
        A Offline
        ANT1CS
        wrote on last edited by
        #3

        I've gone that route already. None of the Win32 calls work using the HWND I get from my Qt window. Qt doesn't seem to support drawing using the WM_NCPAINT event for instance.

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          hi
          WM_NCPAINT can be handled with
          http://doc.qt.io/qt-5/qwidget.html#nativeEvent

          However, the custom decorations (windows borders/caption) is huge amount of work and if you really want it, i
          suggest reusing some of the attempts been made already.

          https://github.com/Bringer-of-Light/Qt-Nice-Frameless-Window

          1 Reply Last reply
          4
          • webzoidW Offline
            webzoidW Offline
            webzoid
            wrote on last edited by webzoid
            #5

            @ANT1CS Have you tried this:

            https://github.com/melak47/BorderlessWindow

            I've been looking for the Aero snap/shake feature for a while now and this seems to be a good solution for me.

            There is a "tweak" required in order to compile for QT 5.9.1 (which I'm presently running) whereby in the QWinHost.cpp file, you need to change the following line (257):

            hwnd = createWindow((HWND)winId(), qWinAppInst());
            

            change to

            hwnd = createWindow((HWND)winId(), (HINSTANCE)QWidget::effectiveWinId());
            
            1 Reply Last reply
            1

            • Login

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