简体   繁体   中英

How to make QML window borderless?

This is my QML file:

Rectangle {
  width:640;
  height:360;

  Text {
    text:qsTr("Agritrade");
    anchors.centerIn:parent;
  }//text

  MouseArea {
    anchors.fill:parent;
    onClicked: {
      Qt.quit();
    }
  }//mouse area
}

I wish to make the window borderless. How to set the properties for the Rectangle above?

It seems like impossible to set properties for Rectangle tag to make a borderless frame.

The only solution below is applicable (use 'setFlags' method):

//qml viewer
QtQuick2ApplicationViewer viewer;
viewer.setMainQmlFile(QStringLiteral("qml/agritrade/main.qml"));
viewer.setFlags(Qt::Window|Qt::FramelessWindowHint);
viewer.showExpanded();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM