Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Temporary white border on resizing Qt Quick application window on Windows Desktop
Qt 6.11 is out! See what's new in the release blog

Temporary white border on resizing Qt Quick application window on Windows Desktop

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 2.1k 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.
  • U Offline
    U Offline
    ulmstefan
    wrote on last edited by ulmstefan
    #1

    Hi all,

    I'm trying to create a QT Quick Desktop app for Windows with transparent background.
    I could manage to reach an application window with transparent background.
    The problem is, that the application shall be possible to resize in smooth way.
    The resizing itself works as expected, the problem I face is more, that when I change the size of the
    application window there appears a temporary white border, which again disappears, when I stop resizing.
    For example if I run my application and I use standard window method to change the width of the window by using the mouse cursor on the application window border there appears a white border temorarily until I stop resizing.
    It is interesting, that this happens only when enlarging the size, never when decreasing it.

    This is my code:

    import QtQuick 2.6
    import QtQuick.Controls 1.5
    import QtQuick.Dialogs 1.2
    import QtQuick.Window 2.0
    import QtQuick.Controls.Styles 1.4

    ApplicationWindow {
    property int vpSourceWidth: 440
    property int vpSourceHeight: 680

    id: mainFrame
    

    // flags: Qt.FramelessWindowHint || Qt.CustomizeWindowHint
    //flags: Qt.CustomizeWindowHint

    visible: true
    width: vpSourceWidth
    height: vpSourceHeight
    
    color: "transparent"
    

    }

    Is there a way to get rid of that white border, for example to set main application window transition/animation to transparent?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Smatcher
      wrote on last edited by
      #2

      I assume you are on Windows.
      This is due to Windows drawing a background before qml does (qml does not redraw fast enough and you see the white background before it can be filled with a transparent value)
      You can use Win32 calls from c++ to customise this

      WId id = window()->winId();
      SetClassLongPtr(HWND(id), GCLP_HBRBACKGROUND, LONG_PTR(GetStockObject(NULL_BRUSH)));
      

      This is far from perfect since if the whole window begins to flicker (which can happen too on resize) then you will not see white but the whole window disappearing instead

      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