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.
frmMainWindow
::frmMainWindow(QWidget *parent
) : ui(new Ui::frmMainWindow)
{
ui->setupUi(this);
this->setWindowTitle("Sistema Em Qt");
this->ui->mainToolBar->setVisible(false);
this->setCentralWidget(ui->mdiAreaMain);
this->showMaximized();
}
void frmMainWindow::on_actConfig_do_Sistema_triggered()
{
frmConfigSistema *frmConfigSistemaObj = new frmConfigSistema;
frmConfigSistemaObj->setFixedSize(740,360);
frmConfigSistemaObj->setWindowTitle("Configurações do Sistema");
ui->mdiAreaMain->addSubWindow(frmConfigSistemaObj);
frmConfigSistemaObj->show();
}
frmMainWindow::frmMainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::frmMainWindow)
{
ui->setupUi(this);
this->setWindowTitle("Sistema Em Qt");
this->ui->mainToolBar->setVisible(false);
this->setCentralWidget(ui->mdiAreaMain);
this->showMaximized();
}
void frmMainWindow::on_actConfig_do_Sistema_triggered()
{
frmConfigSistema *frmConfigSistemaObj = new frmConfigSistema;
frmConfigSistemaObj->setFixedSize(740,360);
frmConfigSistemaObj->setWindowTitle("Configurações do Sistema");
ui->mdiAreaMain->addSubWindow(frmConfigSistemaObj);
frmConfigSistemaObj->show();
}
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::WindowFlags flags ;
flags |= Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint
this->setWindowFlags(flags);
Qt::WindowFlags flags ;
flags |= Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint
this->setWindowFlags(flags);
To copy to clipboard, switch view to plain text mode
2) - Fix the size by the code.
frmConfigSistemaObj->setFixedSize(740,360);
frmConfigSistemaObj->setFixedSize(740,360);
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".
frmConfigSistema *frmConfigSistemaObj = new frmConfigSistema;
frmConfigSistemaObj->setFixedSize(740,360);
frmConfigSistemaObj->setWindowTitle("Configurações do Sistema");
ui->mdiAreaMain->addSubWindow(frmConfigSistemaObj);
Qt::WindowFlags flags = 0;
frmConfigSistemaObj->setWindowFlags(flags);
frmConfigSistemaObj->setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
frmConfigSistemaObj->show();
frmConfigSistema *frmConfigSistemaObj = new frmConfigSistema;
frmConfigSistemaObj->setFixedSize(740,360);
frmConfigSistemaObj->setWindowTitle("Configurações do Sistema");
ui->mdiAreaMain->addSubWindow(frmConfigSistemaObj);
Qt::WindowFlags flags = 0;
frmConfigSistemaObj->setWindowFlags(flags);
frmConfigSistemaObj->setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
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.
Bookmarks