LineEditForm.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*!
  2. * \file ImageDescriptionForm.h
  3. *
  4. * Created on: Oct 6, 2011
  5. * Author: Gapchich Vlad
  6. */
  7. #ifndef __LINEEDITFORM_H__
  8. #define __LINEEDITFORM_H__
  9. #include <QWidget>
  10. class QLineEdit;
  11. class QPushButton;
  12. class QVBoxLayout;
  13. class QHBoxLayout;
  14. class QKeyEvent;
  15. //! Enum indicating the purpose why the form was called
  16. enum FormPurpose {
  17. NoPurpose,
  18. ImageDescriptionPurpose,
  19. TaggingPurpose
  20. };
  21. //! \brief A widget with one-line text editor which can be used both for
  22. //! image description or adding tags for the image
  23. /*!
  24. * The number of purposes can be increased by simple adding another purpose
  25. * to the FormPurpose enum and managing it in the code of this class
  26. */
  27. class LineEditForm : public QWidget {
  28. Q_OBJECT
  29. protected:
  30. void keyPressEvent(QKeyEvent *anEvent);
  31. public:
  32. LineEditForm(QWidget *aParent = 0);
  33. virtual ~LineEditForm();
  34. FormPurpose purpose();
  35. public slots:
  36. void setData();
  37. void setDescription();
  38. void setTags();
  39. signals:
  40. void dataSet(QString aData);
  41. private:
  42. //! one-line text editor
  43. QLineEdit *data_;
  44. QPushButton *button_ok_;
  45. QPushButton *button_cancel_;
  46. QVBoxLayout *layout_v_;
  47. QHBoxLayout *layout_h_;
  48. //! keeps the purpose why LineEditForm was called
  49. FormPurpose purpose_;
  50. };
  51. #endif /* __LINEEDITFORM_H__ */
  52. /*
  53. *
  54. */