ctkTitleComboBox.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. All rights reserved.
  5. Distributed under a BSD License. See LICENSE.txt file.
  6. This software is distributed "AS IS" WITHOUT ANY WARRANTY; without even
  7. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the above copyright notice for more information.
  9. =========================================================================*/
  10. #ifndef __ctkTitleComboBox_h
  11. #define __ctkTitleComboBox_h
  12. // Qt includes
  13. #include <QComboBox>
  14. // CTK includes
  15. #include "CTKWidgetsExport.h"
  16. class CTK_WIDGETS_EXPORT ctkTitleComboBox : public QComboBox
  17. {
  18. Q_OBJECT
  19. Q_PROPERTY(QString title READ title WRITE setTitle)
  20. Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
  21. public:
  22. explicit ctkTitleComboBox(QWidget* parent = 0);
  23. virtual ~ctkTitleComboBox();
  24. void setTitle(const QString&);
  25. QString title()const;
  26. void setIcon(const QIcon&);
  27. QIcon icon()const;
  28. virtual QSize minimumSizeHint()const;
  29. virtual QSize sizeHint()const;
  30. protected:
  31. virtual void paintEvent(QPaintEvent*);
  32. virtual QSize recomputeSizeHint(QSize &sh)const;
  33. QString Title;
  34. QIcon Icon;
  35. private:
  36. mutable QSize MinimumSizeHint;
  37. mutable QSize SizeHint;
  38. };
  39. #endif