2

我使用 Qt 5.3.2 创建了一个应用程序。当应用程序加载时,在 Mac 和 Windows 的情况下会出现关闭和最小化按钮,但是当我在 Linux 上运行相同的代码时,这些按钮不再可用。

谁能指出我为什么会发生这种情况?这是我用来创建主屏幕的代码。

这里 View 是对象QQuickView

    View view(QUrl("qrc:/qml/main.qml"));

    view.setMaximumSize(QSize(1280,700));
    view.setMinimumSize(QSize(1280,700));

    // Centering the App to the middle of the screen
    int width = view.frameGeometry().width();
    int height = view.frameGeometry().height();
    QDesktopWidget wid;
    int screenWidth = wid.screen()->width();
    int screenHeight = wid.screen()->height();
    view.setGeometry((screenWidth/2)-(width/2),(screenHeight/2)-(height/2),width,height);


    view.show();
4

1 回答 1

0

您可以将 windows 标志设置QQuickView为:

view.setFlags(Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint);
于 2015-02-02T06:06:15.257 回答