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