ctkThumbnailListWidget.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkThumbnailListWidget_h
  15. #define __ctkThumbnailListWidget_h
  16. // Qt includes
  17. #include <QWidget>
  18. #include "ctkWidgetsExport.h"
  19. class QModelIndex;
  20. class ctkThumbnailListWidgetPrivate;
  21. class ctkThumbnailLabel;
  22. class CTK_WIDGETS_EXPORT ctkThumbnailListWidget : public QWidget
  23. {
  24. Q_OBJECT
  25. Q_PROPERTY(int currentThumbnail READ currentThumbnail WRITE setCurrentThumbnail)
  26. Q_PROPERTY(QSize thumbnailSize READ thumbnailSize WRITE setThumbnailSize)
  27. public:
  28. typedef QWidget Superclass;
  29. explicit ctkThumbnailListWidget(QWidget* parent=0);
  30. virtual ~ctkThumbnailListWidget();
  31. /// Add multiple thumbnails to the widget
  32. void addThumbnails(QList<QPixmap> thumbnails);
  33. /// Set current thumbnail
  34. void setCurrentThumbnail(int index);
  35. /// Get current thumbnail
  36. int currentThumbnail();
  37. /// Clear all the thumbnails
  38. void clearThumbnails();
  39. /// Get thumbnail width
  40. QSize thumbnailSize()const;
  41. public slots:
  42. /// Set thumbnail width
  43. void setThumbnailSize(QSize size);
  44. signals:
  45. void selected(const ctkThumbnailLabel& widget);
  46. void doubleClicked(const ctkThumbnailLabel& widget);
  47. protected slots:
  48. void onThumbnailSelected(const ctkThumbnailLabel& widget);
  49. protected:
  50. explicit ctkThumbnailListWidget(ctkThumbnailListWidgetPrivate* ptr, QWidget* parent=0);
  51. ctkThumbnailListWidgetPrivate* d_ptr;
  52. private:
  53. Q_DECLARE_PRIVATE(ctkThumbnailListWidget);
  54. Q_DISABLE_COPY(ctkThumbnailListWidget);
  55. };
  56. #endif