/* * ImageDescriptionForm.cpp * * Created on: Oct 6, 2011 * Author: Gapchich Vlad */ #include "ImageDescriptionForm.h" #include #include #include #include #include #include ImageDescriptionForm::ImageDescriptionForm(QWidget *aParent) : QWidget(aParent) { setWindowTitle(tr("Image Description")); layout_v_ = new QVBoxLayout(this); layout_h_ = new QHBoxLayout; image_description_ = new QLineEdit(this); button_ok_ = new QPushButton(this); button_ok_->setText(tr("OK")); button_cancel_ = new QPushButton(this); button_cancel_->setText(tr("Cancel")); layout_v_->addWidget(image_description_); layout_v_->addLayout(layout_h_); layout_h_->addWidget(button_ok_); layout_h_->addWidget(button_cancel_); connect( button_ok_, SIGNAL(clicked()), this, SLOT(setDescription()) ); connect( button_cancel_, SIGNAL(clicked()), this, SLOT(hide()) ); adjustSize(); move(QApplication::desktop()->screen()->rect().center() - rect().center()); } ImageDescriptionForm::~ImageDescriptionForm() { delete image_description_; delete button_ok_; delete button_cancel_; delete layout_v_; } void ImageDescriptionForm::setDescription() { if (!image_description_->text().isEmpty()) { emit descriptionSet(image_description_->text()); hide(); } else QMessageBox::warning( this, tr("Warning!"), tr("Image description is empty"), QMessageBox::Ok, QMessageBox::Cancel ); } /* * */