PDA

View Full Version : QDialog - customize the buttons



ape
10th March 2008, 14:43
Hello

i have implemented my About this app window using Qdialog
so basically i get a small popup which displays some informations about my app.

Code example:


QDialog about(this);
about.setModal(true);
about.setWindowTitle(tr("About my app"));
about.setLayout(mainLayout);


Using this code i get a small window with 2 window-control buttons in the head:
1 x X to close the window
1 x ? which can be used for helpdialogs.

Can i get rid of this question-mark button in the qdialog window ?
Best regards in advance

wysota
11th March 2008, 12:32
Have you seen QMessageBox::about()?

ape
11th March 2008, 13:08
Hi,

yeah while checking some other examples from my QT installation i noticed this possible solution.

unfortunaly it seems to not support links and/or html which i was using inside my text.
So i switched back to QDialog.

But thanks for the offered help.

THRESHE
11th March 2008, 13:18
Take a look at window flags and QWidget::setWindowFlags(Qt::WindowFlags type)

wysota
11th March 2008, 13:37
unfortunaly it seems to not support links and/or html which i was using inside my text.

Works fine for me...


#include <QApplication>
#include <QMessageBox>

int main(int argc, char **argv){
QApplication app(argc, argv);
QMessageBox::about(0, "title", "<html><body><a href='href'>link</a></body></html>");
return 0;
}

ape
12th March 2008, 08:59
You are right.

Dont know what i have done wrong last time i have tried your idea.
Thanks again for your help.