查看完整版本: [-- qml怎么去掉最大化按钮 --]

QTCN开发网 -> Qt QML开发 -> qml怎么去掉最大化按钮 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

dcx013 2016-07-11 10:07

qml怎么去掉最大化按钮

qml怎么去掉最大化按钮,像360那样,qt5.7

咬蚊嚼渍 2016-07-11 22:10
在qml根视图,就是ApplicaptionWindow或Window里添加
flags: Qt.Window | Qt.FramelessWindowHint ;
就可以了。
然后自定义最大化最小化什么的这些按钮

cycloveu 2016-08-10 09:20
用QQuickView 可以实现 自定义标题栏+窗口阴影。 QQmlEngine+flags 可以自定义标题栏 但窗口阴影不能实现。

cuisy 2017-07-01 08:04
    Rectangle {
        id: titleRect;
        color: "#00A600";
        anchors.top: parent.top;
        anchors.left: parent.left;
        anchors.right: parent.right;
        height: 25;

        TitleButton {   //关闭按钮
            id: closeButtonDialog;
            width: 20;
            height: 18;
            anchors.right: parent.right;
            anchors.verticalCenter: parent.verticalCenter;
            anchors.rightMargin: 2;

            normalPath: "qrc:/Image/Close2.png";
            enterPath: "qrc:/Image/Close3.png";
            pressPath: "qrc:/Image/Close1.png";

            onButtonClick: usrMngWnd.destroy();
        }

        Rectangle {
            id: dragDialog;
            anchors.top: titleRect.top;
            anchors.left: titleRect.left;
            anchors.right: closeButtonDialog.left;
            anchors.bottom: titleRect.bottom;
            color: "darkBlue";

            MouseArea {
                anchors.fill: dragDialog;
                acceptedButtons: Qt.LeftButton;
                property point clickPos: "0,0";
                onPressed: {
                    clickPos  = Qt.point(mouse.x,mouse.y);
                }

                onPositionChanged: {
                    //鼠标偏移量
                    var delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y);

                    //如果mainwindow继承自QWidget,用setPos
                    self.setX(self.x+delta.x);
                    self.setY(self.y+delta.y);
                }
            }

            Label {
                id: titleWindowLabel;
                anchors.horizontalCenter: parent.horizontalCenter;
                anchors.verticalCenter: parent.verticalCenter;
                color: "#fffffb";
                text: qsTr("标题");
                font.bold: true;
            }
        }
    }

spark253649 2017-07-01 16:39
窗口阴影的话你主窗口透明里面的窗口比如rectangle加一个效果,可以参考Graphical Effects

dd759378563 2017-08-02 18:31
设置Flag为Qt::CustomizeWindowHint
如果你main.cpp里面用的是QQmlEngine,就在qml的根部ApplicationWindows里面写flags: Qt.Customi
zeWindowHint,
如果是用的QQuickView,就在main.cpp里面view.setFlags(Qt::CustomizeWindowHint);


查看完整版本: [-- qml怎么去掉最大化按钮 --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled