diff --git a/src/qmlcontrols/kquickcontrolsaddons/eventgenerator.cpp b/src/qmlcontrols/kquickcontrolsaddons/eventgenerator.cpp index b361e79..4931117 100644 --- a/src/qmlcontrols/kquickcontrolsaddons/eventgenerator.cpp +++ b/src/qmlcontrols/kquickcontrolsaddons/eventgenerator.cpp @@ -1,149 +1,148 @@ -/*************************************************************************** +/* * Copyright (C) 2015 by Eike Hein * Copyright (C) 2015 Marco Martin * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ #include "eventgenerator.h" #include #include #include EventGenerator::EventGenerator(QObject *parent) : QObject(parent) { } EventGenerator::~EventGenerator() { } void EventGenerator::sendMouseEvent(QQuickItem *item, EventGenerator::MouseEvent type, int x, int y, int button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) { if (!item) { return; } QEvent::Type eventType; switch (type) { case MouseButtonPress: eventType = QEvent::MouseButtonPress; break; case MouseButtonRelease: eventType = QEvent::MouseButtonRelease; break; case MouseMove: eventType = QEvent::MouseMove; break; default: return; } QMouseEvent ev(eventType, QPointF(x, y), (Qt::MouseButton)button, buttons, modifiers); QGuiApplication::sendEvent(item, &ev); } void EventGenerator::sendMouseEventRecursive(QQuickItem *parentItem, EventGenerator::MouseEvent type, int x, int y, int button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) { if (!parentItem) { return; } const QList items = allChildItemsRecursive(parentItem); foreach(QQuickItem *item, items) { sendMouseEvent(item, type, x, y, button, buttons, modifiers); } } void EventGenerator::sendWheelEvent(QQuickItem *item, int x, int y, const QPoint &pixelDelta, const QPoint &angleDelta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) { if (!item || !item->window()) { return; } QPointF pos(x, y); QPointF globalPos(item->window()->mapToGlobal(item->mapToScene(pos).toPoint())); QWheelEvent ev(pos, globalPos, pixelDelta, angleDelta, /* qt4Delta */ 0, /* qt4Orientation */ Qt::Horizontal, buttons, modifiers); QGuiApplication::sendEvent(item, &ev); } void EventGenerator::sendWheelEventRecursive(QQuickItem *parentItem, int x, int y, const QPoint &pixelDelta, const QPoint &angleDelta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) { if (!parentItem) { return; } const QList items = allChildItemsRecursive(parentItem); foreach(QQuickItem *item, items) { sendWheelEvent(item, x, y, pixelDelta, angleDelta, buttons, modifiers); } } void EventGenerator::sendGrabEvent(QQuickItem *item, EventGenerator::GrabEvent type) { if (!item) { return; } QQuickWindow *win = item->window(); if (!win) { return; } switch (type) { case GrabMouse: item->grabMouse(); break; case UngrabMouse: { QEvent ev(QEvent::UngrabMouse); win->sendEvent(item, &ev); return; } default: return; } } void EventGenerator::sendGrabEventRecursive(QQuickItem *parentItem, EventGenerator::GrabEvent type) { if (!parentItem) { return; } const QList items = allChildItemsRecursive(parentItem); foreach(QQuickItem *item, items) { sendGrabEvent(item, type); } } QList EventGenerator::allChildItemsRecursive(QQuickItem *parentItem) { QList itemList; itemList.append(parentItem->childItems()); foreach(QQuickItem *childItem, parentItem->childItems()) { itemList.append(allChildItemsRecursive(childItem)); } return itemList; } diff --git a/src/qmlcontrols/kquickcontrolsaddons/eventgenerator.h b/src/qmlcontrols/kquickcontrolsaddons/eventgenerator.h index 402a964..d456a76 100644 --- a/src/qmlcontrols/kquickcontrolsaddons/eventgenerator.h +++ b/src/qmlcontrols/kquickcontrolsaddons/eventgenerator.h @@ -1,88 +1,88 @@ -/*************************************************************************** +/* * Copyright (C) 2015 by Eike Hein * Copyright (C) 2015 Marco Martin * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + #ifndef EventGenerator_H #define EventGenerator_H #include class QQuickItem; class EventGenerator : public QObject { Q_OBJECT public: enum MouseEvent { MouseButtonPress, MouseButtonRelease, MouseMove }; Q_ENUM(MouseEvent) enum GrabEvent { GrabMouse, UngrabMouse }; Q_ENUM(GrabEvent) EventGenerator(QObject *parent = nullptr); ~EventGenerator(); /** * Send a mouse event of @type to the given @item */ Q_INVOKABLE void sendMouseEvent(QQuickItem *item, EventGenerator::MouseEvent type, int x, int y, int button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); /** * Send a mouse event of @type to the given @item, all its children and descendants */ Q_INVOKABLE void sendMouseEventRecursive(QQuickItem *item, EventGenerator::MouseEvent type, int x, int y, int button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); /** * Send a wheel event to the given @item * * @since 5.16 */ Q_INVOKABLE void sendWheelEvent(QQuickItem *item, int x, int y, const QPoint &pixelDelta, const QPoint &angleDelta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); /** * Send a wheel event to the given @item, all its children and descendants * * @since 5.16 */ Q_INVOKABLE void sendWheelEventRecursive(QQuickItem *item, int x, int y, const QPoint &pixelDelta, const QPoint &angleDelta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); /** * Send a mouse grab event of @type (grab or ungrab) to the given @item */ Q_INVOKABLE void sendGrabEvent(QQuickItem *item, EventGenerator::GrabEvent type); /** * Send a mouse grab event of @type (grab or ungrab) to the given @item, all its children and descendants */ Q_INVOKABLE void sendGrabEventRecursive(QQuickItem *item, EventGenerator::GrabEvent type); private: static QList allChildItemsRecursive(QQuickItem *parentItem); }; #endif diff --git a/src/qmlcontrols/kquickcontrolsaddons/kcmshell.cpp b/src/qmlcontrols/kquickcontrolsaddons/kcmshell.cpp index 809de44..08d0916 100644 --- a/src/qmlcontrols/kquickcontrolsaddons/kcmshell.cpp +++ b/src/qmlcontrols/kquickcontrolsaddons/kcmshell.cpp @@ -1,44 +1,44 @@ -/*************************************************************************** - * Copyright 2015 Kai Uwe Broulik * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ +/* + * Copyright 2015 Kai Uwe Broulik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ #include "kcmshell.h" #include #include KCMShell::KCMShell(QObject *parent) : QObject(parent) { } KCMShell::~KCMShell() { } void KCMShell::open(const QStringList &names) const { QProcess::startDetached(QStringLiteral("kcmshell5"), names); } QStringList KCMShell::authorize(const QStringList &menuIds) const { return KAuthorized::authorizeControlModules(menuIds); } diff --git a/src/qmlcontrols/kquickcontrolsaddons/kcmshell.h b/src/qmlcontrols/kquickcontrolsaddons/kcmshell.h index daef2c1..be15864 100644 --- a/src/qmlcontrols/kquickcontrolsaddons/kcmshell.h +++ b/src/qmlcontrols/kquickcontrolsaddons/kcmshell.h @@ -1,57 +1,57 @@ -/*************************************************************************** - * Copyright 2015 Kai Uwe Broulik * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ +/* + * Copyright 2015 Kai Uwe Broulik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ #ifndef KCMSHELL_H #define KCMSHELL_H #include class KCMShell : public QObject { Q_OBJECT public: explicit KCMShell(QObject *parent = nullptr); virtual ~KCMShell(); public Q_SLOTS: void open(const QStringList &names) const; /** * Check which of the given control modules the user is * allowed to access * * This can be used for example to hide context menu options * that would do nothing if the user wasn't authorized. * * @code * visible: KCMShell.authorize(["org.kde.fooconfig.desktop"]).length > 0 * @endcode * * @param menuIds A list of control module menu IDs * @return The entries in @p menuIds that the user is * authorized to access, may be empty * @sa KAuthorized::authorizeControlModules * @since 5.23 */ QStringList authorize(const QStringList &menuIds) const; }; #endif // KCMSHELL_H diff --git a/src/qmlcontrols/kquickcontrolsaddons/qiconitem.h b/src/qmlcontrols/kquickcontrolsaddons/qiconitem.h index 5068637..6f2b4a1 100644 --- a/src/qmlcontrols/kquickcontrolsaddons/qiconitem.h +++ b/src/qmlcontrols/kquickcontrolsaddons/qiconitem.h @@ -1,82 +1,83 @@ -/*************************************************************************** - * Copyright 2011 Marco Martin * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ +/* + * Copyright 2011 Marco Martin + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + #ifndef QICONITEM_H #define QICONITEM_H #include #include #include class QIconItem : public QQuickItem { Q_OBJECT Q_PROPERTY(QVariant icon READ icon WRITE setIcon NOTIFY iconChanged) Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged) Q_PROPERTY(int implicitWidth READ implicitWidth CONSTANT) Q_PROPERTY(int implicitHeight READ implicitHeight CONSTANT) Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged) Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY stateChanged) public: enum State { - DefaultState, ///The default state. - ActiveState, ///Icon is active. + DefaultState, ///The default state. + ActiveState, ///Icon is active. DisabledState, ///Icon is disabled. SelectedState ///Icon is selected }; Q_ENUM(State) QIconItem(QQuickItem *parent=nullptr); ~QIconItem(); void setIcon(const QVariant &icon); QIcon icon() const; QIconItem::State state() const; void setState(State state); int implicitWidth() const; int implicitHeight() const; void setSmooth(const bool smooth); bool smooth() const; void setEnabled(bool enabled = true); bool enabled() const; QSGNode* updatePaintNode(QSGNode* node, UpdatePaintNodeData* data) Q_DECL_OVERRIDE; Q_SIGNALS: void iconChanged(); void smoothChanged(); void stateChanged(State state); protected: void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; private: QIcon m_icon; bool m_smooth; State m_state; bool m_changed; }; #endif diff --git a/src/qmlcontrols/kquickcontrolsaddons/qimageitem.h b/src/qmlcontrols/kquickcontrolsaddons/qimageitem.h index cc355f6..3af9aa2 100644 --- a/src/qmlcontrols/kquickcontrolsaddons/qimageitem.h +++ b/src/qmlcontrols/kquickcontrolsaddons/qimageitem.h @@ -1,96 +1,97 @@ -/*************************************************************************** - * Copyright 2011 Marco Martin * - * Copyright 2015 Luca Beltrame * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ +/* + * Copyright 2011 Marco Martin + * Copyright 2015 Luca Beltrame + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + #ifndef QIMAGEITEM_H #define QIMAGEITEM_H #include #include class QImageItem : public QQuickPaintedItem { Q_OBJECT Q_PROPERTY(QImage image READ image WRITE setImage NOTIFY imageChanged RESET resetImage) Q_PROPERTY(bool smooth READ smooth WRITE setSmooth) Q_PROPERTY(int nativeWidth READ nativeWidth NOTIFY nativeWidthChanged) Q_PROPERTY(int nativeHeight READ nativeHeight NOTIFY nativeHeightChanged) Q_PROPERTY(int paintedWidth READ paintedWidth NOTIFY paintedWidthChanged) Q_PROPERTY(int paintedHeight READ paintedHeight NOTIFY paintedHeightChanged) Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) Q_PROPERTY(bool null READ isNull NOTIFY nullChanged) public: enum FillMode { Stretch, // the image is scaled to fit PreserveAspectFit, // the image is scaled uniformly to fit without cropping PreserveAspectCrop, // the image is scaled uniformly to fill, cropping if necessary Tile, // the image is duplicated horizontally and vertically TileVertically, // the image is stretched horizontally and tiled vertically TileHorizontally //the image is stretched vertically and tiled horizontally }; Q_ENUM(FillMode) QImageItem(QQuickItem *parent=nullptr); ~QImageItem(); void setImage(const QImage &image); QImage image() const; void resetImage(); void setSmooth(const bool smooth); bool smooth() const; int nativeWidth() const; int nativeHeight() const; int paintedWidth() const; int paintedHeight() const; FillMode fillMode() const; void setFillMode(FillMode mode); void paint(QPainter *painter) Q_DECL_OVERRIDE; bool isNull() const; Q_SIGNALS: void nativeWidthChanged(); void nativeHeightChanged(); void fillModeChanged(); void imageChanged(); void nullChanged(); void paintedWidthChanged(); void paintedHeightChanged(); protected: void geometryChanged(const QRectF & newGeometry, const QRectF & oldGeometry) Q_DECL_OVERRIDE; private: QImage m_image; bool m_smooth; FillMode m_fillMode; QRect m_paintedRect; private Q_SLOTS: void updatePaintedRect(); }; #endif diff --git a/src/qmlcontrols/kquickcontrolsaddons/qpixmapitem.h b/src/qmlcontrols/kquickcontrolsaddons/qpixmapitem.h index 4de3005..7dec859 100644 --- a/src/qmlcontrols/kquickcontrolsaddons/qpixmapitem.h +++ b/src/qmlcontrols/kquickcontrolsaddons/qpixmapitem.h @@ -1,96 +1,97 @@ -/*************************************************************************** - * Copyright 2011 Marco Martin * - * Copyright 2015 Luca Beltrame * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ +/* + * Copyright 2011 Marco Martin + * Copyright 2015 Luca Beltrame + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + #ifndef QPIXMAPITEM_H #define QPIXMAPITEM_H #include #include class QPixmapItem : public QQuickPaintedItem { Q_OBJECT Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap NOTIFY pixmapChanged RESET resetPixmap) Q_PROPERTY(bool smooth READ smooth WRITE setSmooth) Q_PROPERTY(int nativeWidth READ nativeWidth NOTIFY nativeWidthChanged) Q_PROPERTY(int nativeHeight READ nativeHeight NOTIFY nativeHeightChanged) Q_PROPERTY(int paintedWidth READ paintedWidth NOTIFY paintedWidthChanged) Q_PROPERTY(int paintedHeight READ paintedHeight NOTIFY paintedHeightChanged) Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) Q_PROPERTY(bool null READ isNull NOTIFY nullChanged) public: enum FillMode { Stretch, // the image is scaled to fit PreserveAspectFit, // the image is scaled uniformly to fit without cropping PreserveAspectCrop, // the image is scaled uniformly to fill, cropping if necessary Tile, // the image is duplicated horizontally and vertically TileVertically, // the image is stretched horizontally and tiled vertically TileHorizontally //the image is stretched vertically and tiled horizontally }; Q_ENUM(FillMode) QPixmapItem(QQuickItem *parent=nullptr); ~QPixmapItem(); void setPixmap(const QPixmap &pixmap); QPixmap pixmap() const; void resetPixmap(); void setSmooth(const bool smooth); bool smooth() const; int nativeWidth() const; int nativeHeight() const; int paintedWidth() const; int paintedHeight() const; FillMode fillMode() const; void setFillMode(FillMode mode); void paint(QPainter *painter) Q_DECL_OVERRIDE; bool isNull() const; Q_SIGNALS: void nativeWidthChanged(); void nativeHeightChanged(); void fillModeChanged(); void pixmapChanged(); void nullChanged(); void paintedWidthChanged(); void paintedHeightChanged(); protected: void geometryChanged(const QRectF & newGeometry, const QRectF & oldGeometry) Q_DECL_OVERRIDE; private: QPixmap m_pixmap; bool m_smooth; FillMode m_fillMode; QRect m_paintedRect; private Q_SLOTS: void updatePaintedRect(); }; #endif