AlbumShaper
1.0a3
|
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.
: QDialog(parent, name, true ) { //------------------------------- //create widgets topFrame = new QFrame( this ); alertText = new QLabel( topFrame ); alertText->setText( message ); QFont alertFont = alertText->font(); alertFont.setWeight(QFont::Bold); alertText->setFont( alertFont ); alertIcon = new QPixmap(QString(IMAGE_PATH)+alertIconName); alertIconLabel = new QLabel( topFrame ); alertIconLabel->setPixmap( *alertIcon ); descriptionText = new QTextEdit( this ); descriptionText->setReadOnly(true); descriptionText->setText( description ); bottomFrame = new QFrame( this ); okButton = new QPushButton( tr("OK"), bottomFrame ); okButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); okButton->setDefault(true); okButton->setFocus(); connect( okButton, SIGNAL(clicked()), SLOT(accept()) ); //------------------------------- //create grid and place widgets gridTop = new QGridLayout( topFrame, 1, 2, 0); gridTop->addWidget( alertText, 0, 0 ); gridTop->addWidget( alertIconLabel, 0, 1, Qt::AlignRight ); gridBottom = new QGridLayout( bottomFrame, 1, 1, 0); gridBottom->addWidget( okButton, 0, 0 ); gridFull = new QGridLayout( this, 3, 1, 0); gridFull->addWidget( topFrame, 0, 0); gridFull->addWidget( descriptionText, 1, 0); gridFull->addWidget( bottomFrame, 2, 0); gridFull->setRowStretch( 1, 1 ); gridFull->setResizeMode( QLayout::FreeResize ); gridFull->setMargin(WIDGET_SPACING); gridFull->setSpacing(WIDGET_SPACING); setMinimumWidth(300); setMaximumWidth(300); //------------------------------- //setup window title bar setCaption( message ); //------------------------------- //set window to not be resizeable this->show(); setFixedSize(size()); //------------------------------- }
AlertDialog::~AlertDialog | ( | ) |
Destructor.
Definition at line 89 of file alertDialog.cpp.
References alertIcon.
{ delete alertIcon; }
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] |