2 * The source code is based on qpixeltool.h.
3 * Original license follows.
6 /****************************************************************************
8 ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
9 ** Contact: http://www.qt-project.org/legal
11 ** This file is part of the tools applications of the Qt Toolkit.
13 ** $QT_BEGIN_LICENSE:LGPL$
14 ** Commercial License Usage
15 ** Licensees holding valid commercial Qt licenses may use this file in
16 ** accordance with the commercial license agreement provided with the
17 ** Software or, alternatively, in accordance with the terms contained in
18 ** a written agreement between you and Digia. For licensing terms and
19 ** conditions see http://qt.digia.com/licensing. For further information
20 ** use the contact form at http://qt.digia.com/contact-us.
22 ** GNU Lesser General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU Lesser
24 ** General Public License version 2.1 as published by the Free Software
25 ** Foundation and appearing in the file LICENSE.LGPL included in the
26 ** packaging of this file. Please review the following information to
27 ** ensure the GNU Lesser General Public License version 2.1 requirements
28 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
30 ** In addition, as a special exception, Digia gives you certain additional
31 ** rights. These rights are described in the Digia Qt LGPL Exception
32 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
34 ** GNU General Public License Usage
35 ** Alternatively, this file may be used under the terms of the GNU
36 ** General Public License version 3.0 as published by the Free Software
37 ** Foundation and appearing in the file LICENSE.GPL included in the
38 ** packaging of this file. Please review the following information to
39 ** ensure the GNU General Public License version 3.0 requirements will be
40 ** met: http://www.gnu.org/copyleft/gpl.html.
45 ****************************************************************************/
53 class PixelWidget : public QWidget
57 PixelWidget(QWidget *parent = 0);
60 void setSurface(const QImage &image);
62 QColor colorAtCurrentPosition() const;
65 void zoomChanged(int);
66 void mousePosition(int x, int y);
67 void gridGeometry(const QRect &rect);
70 void timerEvent(QTimerEvent *event);
71 void paintEvent(QPaintEvent *event);
72 void keyPressEvent(QKeyEvent *event);
73 void keyReleaseEvent(QKeyEvent *event);
74 void resizeEvent(QResizeEvent *event);
75 void mouseMoveEvent(QMouseEvent *event);
76 void mousePressEvent(QMouseEvent *event);
77 void mouseReleaseEvent(QMouseEvent *event);
78 void contextMenuEvent(QContextMenuEvent *event);
80 QSize sizeHint() const;
83 void setZoom(int zoom);
84 void setGridSize(int gridSize);
86 void copyToClipboard();
88 void increaseGridSize() { setGridSize(m_gridSize + 1); }
89 void decreaseGridSize() { setGridSize(m_gridSize - 1); }
90 void increaseZoom() { setZoom(m_zoom + 1); }
91 void decreaseZoom() { setZoom(m_zoom - 1); }
94 void startGridSizeVisibleTimer();
95 double zoomValue() const { return m_zoom; }
97 bool m_displayGridSize;
105 int m_displayGridSizeId;
107 QPoint m_lastMousePos;
109 QPoint m_dragCurrent;
113 QColor m_currentColor;
116 #endif // PIXELWIDGET_H