Main Page | Class Hierarchy | Class List | 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 37 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.

QLabel * questionText
 Question displayed in window.

QTextEdit * messageText
 Message displayed in window.

QPushButton * okButton
 Ok button.

QPushButton * cancelButton
 Cancel button.

QPixmap * windowIcon
 Window icon.

QPixmap * questionIcon
 Question icon.

QLabel * questionIconLabel
 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 31 of file questionDialog.cpp.

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

00035                                                                  : 
00036                                               QDialog(parent, name, true )
00037 {
00038   //-------------------------------
00039   //create widgets   
00040   windowIcon = new QPixmap(QString(IMAGE_PATH)+"albumShaperIcon.png");
00041   
00042   topFrame = new QFrame( this );  
00043   
00044   questionText = new QLabel( topFrame );
00045   questionText->setText( question );
00046   questionText->setFont( QFont( "Times", 12, QFont::Bold ) );
00047 
00048   questionIcon = new QPixmap(QString(IMAGE_PATH)+questionIconName);
00049   questionIconLabel = new QLabel( topFrame );
00050   questionIconLabel->setPixmap( *questionIcon );
00051     
00052   messageText = new QTextEdit( this );
00053   messageText->setReadOnly(true);  
00054   messageText->setText( message );
00055   messageText->setFont( QFont( "Times", 12, QFont::Normal ) );  
00056 
00057   bottomFrame = new QFrame( this );
00058     
00059   okButton = new QPushButton( QPixmap(QString(IMAGE_PATH)+"button_ok.png"), 
00060                               tr("Ok"), 
00061                               bottomFrame );
00062   okButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum );
00063   okButton->setDefault(true);
00064   okButton->setFocus();
00065   
00066   connect( okButton, SIGNAL(clicked()), SLOT(accept()) );
00067 
00068   cancelButton = new QPushButton( QPixmap(QString(IMAGE_PATH)+"button_cancel.png"), 
00069                                   tr("Cancel"), 
00070                                   bottomFrame );
00071   cancelButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum );
00072   connect( cancelButton, SIGNAL(clicked()), SLOT(reject()) );
00073   //-------------------------------
00074   //create grid and place widgets
00075   gridTop     = new QGridLayout( topFrame, 1, 2, 0);
00076   gridTop->addWidget( questionText, 0, 0 );
00077   gridTop->addWidget( questionIconLabel, 0, 1, Qt::AlignRight );
00078   
00079   gridBottom  = new QGridLayout( bottomFrame, 1, 2, 0);
00080   gridBottom->addWidget( okButton, 0, 0 );
00081   gridBottom->addWidget( cancelButton, 0, 1);
00082   
00083   gridFull    = new QGridLayout( this, 3, 1, 0);
00084   gridFull->addWidget( topFrame, 0, 0);
00085   gridFull->addWidget( messageText, 1, 0);
00086   gridFull->addWidget( bottomFrame, 2, 0);
00087   
00088   gridFull->setRowStretch( 1, 1 );     
00089   gridFull->setResizeMode( QLayout::FreeResize );
00090   
00091   setMinimumWidth(300);
00092   setMaximumWidth(300);
00093   //-------------------------------
00094   //set the background of the widget to be white
00095   setPaletteBackgroundColor( QColor(255, 255, 255) );
00096   //-------------------------------
00097   //setup window title bar
00098   setIcon( *windowIcon );
00099   setCaption( question );
00100   //-------------------------------
00101   //set window to not be resizeable
00102   this->show();
00103   setFixedSize(size());
00104   //-------------------------------
00105 }

QuestionDialog::~QuestionDialog  ) 
 

Destructor.

Definition at line 107 of file questionDialog.cpp.

References questionIcon, and windowIcon.

00108 {
00109   delete windowIcon;
00110   delete questionIcon;
00111 }


Member Data Documentation

QFrame * QuestionDialog::bottomFrame [private]
 

Top and bottom frames.

Definition at line 78 of file questionDialog.h.

Referenced by QuestionDialog().

QPushButton* QuestionDialog::cancelButton [private]
 

Cancel button.

Definition at line 66 of file questionDialog.h.

Referenced by QuestionDialog().

QGridLayout * QuestionDialog::gridBottom [private]
 

Grids objects placed in.

Definition at line 54 of file questionDialog.h.

Referenced by QuestionDialog().

QGridLayout * QuestionDialog::gridFull [private]
 

Grids objects placed in.

Definition at line 54 of file questionDialog.h.

Referenced by QuestionDialog().

QGridLayout* QuestionDialog::gridTop [private]
 

Grids objects placed in.

Definition at line 54 of file questionDialog.h.

Referenced by QuestionDialog().

QTextEdit* QuestionDialog::messageText [private]
 

Message displayed in window.

Definition at line 60 of file questionDialog.h.

Referenced by QuestionDialog().

QPushButton* QuestionDialog::okButton [private]
 

Ok button.

Definition at line 63 of file questionDialog.h.

Referenced by QuestionDialog().

QPixmap* QuestionDialog::questionIcon [private]
 

Question icon.

Definition at line 72 of file questionDialog.h.

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

QLabel* QuestionDialog::questionIconLabel [private]
 

Label which shows question icon.

Definition at line 75 of file questionDialog.h.

Referenced by QuestionDialog().

QLabel* QuestionDialog::questionText [private]
 

Question displayed in window.

Definition at line 57 of file questionDialog.h.

Referenced by QuestionDialog().

QFrame* QuestionDialog::topFrame [private]
 

Top and bottom frames.

Definition at line 78 of file questionDialog.h.

Referenced by QuestionDialog().

QPixmap* QuestionDialog::windowIcon [private]
 

Window icon.

Definition at line 69 of file questionDialog.h.

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


The documentation for this class was generated from the following files:
Generated on Thu Nov 13 00:11:14 2003 for AlbumShaper by doxygen 1.3.4