Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to create 'x' CLOSE/ EXIT button on the dialog Box?
Hey! I am Burhan
I am working on a periodic table in Qt c++. Belle Symbian.
The theme is when you click on the button of an element the properties of the respective element appears in the dialog and the dialog contains information about the element and the back/ close button.
Before working on the periodic table and design all buttons i want to test a one first.
I have stuck. i don't know how to create a 'x' close/ back button on the dialog.
CAN anyone PLEASE tell me how to create a close button on the dialog.????? :( I am just a starter so please suggest me the easy way.
Thanks. Awaiting for your reply.
Jeroentjehome last edited by
If you use the static function of a QMessageBox::information you can enter all the stuff you want. Qt will handle the close 'x' automatic and if you want you can add the normal ok/cancel buttons if needed using the StandardButton enum. Just check out the QMessageBox for more information. If you set the parent with 'this' all other functions will be halted until the messagebox is closed. If that isn't want you want you are able to set the setModal to alter it so multiple messageboxen can be opened.
Greetz and have fun!
Thanks buddy for the suggestion. I have to do it through dialog box.
Hydrogen::Hydrogen(QWidget *parent) :
Hydrogen :: hydinfo();
void Hydrogen :: hydinfo(void)
QGridLayout *layout = new QGridLayout;
QLabel *name = new QLabel ("Name");
layout->addWidget(name, 0, 0);
QLabel *sym = new QLabel ("Symbol");
QLabel *sym2 = new QLabel ("H");
QLabel *chemser = new QLabel ("Chemical Series"); layout->addWidget(chemser, 2,0); QLabel *chemser2 = new QLabel ("Non-Metals"); layout->addWidget(chemser2, 2,1); Hydrogen :: setLayout(layout); Hydrogen :: show();
Like this... but when i deploy it on C7 it doesn't show any close button :/
VRonin last edited by
if you want to add a "back" button on the bottom of the dialog: just add
QPushButton *backButton= new QPushButton;
just before the Hydrogen :: setLayout(layout); line in the hydinfo() method
@VRonin: Done Successfully!
Thanks in tons =)