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. Hide Minimize and Maximize buttons of the main window - Kubuntu 20.10
Forum Updated to NodeBB v4.3 + New Features

Hide Minimize and Maximize buttons of the main window - Kubuntu 20.10

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 4.5k 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.
  • S Offline
    S Offline
    stretchthebits
    wrote on last edited by
    #1

    Allo,
    I am on Kubuntu 20.10.
    I have Qt Creator 4.14.2, it says based on Qt 5.15.2 (GCC 7.3.1 20180303 (Red Hat 7.3.1-5), 64 bit)

    WHAT WORKS:
    I can disable the Minimize and Maximize buttons.
    The window cannot be resized.

    THE PROBLEM IS:
    I can still see the Minimize and Maximize buttons.

    MyProject::MyProject(QWidget *parent, QString &filePath)
    	: QMainWindow(parent)
    	, ui(new Ui::MyProject)
    {
    
    ui->setupUi(this);
    setFixedSize(size());
    
    setGeometry(WindowPosition[0], WindowPosition[1], ClientWindowSize[0], ClientWindowSize[1]);
    setWindowTitle(ApplicationTitle);
    }
    

    That’s not the entire constructor. I cut out most of the fat.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You can do some more customization using the WindowFlags.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        stretchthebits
        wrote on last edited by
        #3

        I added
        setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);

        but the Maximize button still remains.
        The minimize button works and I think that's ok. How can I hide the maximize button?

        JonBJ 1 Reply Last reply
        0
        • S stretchthebits

          I added
          setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);

          but the Maximize button still remains.
          The minimize button works and I think that's ok. How can I hide the maximize button?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @stretchthebits
          Did you try playing with the Qt::WindowMinimizeButtonHint/Qt::WindowMaximizeButtonHint/Qt::WindowMinMaxButtonsHint flags? There is a Qt example at https://doc.qt.io/qt-5/qtwidgets-widgets-windowflags-example.html you could play with to see the effects of the various flags.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            stretchthebits
            wrote on last edited by stretchthebits
            #5

            @JonB said in Hide Minimize and Maximize buttons of the main window - Kubuntu 20.10:

            @stretchthebits
            Did you try playing with the Qt::WindowMinimizeButtonHint/Qt::WindowMaximizeButtonHint/Qt::WindowMinMaxButtonsHint flags? There is a Qt example at https://doc.qt.io/qt-5/qtwidgets-widgets-windowflags-example.html you could play with to see the effects of the various flags.

            I found that project in the Qt Creator Welcome screen and I compiled it.
            Some of it does stuff, such as a frameless window gives me a frameless window.

            Always on top window gives me a Always on top window.

            So which one gets rid of the Maximize button?

            JonBJ 1 Reply Last reply
            0
            • S stretchthebits

              @JonB said in Hide Minimize and Maximize buttons of the main window - Kubuntu 20.10:

              @stretchthebits
              Did you try playing with the Qt::WindowMinimizeButtonHint/Qt::WindowMaximizeButtonHint/Qt::WindowMinMaxButtonsHint flags? There is a Qt example at https://doc.qt.io/qt-5/qtwidgets-widgets-windowflags-example.html you could play with to see the effects of the various flags.

              I found that project in the Qt Creator Welcome screen and I compiled it.
              Some of it does stuff, such as a frameless window gives me a frameless window.

              Always on top window gives me a Always on top window.

              So which one gets rid of the Maximize button?

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @stretchthebits
              The ones I told you in my previous post. Just as per their names imply.

              Note they are "hints". The native windowing system may ignore them.

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved