2

I have created an application using Qt 5.3.2. When the application loads the Close and Minimize buttons appear in case of Mac and Windows, But when i run the same code on Linux these buttons are no longer available.

Can anyone point me to why this maybe happening? This is the code i use to create the main screen.

Here View is object of 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();
Keith Thompson
  • 254,901
  • 44
  • 429
  • 631
prakashpun
  • 259
  • 4
  • 19

1 Answers1

0

You can set the windows flag for QQuickView as :

view.setFlags(Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint);
Nejat
  • 31,784
  • 12
  • 106
  • 138
  • Thanks for your answer, It does work. However, can you tell me if I can disable only maximise button. Coz in Linux when i click that, it flickers a bit. – prakashpun Feb 02 '15 at 06:15
  • I don't see any maximize button when running your code. Do you see it when you only set the flags? Set the maximum and minimum size the same. – Nejat Feb 02 '15 at 06:19
  • It works well on Linux , but on windows the buttons doesnt show up. – prakashpun Feb 02 '15 at 06:29
  • The do not set the flags on Windows. Use `#ifdef WIN32` to determine the OS environment. – Nejat Feb 02 '15 at 06:39
  • Yes. Did that already. Thanks a lot for your help. Appreciate it. – prakashpun Feb 02 '15 at 06:43