QuestionDialog Class Reference

A configurable question dialog that returns true/false. More...

#include <questionDialog.h>

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

List of all members.

Public Member Functions

 QuestionDialog (QString question, QString message, QString questionIconName, QWidget *parent=0, const char *name=0)
 Basic constructor.
 ~QuestionDialog ()
 Destructor.

Private Attributes

QGridLayout * gridTop
 Grids objects placed in.
QGridLayout * gridBottom
QGridLayout * gridFull
QLabelquestionText
 Question displayed in window.
QTextEditmessageText
 Message displayed in window.
QPushButton * okButton
 Ok button.
QPushButton * cancelButton
 Cancel button.
QPixmap * questionIcon
 Question icon.
QLabelquestionIconLabel
 Label which shows question icon.
QFrametopFrame
 Top and bottom frames.
QFramebottomFrame

Detailed Description

A configurable question dialog that returns true/false.

Definition at line 31 of file questionDialog.h.


Constructor & Destructor Documentation

QuestionDialog::QuestionDialog ( QString  question,
QString  message,
QString  questionIconName,
QWidget parent = 0,
const char *  name = 0 
)

Basic constructor.

Definition at line 25 of file questionDialog.cpp.

References bottomFrame, cancelButton, gridBottom, gridFull, gridTop, IMAGE_PATH, messageText, okButton, questionIcon, questionIconLabel, questionText, topFrame, and WIDGET_SPACING.

00030                                                                  :
00031                                               QDialog(parent, name, true )
00032 {
00033   //-------------------------------
00034   //create widgets
00035   topFrame = new QFrame( this );
00036 
00037   questionText = new QLabel( topFrame );
00038   questionText->setText( question );
00039 
00040   QFont questionFont = questionText->font();
00041   questionFont.setWeight(QFont::Bold);
00042   questionText->setFont( questionFont );
00043 
00044   questionIcon = new QPixmap(QString(IMAGE_PATH)+questionIconName);
00045   questionIconLabel = new QLabel( topFrame );
00046   questionIconLabel->setPixmap( *questionIcon );
00047 
00048   messageText = new QTextEdit( this );
00049   messageText->setReadOnly(true);
00050   messageText->setText( message );
00051   
00052   
00053   bottomFrame = new QFrame( this );
00054 
00055   okButton = new QPushButton( tr("Yes"), bottomFrame );
00056   okButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
00057   okButton->setDefault(true);
00058   okButton->setFocus();
00059 
00060   connect( okButton, SIGNAL(clicked()), SLOT(accept()) );
00061 
00062   cancelButton = new QPushButton( tr("No"), bottomFrame );
00063   cancelButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
00064   connect( cancelButton, SIGNAL(clicked()), SLOT(reject()) );
00065   //-------------------------------
00066   //create grid and place widgets
00067   gridTop     = new QGridLayout( topFrame, 1, 2, 0);
00068   gridTop->addWidget( questionText, 0, 0 );
00069   gridTop->addWidget( questionIconLabel, 0, 1, Qt::AlignRight );
00070 
00071   gridBottom  = new QGridLayout( bottomFrame, 1, 2, 0);
00072   gridBottom->addWidget( okButton, 0, 0 );
00073   gridBottom->addWidget( cancelButton, 0, 1);
00074 
00075   gridFull    = new QGridLayout( this, 3, 1, 0);
00076   gridFull->addWidget( topFrame, 0, 0);
00077   gridFull->addWidget( messageText, 1, 0);
00078   gridFull->addWidget( bottomFrame, 2, 0);
00079 
00080   gridFull->setRowStretch( 1, 1 );
00081   gridFull->setResizeMode( QLayout::FreeResize );
00082   gridFull->setMargin(WIDGET_SPACING);
00083   gridFull->setSpacing(WIDGET_SPACING);
00084 
00085   //-------------------------------
00086   //setup window title bar
00087   setCaption( question );
00088   //-------------------------------
00089   //set window to not be resizeable
00090   setMinimumWidth(300);
00091   this->show();
00092   setFixedSize(size());
00093   //-------------------------------
}

QuestionDialog::~QuestionDialog (  ) 

Destructor.

Definition at line 95 of file questionDialog.cpp.

References questionIcon.

00096 {
00097   delete questionIcon;
00098 }


Member Data Documentation

Definition at line 69 of file questionDialog.h.

Referenced by QuestionDialog().

QPushButton* QuestionDialog::cancelButton [private]

Cancel button.

Definition at line 60 of file questionDialog.h.

Referenced by QuestionDialog().

QGridLayout * QuestionDialog::gridBottom [private]

Definition at line 48 of file questionDialog.h.

Referenced by QuestionDialog().

QGridLayout * QuestionDialog::gridFull [private]

Definition at line 48 of file questionDialog.h.

Referenced by QuestionDialog().

QGridLayout* QuestionDialog::gridTop [private]

Grids objects placed in.

Definition at line 48 of file questionDialog.h.

Referenced by QuestionDialog().

Message displayed in window.

Definition at line 54 of file questionDialog.h.

Referenced by QuestionDialog().

QPushButton* QuestionDialog::okButton [private]

Ok button.

Definition at line 57 of file questionDialog.h.

Referenced by QuestionDialog().

QPixmap* QuestionDialog::questionIcon [private]

Question icon.

Definition at line 63 of file questionDialog.h.

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

Label which shows question icon.

Definition at line 66 of file questionDialog.h.

Referenced by QuestionDialog().

Question displayed in window.

Definition at line 51 of file questionDialog.h.

Referenced by QuestionDialog().

Top and bottom frames.

Definition at line 69 of file questionDialog.h.

Referenced by QuestionDialog().


The documentation for this class was generated from the following files:
Generated on Sun Dec 5 14:44:57 2010 for AlbumShaper by  doxygen 1.6.3