AlertDialog Class Reference

A configurable alert dialog that displays an alert/error message. More...

#include <alertDialog.h>

Inheritance diagram for AlertDialog:
[legend]
Collaboration diagram for AlertDialog:
[legend]

List of all members.

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
QLabelalertText
 Message displayed in window.
QTextEditdescriptionText
 Description displayed in window.
QPushButton * okButton
 Ok button.
QPixmap * alertIcon
 Alert icon.
QLabelalertIconLabel
 Label which shows alert icon.
QFrametopFrame
 Top and bottom frames.
QFramebottomFrame

Detailed Description

A configurable alert dialog that displays an alert/error message.

Definition at line 31 of file alertDialog.h.


Constructor & Destructor Documentation

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 }


Member Data Documentation

QPixmap* AlertDialog::alertIcon [private]

Alert icon.

Definition at line 60 of file alertDialog.h.

Referenced by AlertDialog(), and ~AlertDialog().

Label which shows alert icon.

Definition at line 63 of file alertDialog.h.

Referenced by AlertDialog().

Message displayed in window.

Definition at line 51 of file alertDialog.h.

Referenced by AlertDialog().

Definition at line 66 of file alertDialog.h.

Referenced by AlertDialog().

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]

Grids objects placed in.

Definition at line 48 of file alertDialog.h.

Referenced by AlertDialog().

QPushButton* AlertDialog::okButton [private]

Ok button.

Definition at line 57 of file alertDialog.h.

Referenced by AlertDialog().

Top and bottom frames.

Definition at line 66 of file alertDialog.h.

Referenced by AlertDialog().


The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.2