Results 1 to 3 of 3

Thread: How to make a user not resize a window.

  1. #1
    Join Date
    Jun 2012
    Posts
    41
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Talking How to make a user not resize a window.

    Hello everyone.

    I'm not getting a QWidget-based window to stay fixed, without the user resizing it.
    Just to level the information I'm using Linux Debian 8.5 64Bits, Qt 5.7.0 (GCC 4.9.1 20140922 (Red Hat 4.9.1-10), 64 bit) and Qt Creator 4.0.2.

    Qt Code:
    1. frmMainWindow::frmMainWindow(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::frmMainWindow)
    4. {
    5. ui->setupUi(this);
    6. this->setWindowTitle("Sistema Em Qt");
    7. this->ui->mainToolBar->setVisible(false);
    8. this->setCentralWidget(ui->mdiAreaMain);
    9. this->showMaximized();
    10. }
    11.  
    12. void frmMainWindow::on_actConfig_do_Sistema_triggered()
    13. {
    14. frmConfigSistema *frmConfigSistemaObj = new frmConfigSistema;
    15. frmConfigSistemaObj->setFixedSize(740,360);
    16. frmConfigSistemaObj->setWindowTitle("Configurações do Sistema");
    17. ui->mdiAreaMain->addSubWindow(frmConfigSistemaObj);
    18. frmConfigSistemaObj->show();
    19. }
    To copy to clipboard, switch view to plain text mode 


    I have tried in several ways like:

    1) - Not to display the Minimize and Maximize buttons.

    Qt Code:
    1. Qt::WindowFlags flags ;
    2. flags |= Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint
    3. this->setWindowFlags(flags);
    To copy to clipboard, switch view to plain text mode 

    2) - Fix the size by the code.

    Qt Code:
    1. frmConfigSistemaObj->setFixedSize(740,360);
    2. frmConfigSistemaObj-> setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
    To copy to clipboard, switch view to plain text mode 

    3) - Fix the size by Qt Creator Property Editor according to PrntScr "Fig - Redimensionamento_1.jpg".



    The closest I got was with the code below, but two windows pop up at once. "Fig - Redimensionamento_2.jpg".

    Qt Code:
    1. frmConfigSistema *frmConfigSistemaObj = new frmConfigSistema;
    2. frmConfigSistemaObj->setFixedSize(740,360);
    3. frmConfigSistemaObj->setWindowTitle("Configurações do Sistema");
    4. ui->mdiAreaMain->addSubWindow(frmConfigSistemaObj);
    5. Qt::WindowFlags flags = 0;
    6. frmConfigSistemaObj->setWindowFlags(flags);
    7. frmConfigSistemaObj->setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
    8. frmConfigSistemaObj->show();
    To copy to clipboard, switch view to plain text mode 

    Does anyone have any examples that I can follow, or an explanation of what is happening?

    Thanks.
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2017
    Posts
    58
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to make a user not resize a window.

    Try to set width and height in minimumSize and maximumSize to same size as in Geometry tab.

  3. #3
    Join Date
    Jun 2012
    Posts
    41
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to make a user not resize a window.

    Hello, ado130.

    I had already done this, and nothing happened.
    The window continues to be resized.

    Thanks.

Similar Threads

  1. Replies: 1
    Last Post: 29th December 2013, 19:06
  2. Replies: 0
    Last Post: 5th June 2013, 14:45
  3. Replies: 0
    Last Post: 8th June 2012, 14:27
  4. QSplitter only resize from user input?
    By winston2020 in forum Qt Programming
    Replies: 1
    Last Post: 30th January 2009, 16:50
  5. Replies: 3
    Last Post: 3rd September 2008, 17:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.