#include <questionDialog.h>
Inheritance diagram for QuestionDialog:
Definition at line 31 of file questionDialog.h.
Public Member Functions | |
QuestionDialog (QString question, QString message, QString questionIconName, QWidget *parent=0, const char *name=0) | |
Basic constructor. | |
~QuestionDialog () | |
Destructor. | |
Private Attributes | |
QGridLayout * | gridTop |
Grids objects placed in. | |
QGridLayout * | gridBottom |
QGridLayout * | gridFull |
QLabel * | questionText |
Question displayed in window. | |
QTextEdit * | messageText |
Message displayed in window. | |
QPushButton * | okButton |
Ok button. | |
QPushButton * | cancelButton |
Cancel button. | |
QPixmap * | questionIcon |
Question icon. | |
QLabel * | questionIconLabel |
Label which shows question icon. | |
QFrame * | topFrame |
Top and bottom frames. | |
QFrame * | bottomFrame |
QuestionDialog::QuestionDialog | ( | QString | question, | |
QString | message, | |||
QString | questionIconName, | |||
QWidget * | parent = 0 , |
|||
const char * | name = 0 | |||
) |
Basic constructor.
Definition at line 25 of file questionDialog.cpp.
References bottomFrame, cancelButton, gridBottom, gridFull, gridTop, IMAGE_PATH, messageText, okButton, questionIcon, questionIconLabel, questionText, topFrame, and WIDGET_SPACING.
00029 : 00030 QDialog(parent, name, true ) 00031 { 00032 //------------------------------- 00033 //create widgets 00034 topFrame = new QFrame( this ); 00035 00036 questionText = new QLabel( topFrame ); 00037 questionText->setText( question ); 00038 00039 QFont questionFont = questionText->font(); 00040 questionFont.setWeight(QFont::Bold); 00041 questionText->setFont( questionFont ); 00042 00043 questionIcon = new QPixmap(QString(IMAGE_PATH)+questionIconName); 00044 questionIconLabel = new QLabel( topFrame ); 00045 questionIconLabel->setPixmap( *questionIcon ); 00046 00047 messageText = new QTextEdit( this ); 00048 messageText->setReadOnly(true); 00049 messageText->setText( message ); 00050 00051 00052 bottomFrame = new QFrame( this ); 00053 00054 okButton = new QPushButton( tr("Yes"), bottomFrame ); 00055 okButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 00056 okButton->setDefault(true); 00057 okButton->setFocus(); 00058 00059 connect( okButton, SIGNAL(clicked()), SLOT(accept()) ); 00060 00061 cancelButton = new QPushButton( tr("No"), bottomFrame ); 00062 cancelButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 00063 connect( cancelButton, SIGNAL(clicked()), SLOT(reject()) ); 00064 //------------------------------- 00065 //create grid and place widgets 00066 gridTop = new QGridLayout( topFrame, 1, 2, 0); 00067 gridTop->addWidget( questionText, 0, 0 ); 00068 gridTop->addWidget( questionIconLabel, 0, 1, Qt::AlignRight ); 00069 00070 gridBottom = new QGridLayout( bottomFrame, 1, 2, 0); 00071 gridBottom->addWidget( okButton, 0, 0 ); 00072 gridBottom->addWidget( cancelButton, 0, 1); 00073 00074 gridFull = new QGridLayout( this, 3, 1, 0); 00075 gridFull->addWidget( topFrame, 0, 0); 00076 gridFull->addWidget( messageText, 1, 0); 00077 gridFull->addWidget( bottomFrame, 2, 0); 00078 00079 gridFull->setRowStretch( 1, 1 ); 00080 gridFull->setResizeMode( QLayout::FreeResize ); 00081 gridFull->setMargin(WIDGET_SPACING); 00082 gridFull->setSpacing(WIDGET_SPACING); 00083 00084 //------------------------------- 00085 //setup window title bar 00086 setCaption( question ); 00087 //------------------------------- 00088 //set window to not be resizeable 00089 setMinimumWidth(300); 00090 this->show(); 00091 setFixedSize(size()); 00092 //------------------------------- 00093 } //==============================================
QuestionDialog::~QuestionDialog | ( | ) |
Destructor.
Definition at line 95 of file questionDialog.cpp.
References questionIcon.
00096 { 00097 delete questionIcon; 00098 }
QGridLayout* QuestionDialog::gridTop [private] |
Grids objects placed in.
Definition at line 48 of file questionDialog.h.
Referenced by QuestionDialog().
QGridLayout * QuestionDialog::gridBottom [private] |
QGridLayout * QuestionDialog::gridFull [private] |
QLabel* QuestionDialog::questionText [private] |
Question displayed in window.
Definition at line 51 of file questionDialog.h.
Referenced by QuestionDialog().
QTextEdit* QuestionDialog::messageText [private] |
Message displayed in window.
Definition at line 54 of file questionDialog.h.
Referenced by QuestionDialog().
QPushButton* QuestionDialog::okButton [private] |
QPushButton* QuestionDialog::cancelButton [private] |
QPixmap* QuestionDialog::questionIcon [private] |
Question icon.
Definition at line 63 of file questionDialog.h.
Referenced by QuestionDialog(), and ~QuestionDialog().
QLabel* QuestionDialog::questionIconLabel [private] |
Label which shows question icon.
Definition at line 66 of file questionDialog.h.
Referenced by QuestionDialog().
QFrame* QuestionDialog::topFrame [private] |
Top and bottom frames.
Definition at line 69 of file questionDialog.h.
Referenced by QuestionDialog().
QFrame * QuestionDialog::bottomFrame [private] |