12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- /*
- * ImageDescriptionForm.cpp
- *
- * Created on: Oct 6, 2011
- * Author: Gapchich Vlad
- */
- #include "ImageDescriptionForm.h"
- #include <QLineEdit>
- #include <QPushButton>
- #include <QBoxLayout>
- #include <QMessageBox>
- #include <QApplication>
- #include <QDesktopWidget>
- 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
- );
- }
- /*
- *
- */
|