AlbumShaper  1.0a3
Public Member Functions | Private Attributes
QuestionDialog Class Reference

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

#include <questionDialog.h>

Inheritance diagram for QuestionDialog:
Inheritance graph
[legend]
Collaboration diagram for QuestionDialog:
Collaboration graph
[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.

                                                                 :
                                              QDialog(parent, name, true )
{
  //-------------------------------
  //create widgets
  topFrame = new QFrame( this );

  questionText = new QLabel( topFrame );
  questionText->setText( question );

  QFont questionFont = questionText->font();
  questionFont.setWeight(QFont::Bold);
  questionText->setFont( questionFont );

  questionIcon = new QPixmap(QString(IMAGE_PATH)+questionIconName);
  questionIconLabel = new QLabel( topFrame );
  questionIconLabel->setPixmap( *questionIcon );

  messageText = new QTextEdit( this );
  messageText->setReadOnly(true);
  messageText->setText( message );
  
  
  bottomFrame = new QFrame( this );

  okButton = new QPushButton( tr("Yes"), bottomFrame );
  okButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
  okButton->setDefault(true);
  okButton->setFocus();

  connect( okButton, SIGNAL(clicked()), SLOT(accept()) );

  cancelButton = new QPushButton( tr("No"), bottomFrame );
  cancelButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
  connect( cancelButton, SIGNAL(clicked()), SLOT(reject()) );
  //-------------------------------
  //create grid and place widgets
  gridTop     = new QGridLayout( topFrame, 1, 2, 0);
  gridTop->addWidget( questionText, 0, 0 );
  gridTop->addWidget( questionIconLabel, 0, 1, Qt::AlignRight );

  gridBottom  = new QGridLayout( bottomFrame, 1, 2, 0);
  gridBottom->addWidget( okButton, 0, 0 );
  gridBottom->addWidget( cancelButton, 0, 1);

  gridFull    = new QGridLayout( this, 3, 1, 0);
  gridFull->addWidget( topFrame, 0, 0);
  gridFull->addWidget( messageText, 1, 0);
  gridFull->addWidget( bottomFrame, 2, 0);

  gridFull->setRowStretch( 1, 1 );
  gridFull->setResizeMode( QLayout::FreeResize );
  gridFull->setMargin(WIDGET_SPACING);
  gridFull->setSpacing(WIDGET_SPACING);

  //-------------------------------
  //setup window title bar
  setCaption( question );
  //-------------------------------
  //set window to not be resizeable
  setMinimumWidth(300);
  this->show();
  setFixedSize(size());
  //-------------------------------
}
QuestionDialog::~QuestionDialog ( )

Destructor.

Definition at line 95 of file questionDialog.cpp.

References questionIcon.

{
  delete questionIcon;
}

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: