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. transparent window in windows 7 classic theme
Qt 6.11 is out! See what's new in the release blog

transparent window in windows 7 classic theme

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 808 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.
  • Y Offline
    Y Offline
    yupengfei
    wrote on last edited by
    #1

    Hi,
    I create a transparent qml window and everything works well until I change my windows 7 theme to classic, the area I want it to be transparent is black.

    import QtQuick 2.6
    import QtQuick.Window 2.2
    import QtGraphicalEffects 1.0
    
    Window {
     id: window
     visible: true
     width: 640
     height: 480
     color: "#00000000"
     flags: Qt.Window | Qt.FramelessWindowHint//去掉标题栏
    
     RectangularGlow {
       anchors.fill: background
       glowRadius: 10
       spread: 0
       cornerRadius: 10
       color: "#99999999"
    }
    
     Rectangle{
         id: background
         anchors.topMargin: 50
         anchors.centerIn: parent
         radius: 15
         width: parent.width *2/3
         height: parent.height - 10
         color: "#ffdbeef5"
     }
    
    }
    

    and the cpp

    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    #include <QtQuick>
    
    int main(int argc, char *argv[])
    {
        QGuiApplication app(argc, argv);
    //    QQuickWindow::setDefaultAlphaBuffer(true);
        QQmlApplicationEngine engine;
        engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
        if (engine.rootObjects().isEmpty())
            return -1;
    
        return app.exec();
    }
    

    Here is a screenshot, anyone has some idea?
    alt text

    small_birdS 1 Reply Last reply
    0
    • Y yupengfei

      Hi,
      I create a transparent qml window and everything works well until I change my windows 7 theme to classic, the area I want it to be transparent is black.

      import QtQuick 2.6
      import QtQuick.Window 2.2
      import QtGraphicalEffects 1.0
      
      Window {
       id: window
       visible: true
       width: 640
       height: 480
       color: "#00000000"
       flags: Qt.Window | Qt.FramelessWindowHint//去掉标题栏
      
       RectangularGlow {
         anchors.fill: background
         glowRadius: 10
         spread: 0
         cornerRadius: 10
         color: "#99999999"
      }
      
       Rectangle{
           id: background
           anchors.topMargin: 50
           anchors.centerIn: parent
           radius: 15
           width: parent.width *2/3
           height: parent.height - 10
           color: "#ffdbeef5"
       }
      
      }
      

      and the cpp

      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      #include <QtQuick>
      
      int main(int argc, char *argv[])
      {
          QGuiApplication app(argc, argv);
      //    QQuickWindow::setDefaultAlphaBuffer(true);
          QQmlApplicationEngine engine;
          engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
          if (engine.rootObjects().isEmpty())
              return -1;
      
          return app.exec();
      }
      

      Here is a screenshot, anyone has some idea?
      alt text

      small_birdS Offline
      small_birdS Offline
      small_bird
      wrote on last edited by
      #2

      @yupengfei Have you solved this problem?

      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