CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkThumbnailListWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkThumbnailListWidget_h
22 #define __ctkThumbnailListWidget_h
23 
24 // Qt includes
25 #include <QWidget>
26 class QResizeEvent;
27 
28 // CTK includes
29 #include "ctkWidgetsExport.h"
30 class ctkThumbnailListWidgetPrivate;
31 class ctkThumbnailLabel;
32 
34 class CTK_WIDGETS_EXPORT ctkThumbnailListWidget : public QWidget
35 {
36  Q_OBJECT
37  Q_PROPERTY(int currentThumbnail READ currentThumbnail WRITE setCurrentThumbnail)
38  Q_PROPERTY(Qt::Orientation flow READ flow WRITE setFlow)
39  Q_PROPERTY(QSize thumbnailSize READ thumbnailSize WRITE setThumbnailSize)
40 public:
41  typedef QWidget Superclass;
42  explicit ctkThumbnailListWidget(QWidget* parent=0);
44 
46  void addThumbnail(const QPixmap& thumbnail, const QString& label = QString());
47 
49  void addThumbnails(const QList<QPixmap>& thumbnails);
50 
52  void setCurrentThumbnail(int index);
53 
56 
59 
63  void setFlow(Qt::Orientation orientation);
64  Qt::Orientation flow()const;
65 
67  QSize thumbnailSize()const;
68 
69  virtual bool eventFilter(QObject* watched, QEvent* event);
70 
71 public Q_SLOTS:
73  void setThumbnailSize(QSize size);
74 
75 Q_SIGNALS:
76  void selected(const ctkThumbnailLabel& widget);
77  void doubleClicked(const ctkThumbnailLabel& widget);
78 
79 protected Q_SLOTS:
81  void updateLayout();
82 
83 protected:
84  explicit ctkThumbnailListWidget(ctkThumbnailListWidgetPrivate* ptr, QWidget* parent=0);
85  ctkThumbnailListWidgetPrivate* d_ptr;
86 
87  virtual void resizeEvent(QResizeEvent* event);
88 
89 private:
90  Q_DECLARE_PRIVATE(ctkThumbnailListWidget);
91  Q_DISABLE_COPY(ctkThumbnailListWidget);
92 
93 };
94 
95 #endif
void onThumbnailSelected(const ctkThumbnailLabel &widget)
void addThumbnails(const QList< QPixmap > &thumbnails)
Add multiple thumbnails to the widget.
void setCurrentThumbnail(int index)
Set current thumbnail.
QSize thumbnailSize() const
Get thumbnail width.
void addThumbnail(const QPixmap &thumbnail, const QString &label=QString())
Add a thumbnail to the widget.
void selected(const ctkThumbnailLabel &widget)
Qt::Orientation flow() const
ctkThumbnailListWidget(ctkThumbnailListWidgetPrivate *ptr, QWidget *parent=0)
void setFlow(Qt::Orientation orientation)
void doubleClicked(const ctkThumbnailLabel &widget)
void setThumbnailSize(QSize size)
Set thumbnail width.
ctkThumbnailListWidgetPrivate * d_ptr
void clearThumbnails()
Clear all the thumbnails.
int currentThumbnail()
Get current thumbnail.
virtual bool eventFilter(QObject *watched, QEvent *event)
ctkThumbnailListWidget(QWidget *parent=0)
virtual ~ctkThumbnailListWidget()
virtual void resizeEvent(QResizeEvent *event)