Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

QuestionDialog Class Reference

#include <questionDialog.h>

Inheritance diagram for QuestionDialog:

Inheritance graph
[legend]
Collaboration diagram for QuestionDialog:

Collaboration graph
[legend]
List of all members.

Detailed Description

A configurable question dialog that returns true/false.

Definition at line 31 of file questionDialog.h.

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
 Grids objects placed in.
QGridLayout * gridFull
 Grids objects placed in.
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
 Top and bottom frames.


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.

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

QuestionDialog::~QuestionDialog  ) 
 

Destructor.

Definition at line 93 of file questionDialog.cpp.

00094 {
00095   delete questionIcon;
00096 }


Member Data Documentation

QFrame * QuestionDialog::bottomFrame [private]
 

Top and bottom frames.

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]
 

Grids objects placed in.

Definition at line 48 of file questionDialog.h.

Referenced by QuestionDialog().

QGridLayout * QuestionDialog::gridFull [private]
 

Grids objects placed in.

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().

QTextEdit* QuestionDialog::messageText [private]
 

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().

QLabel* QuestionDialog::questionIconLabel [private]
 

Label which shows question icon.

Definition at line 66 of file questionDialog.h.

Referenced by QuestionDialog().

QLabel* QuestionDialog::questionText [private]
 

Question displayed in window.

Definition at line 51 of file questionDialog.h.

Referenced by QuestionDialog().

QFrame* QuestionDialog::topFrame [private]
 

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 Sat Apr 2 05:45:09 2005 for AlbumShaper by  doxygen 1.3.9.1