KNewStuff
imagepreviewwidget.h
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2010 Frederik Gladhorn <gladhorn@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Lesser General Public 00006 License as published by the Free Software Foundation; either 00007 version 2.1 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Lesser General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public 00015 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #ifndef KNEWSTUFF3_UI_IMAGEPREVIEWWIDGET_H 00019 #define KNEWSTUFF3_UI_IMAGEPREVIEWWIDGET_H 00020 00021 #include <QtGui/QWidget> 00022 #include <QtGui/QImage> 00023 00024 namespace KNS3 { 00025 00026 class ImagePreviewWidget : public QWidget 00027 { 00028 Q_OBJECT 00029 public: 00030 explicit ImagePreviewWidget(QWidget *parent = 0); 00031 00032 void setImage(const QImage& preview); 00033 00034 virtual QSize sizeHint() const; 00035 00036 signals: 00037 void clicked(); 00038 00039 protected: 00040 virtual void paintEvent(QPaintEvent* event); 00041 virtual void resizeEvent(QResizeEvent* event); 00042 virtual void mousePressEvent(QMouseEvent* event); 00043 00044 private: 00045 QImage m_image; 00046 QImage m_scaledImage; 00047 QPixmap m_frameImage; 00048 }; 00049 00050 } 00051 00052 #endif // IMAGEPREVIEWWIDGET_H
KDE 4.6 API Reference