AlbumShaper 1.0a3
QuestionDialog Class Reference

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

#include <questionDialog.h>

Inheritance diagram for QuestionDialog:
Collaboration diagram for QuestionDialog:

Public Member Functions

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

Private Attributes

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

Detailed Description

A configurable question dialog that returns true/false.

Definition at line 36 of file questionDialog.h.

Constructor & Destructor Documentation

◆ QuestionDialog()

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

Basic constructor.

Definition at line 28 of file questionDialog.cpp.

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

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

◆ ~QuestionDialog()

QuestionDialog::~QuestionDialog ( )

Destructor.

Definition at line 98 of file questionDialog.cpp.

99{
100 delete questionIcon;
101}

References questionIcon.

Member Data Documentation

◆ bottomFrame

Q3Frame * QuestionDialog::bottomFrame
private

Definition at line 74 of file questionDialog.h.

Referenced by QuestionDialog().

◆ cancelButton

QPushButton* QuestionDialog::cancelButton
private

Cancel button.

Definition at line 65 of file questionDialog.h.

Referenced by QuestionDialog().

◆ gridBottom

Q3GridLayout * QuestionDialog::gridBottom
private

Definition at line 53 of file questionDialog.h.

Referenced by QuestionDialog().

◆ gridFull

Q3GridLayout * QuestionDialog::gridFull
private

Definition at line 53 of file questionDialog.h.

Referenced by QuestionDialog().

◆ gridTop

Q3GridLayout* QuestionDialog::gridTop
private

Grids objects placed in.

Definition at line 53 of file questionDialog.h.

Referenced by QuestionDialog().

◆ messageText

Q3TextEdit* QuestionDialog::messageText
private

Message displayed in window.

Definition at line 59 of file questionDialog.h.

Referenced by QuestionDialog().

◆ okButton

QPushButton* QuestionDialog::okButton
private

Ok button.

Definition at line 62 of file questionDialog.h.

Referenced by QuestionDialog().

◆ questionIcon

QPixmap* QuestionDialog::questionIcon
private

Question icon.

Definition at line 68 of file questionDialog.h.

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

◆ questionIconLabel

QLabel* QuestionDialog::questionIconLabel
private

Label which shows question icon.

Definition at line 71 of file questionDialog.h.

Referenced by QuestionDialog().

◆ questionText

QLabel* QuestionDialog::questionText
private

Question displayed in window.

Definition at line 56 of file questionDialog.h.

Referenced by QuestionDialog().

◆ topFrame

Q3Frame* QuestionDialog::topFrame
private

Top and bottom frames.

Definition at line 74 of file questionDialog.h.

Referenced by QuestionDialog().


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