void MainWindow::on_action_Config_triggered()
{
QDialog *dia
= this
->findChild<QDialog
*>
("confwid");
// with this code, i' m finding object from object name if (dia == 0) // if object confwid is not exist, value is "0" (zero), then i 'm creating object.
{
confw->setModal(true);
confw->setSizeGripEnabled(false);
confw->setObjectName("confwid"); // object name is here :)
confw->setWindowTitle("Configuration");
tab
= (QWidget *)ui
->tab1;
//existing tab widget object, which i created with qt creator for another mainwindow object tab->setParent(confw);
tab->show();
confw->setMaximumSize((tab->width()+10),(tab->height()+10));
confw->setMinimumSize((tab->width()+10),(tab->height()+10));
ui->pushButton->setVisible(false);
confw->resize(tab->size().width()+10,tab->size().height()+10);
confw
->setGeometry
(QStyle::alignedRect(Qt
::LeftToRight, Qt
::AlignCenter,confw
->size
(),
qApp->desktop()->availableGeometry()));
pushbutton->setText("Save");
pushbutton->setGeometry(ui->pushButton->geometry());
pushbutton->setIcon(ui->pushButton->icon());
connect(pushbutton,SIGNAL(clicked()),this,SLOT(configcontrol()));
connect(pushbutton,SIGNAL(clicked()),confw,SLOT(hide())); // with pushbutton clicked, i' m hiding QDialog. Not close!
ui->groupBox_6->setVisible(true);
ui->groupBox_6->setEnabled(true);
pushbutton->setVisible(true);
pushbutton->setEnabled(true);
pushbutton->show();
confw->showNormal();
}
else // if confwid named object is avaible, i just setting geometry and setting visibilty true for showing.
{
this
->confw
->setGeometry
(QStyle::alignedRect(Qt
::LeftToRight, Qt
::AlignCenter,confw
->size
(),
qApp->desktop()->availableGeometry()));
this->confw->setVisible(true);
}
}
void MainWindow::on_action_Config_triggered()
{
QDialog *dia = this->findChild<QDialog *>("confwid"); // with this code, i' m finding object from object name
if (dia == 0) // if object confwid is not exist, value is "0" (zero), then i 'm creating object.
{
confw = new QDialog(this);
confw->setModal(true);
confw->setSizeGripEnabled(false);
confw->setObjectName("confwid"); // object name is here :)
confw->setWindowTitle("Configuration");
QWidget *tab = new QWidget;
tab = (QWidget *)ui->tab1; //existing tab widget object, which i created with qt creator for another mainwindow object
tab->setParent(confw);
tab->show();
confw->setMaximumSize((tab->width()+10),(tab->height()+10));
confw->setMinimumSize((tab->width()+10),(tab->height()+10));
ui->pushButton->setVisible(false);
confw->resize(tab->size().width()+10,tab->size().height()+10);
confw->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter,confw->size(),
qApp->desktop()->availableGeometry()));
QPushButton *pushbutton = new QPushButton(ui->groupBox_6);
pushbutton->setText("Save");
pushbutton->setGeometry(ui->pushButton->geometry());
pushbutton->setIcon(ui->pushButton->icon());
connect(pushbutton,SIGNAL(clicked()),this,SLOT(configcontrol()));
connect(pushbutton,SIGNAL(clicked()),confw,SLOT(hide())); // with pushbutton clicked, i' m hiding QDialog. Not close!
ui->groupBox_6->setVisible(true);
ui->groupBox_6->setEnabled(true);
pushbutton->setVisible(true);
pushbutton->setEnabled(true);
pushbutton->show();
confw->showNormal();
}
else // if confwid named object is avaible, i just setting geometry and setting visibilty true for showing.
{
this->confw->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter,confw->size(),
qApp->desktop()->availableGeometry()));
this->confw->setVisible(true);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks