A configurable alert dialog that displays an alert/error message. More...
#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 |
A configurable alert dialog that displays an alert/error message.
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.
00030 : 00031 QDialog(parent, name, true ) 00032 { 00033 //------------------------------- 00034 //create widgets 00035 topFrame = new QFrame( this ); 00036 00037 alertText = new QLabel( topFrame ); 00038 alertText->setText( message ); 00039 00040 QFont alertFont = alertText->font(); 00041 alertFont.setWeight(QFont::Bold); 00042 alertText->setFont( alertFont ); 00043 00044 alertIcon = new QPixmap(QString(IMAGE_PATH)+alertIconName); 00045 alertIconLabel = new QLabel( topFrame ); 00046 alertIconLabel->setPixmap( *alertIcon ); 00047 00048 descriptionText = new QTextEdit( this ); 00049 descriptionText->setReadOnly(true); 00050 descriptionText->setText( description ); 00051 00052 bottomFrame = new QFrame( this ); 00053 okButton = new QPushButton( tr("OK"), bottomFrame ); 00054 okButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); 00055 okButton->setDefault(true); 00056 okButton->setFocus(); 00057 00058 connect( okButton, SIGNAL(clicked()), SLOT(accept()) ); 00059 //------------------------------- 00060 //create grid and place widgets 00061 gridTop = new QGridLayout( topFrame, 1, 2, 0); 00062 gridTop->addWidget( alertText, 0, 0 ); 00063 gridTop->addWidget( alertIconLabel, 0, 1, Qt::AlignRight ); 00064 00065 gridBottom = new QGridLayout( bottomFrame, 1, 1, 0); 00066 gridBottom->addWidget( okButton, 0, 0 ); 00067 00068 gridFull = new QGridLayout( this, 3, 1, 0); 00069 gridFull->addWidget( topFrame, 0, 0); 00070 gridFull->addWidget( descriptionText, 1, 0); 00071 gridFull->addWidget( bottomFrame, 2, 0); 00072 00073 gridFull->setRowStretch( 1, 1 ); 00074 gridFull->setResizeMode( QLayout::FreeResize ); 00075 gridFull->setMargin(WIDGET_SPACING); 00076 gridFull->setSpacing(WIDGET_SPACING); 00077 00078 setMinimumWidth(300); 00079 setMaximumWidth(300); 00080 //------------------------------- 00081 //setup window title bar 00082 setCaption( message ); 00083 //------------------------------- 00084 //set window to not be resizeable 00085 this->show(); 00086 setFixedSize(size()); 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] |
Definition at line 66 of file alertDialog.h.
Referenced by AlertDialog().
QTextEdit* AlertDialog::descriptionText [private] |
Description displayed in window.
Definition at line 54 of file alertDialog.h.
Referenced by AlertDialog().
QGridLayout * AlertDialog::gridBottom [private] |
Definition at line 48 of file alertDialog.h.
Referenced by AlertDialog().
QGridLayout * AlertDialog::gridFull [private] |
Definition at line 48 of file alertDialog.h.
Referenced by AlertDialog().
QGridLayout* AlertDialog::gridTop [private] |
QPushButton* AlertDialog::okButton [private] |
QFrame* AlertDialog::topFrame [private] |