• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kde-runtime API Reference
  • KDE Home
  • Contact Us
 

QtExtraComponents

  • sources
  • kde-4.14
  • kde-runtime
  • plasma
  • declarativeimports
  • qtextracomponents
qimageitem.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Marco Martin <mart@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Library General Public License as
6  * published by the Free Software Foundation; either version 2, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef QIMAGEITEM_H
21 #define QIMAGEITEM_H
22 
23 #include <QDeclarativeItem>
24 #include <QImage>
25 
26 class QImageItem : public QDeclarativeItem
27 {
28  Q_OBJECT
29 
30  Q_PROPERTY(QImage image READ image WRITE setImage NOTIFY imageChanged)
31  Q_PROPERTY(bool smooth READ smooth WRITE setSmooth)
32  Q_PROPERTY(int nativeWidth READ nativeWidth NOTIFY nativeWidthChanged)
33  Q_PROPERTY(int nativeHeight READ nativeHeight NOTIFY nativeHeightChanged)
34  Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
35  Q_PROPERTY(bool null READ isNull NOTIFY nullChanged)
36  Q_ENUMS(FillMode)
37 
38 public:
39  enum FillMode {
40  Stretch, // the image is scaled to fit
41  PreserveAspectFit, // the image is scaled uniformly to fit without cropping
42  PreserveAspectCrop, // the image is scaled uniformly to fill, cropping if necessary
43  Tile, // the image is duplicated horizontally and vertically
44  TileVertically, // the image is stretched horizontally and tiled vertically
45  TileHorizontally //the image is stretched vertically and tiled horizontally
46  };
47 
48  QImageItem(QDeclarativeItem *parent=0);
49  ~QImageItem();
50 
51  void setImage(const QImage &image);
52  QImage image() const;
53 
54  void setSmooth(const bool smooth);
55  bool smooth() const;
56 
57  int nativeWidth() const;
58  int nativeHeight() const;
59 
60  FillMode fillMode() const;
61  void setFillMode(FillMode mode);
62 
63  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
64 
65  bool isNull() const;
66 
67 Q_SIGNALS:
68  void nativeWidthChanged();
69  void nativeHeightChanged();
70  void fillModeChanged();
71  void imageChanged();
72  void nullChanged();
73 
74 private:
75  QImage m_image;
76  bool m_smooth;
77  FillMode m_fillMode;
78 };
79 
80 #endif
QImageItem::nullChanged
void nullChanged()
QImageItem::Tile
Definition: qimageitem.h:43
QWidget
QImageItem::TileVertically
Definition: qimageitem.h:44
QImageItem::setFillMode
void setFillMode(FillMode mode)
Definition: qimageitem.cpp:85
QImageItem::nativeWidth
int nativeWidth() const
QImageItem::PreserveAspectCrop
Definition: qimageitem.h:42
QImageItem::~QImageItem
~QImageItem()
Definition: qimageitem.cpp:34
QImageItem::FillMode
FillMode
Definition: qimageitem.h:39
QImageItem::isNull
bool isNull() const
Definition: qimageitem.cpp:152
QPainter
QImageItem::setSmooth
void setSmooth(const bool smooth)
Definition: qimageitem.cpp:56
QImageItem::image
QImage image() const
QImageItem::nativeHeight
int nativeHeight() const
QImageItem::nativeWidthChanged
void nativeWidthChanged()
QImageItem::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: qimageitem.cpp:96
QImage
QImageItem::Stretch
Definition: qimageitem.h:40
QImageItem
Definition: qimageitem.h:26
QImageItem::fillMode
FillMode fillMode() const
QImageItem::imageChanged
void imageChanged()
QImageItem::QImageItem
QImageItem(QDeclarativeItem *parent=0)
Definition: qimageitem.cpp:25
QImageItem::TileHorizontally
Definition: qimageitem.h:45
QStyleOptionGraphicsItem
QDeclarativeItem
QImageItem::smooth
bool smooth() const
QImageItem::fillModeChanged
void fillModeChanged()
QObject::parent
QObject * parent() const
QImageItem::null
bool null
Definition: qimageitem.h:35
QImageItem::setImage
void setImage(const QImage &image)
Definition: qimageitem.cpp:38
QImageItem::PreserveAspectFit
Definition: qimageitem.h:41
QImageItem::nativeHeightChanged
void nativeHeightChanged()
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:08:49 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

QtExtraComponents

Skip menu "QtExtraComponents"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kde-runtime API Reference

Skip menu "kde-runtime API Reference"
  • KCMShell
  • KNotify
  • Plasma Runtime
  •     PlasmaCore
  •     DragAndDrop
  •     PlasmaComponents
  •     PlasmaExtraComponents
  •     QtExtraComponents

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal