AlbumShaper
1.0a3
|
A configurable question dialog that returns true/false. More...
#include <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 |
QGridLayout * | gridFull |
QLabel * | questionText |
Question displayed in window. | |
QTextEdit * | messageText |
Message displayed in window. | |
QPushButton * | okButton |
Ok button. | |
QPushButton * | cancelButton |
Cancel button. | |
QPixmap * | questionIcon |
Question icon. | |
QLabel * | questionIconLabel |
Label which shows question icon. | |
QFrame * | topFrame |
Top and bottom frames. | |
QFrame * | bottomFrame |
A configurable question dialog that returns true/false.
Definition at line 31 of file questionDialog.h.
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; }
QFrame * QuestionDialog::bottomFrame [private] |
Definition at line 69 of file questionDialog.h.
Referenced by QuestionDialog().
QPushButton* QuestionDialog::cancelButton [private] |
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().
QTextEdit* QuestionDialog::messageText [private] |
Message displayed in window.
Definition at line 54 of file questionDialog.h.
Referenced by QuestionDialog().
QPushButton* QuestionDialog::okButton [private] |
QPixmap* QuestionDialog::questionIcon [private] |
Question icon.
Definition at line 63 of file questionDialog.h.
Referenced by QuestionDialog(), and ~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().