CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Loading...
Searching...
No Matches
ctkThumbnailLabel.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 __ctkThumbnailLabel_h
22#define __ctkThumbnailLabel_h
23
24// Qt includes
25#include <QWidget>
26#include <QModelIndex>
27
28#include "ctkWidgetsExport.h"
29
30class ctkThumbnailLabelPrivate;
31
38class CTK_WIDGETS_EXPORT ctkThumbnailLabel : public QWidget
39{
40 Q_OBJECT
43 Q_PROPERTY(QString text READ text WRITE setText)
48 Q_PROPERTY(Qt::Alignment textPosition READ textPosition WRITE setTextPosition)
51 Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
54 Q_PROPERTY(Qt::TransformationMode transformationMode READ transformationMode WRITE setTransformationMode)
58 Q_PROPERTY(bool selected READ isSelected WRITE setSelected)
61 Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)
62public:
63 typedef QWidget Superclass;
64 explicit ctkThumbnailLabel(QWidget* parent=0);
66
67 void setText(const QString& text);
68 QString text()const;
69
70 void setTextPosition(const Qt::Alignment& alignment);
71 Qt::Alignment textPosition()const;
72
73 void setPixmap(const QPixmap& pixmap);
74 const QPixmap* pixmap()const;
75
76 Qt::TransformationMode transformationMode()const;
77 void setTransformationMode(Qt::TransformationMode mode);
78
79 void setSelected(bool selected);
80 bool isSelected()const;
81
82 void setSelectedColor(const QColor& color);
83 QColor selectedColor()const;
84
85 virtual QSize minimumSizeHint()const;
86 virtual QSize sizeHint()const;
87 virtual int heightForWidth(int width)const;
88
89protected:
90 QScopedPointer<ctkThumbnailLabelPrivate> d_ptr;
91
92 virtual void paintEvent(QPaintEvent* event);
93 virtual void mousePressEvent(QMouseEvent* event);
94 virtual void mouseDoubleClickEvent(QMouseEvent* event);
95
96 virtual void resizeEvent(QResizeEvent* event);
97
98private:
99 Q_DECLARE_PRIVATE(ctkThumbnailLabel);
100 Q_DISABLE_COPY(ctkThumbnailLabel);
101
102Q_SIGNALS:
103 void selected(const ctkThumbnailLabel& widget);
104 void doubleClicked(const ctkThumbnailLabel& widget);
105};
106
107#endif
virtual QSize sizeHint() const
void setSelectedColor(const QColor &color)
QScopedPointer< ctkThumbnailLabelPrivate > d_ptr
void setTransformationMode(Qt::TransformationMode mode)
void setSelected(bool selected)
QString text() const
virtual QSize minimumSizeHint() const
Qt::Alignment textPosition() const
const QPixmap * pixmap() const
virtual void mousePressEvent(QMouseEvent *event)
Qt::TransformationMode transformationMode() const
virtual int heightForWidth(int width) const
void selected(const ctkThumbnailLabel &widget)
void setTextPosition(const Qt::Alignment &alignment)
ctkThumbnailLabel(QWidget *parent=0)
void setPixmap(const QPixmap &pixmap)
virtual void mouseDoubleClickEvent(QMouseEvent *event)
virtual void paintEvent(QPaintEvent *event)
bool isSelected() const
void doubleClicked(const ctkThumbnailLabel &widget)
void setText(const QString &text)
QColor selectedColor() const
virtual ~ctkThumbnailLabel()
virtual void resizeEvent(QResizeEvent *event)