AlbumShaper  1.0a3
Public Member Functions | Private Attributes | List of all members
AlertDialog Class Reference

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

#include <alertDialog.h>

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

Public Member Functions

 AlertDialog (QString message, QString description, QString alertIconName, QWidget *parent=0, const char *name=0)
 Basic constructor. More...
 
 ~AlertDialog ()
 Destructor. More...
 

Private Attributes

Q3GridLayout * gridTop
 Grids objects placed in. More...
 
Q3GridLayout * gridBottom
 
Q3GridLayout * gridFull
 
QLabelalertText
 Message displayed in window. More...
 
Q3TextEditdescriptionText
 Description displayed in window. More...
 
QPushButton * okButton
 Ok button. More...
 
QPixmap * alertIcon
 Alert icon. More...
 
QLabelalertIconLabel
 Label which shows alert icon. More...
 
Q3FrametopFrame
 Top and bottom frames. More...
 
Q3FramebottomFrame
 

Detailed Description

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

Definition at line 36 of file alertDialog.h.

Constructor & Destructor Documentation

§ AlertDialog()

AlertDialog::AlertDialog ( QString  message,
QString  description,
QString  alertIconName,
QWidget parent = 0,
const char *  name = 0 
)

Basic constructor.

Definition at line 28 of file alertDialog.cpp.

References alertIcon, alertIconLabel, alertText, bottomFrame, descriptionText, gridBottom, gridFull, gridTop, IMAGE_PATH, okButton, topFrame, and WIDGET_SPACING.

32  :
33  QDialog(parent, name, true )
34 {
35  //-------------------------------
36  //create widgets
37  topFrame = new Q3Frame( this );
38 
39  alertText = new QLabel( topFrame );
40  alertText->setText( message );
41 
42  QFont alertFont = alertText->font();
43  alertFont.setWeight(QFont::Bold);
44  alertText->setFont( alertFont );
45 
46  alertIcon = new QPixmap(QString(IMAGE_PATH)+alertIconName);
48  alertIconLabel->setPixmap( *alertIcon );
49 
50  descriptionText = new Q3TextEdit( this );
51  descriptionText->setReadOnly(true);
52  descriptionText->setText( description );
53 
54  bottomFrame = new Q3Frame( this );
55  okButton = new QPushButton( tr("OK"), bottomFrame );
56  okButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
57  okButton->setDefault(true);
58  okButton->setFocus();
59 
60  connect( okButton, SIGNAL(clicked()), SLOT(accept()) );
61  //-------------------------------
62  //create grid and place widgets
63  gridTop = new Q3GridLayout( topFrame, 1, 2, 0);
64  gridTop->addWidget( alertText, 0, 0 );
65  gridTop->addWidget( alertIconLabel, 0, 1, Qt::AlignRight );
66 
67  gridBottom = new Q3GridLayout( bottomFrame, 1, 1, 0);
68  gridBottom->addWidget( okButton, 0, 0 );
69 
70  gridFull = new Q3GridLayout( this, 3, 1, 0);
71  gridFull->addWidget( topFrame, 0, 0);
72  gridFull->addWidget( descriptionText, 1, 0);
73  gridFull->addWidget( bottomFrame, 2, 0);
74 
75  gridFull->setRowStretch( 1, 1 );
76  gridFull->setResizeMode( QLayout::SetNoConstraint );
77  gridFull->setMargin(WIDGET_SPACING);
78  gridFull->setSpacing(WIDGET_SPACING);
79 
80  setMinimumWidth(300);
81  setMaximumWidth(300);
82  //-------------------------------
83  //setup window title bar
84  setCaption( message );
85  //-------------------------------
86  //set window to not be resizeable
87  this->show();
88  setFixedSize(size());
89  //-------------------------------
90 }
Q3Frame * bottomFrame
Definition: alertDialog.h:71
QLabel * alertText
Message displayed in window.
Definition: alertDialog.h:56
Q3TextEdit * descriptionText
Description displayed in window.
Definition: alertDialog.h:59
QLabel * alertIconLabel
Label which shows alert icon.
Definition: alertDialog.h:68
Q3GridLayout * gridFull
Definition: alertDialog.h:53
Q3GridLayout * gridTop
Grids objects placed in.
Definition: alertDialog.h:53
QPixmap * alertIcon
Alert icon.
Definition: alertDialog.h:65
QString IMAGE_PATH
Definition: config.cpp:18
#define WIDGET_SPACING
Definition: config.h:31
Q3GridLayout * gridBottom
Definition: alertDialog.h:53
Q3Frame * topFrame
Top and bottom frames.
Definition: alertDialog.h:71
QPushButton * okButton
Ok button.
Definition: alertDialog.h:62

§ ~AlertDialog()

AlertDialog::~AlertDialog ( )

Destructor.

Definition at line 92 of file alertDialog.cpp.

References alertIcon.

93 {
94  delete alertIcon;
95 }
QPixmap * alertIcon
Alert icon.
Definition: alertDialog.h:65

Member Data Documentation

§ alertIcon

QPixmap* AlertDialog::alertIcon
private

Alert icon.

Definition at line 65 of file alertDialog.h.

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

§ alertIconLabel

QLabel* AlertDialog::alertIconLabel
private

Label which shows alert icon.

Definition at line 68 of file alertDialog.h.

Referenced by AlertDialog().

§ alertText

QLabel* AlertDialog::alertText
private

Message displayed in window.

Definition at line 56 of file alertDialog.h.

Referenced by AlertDialog().

§ bottomFrame

Q3Frame * AlertDialog::bottomFrame
private

Definition at line 71 of file alertDialog.h.

Referenced by AlertDialog().

§ descriptionText

Q3TextEdit* AlertDialog::descriptionText
private

Description displayed in window.

Definition at line 59 of file alertDialog.h.

Referenced by AlertDialog().

§ gridBottom

Q3GridLayout * AlertDialog::gridBottom
private

Definition at line 53 of file alertDialog.h.

Referenced by AlertDialog().

§ gridFull

Q3GridLayout * AlertDialog::gridFull
private

Definition at line 53 of file alertDialog.h.

Referenced by AlertDialog().

§ gridTop

Q3GridLayout* AlertDialog::gridTop
private

Grids objects placed in.

Definition at line 53 of file alertDialog.h.

Referenced by AlertDialog().

§ okButton

QPushButton* AlertDialog::okButton
private

Ok button.

Definition at line 62 of file alertDialog.h.

Referenced by AlertDialog().

§ topFrame

Q3Frame* AlertDialog::topFrame
private

Top and bottom frames.

Definition at line 71 of file alertDialog.h.

Referenced by AlertDialog().


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