Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_selection_actions_panel_handle.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026 Luna Lovecraft <ciubix8514@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
8#include "kis_icon_utils.h"
9#include <qapplication.h>
10
12{
13 Private(int size) { this->size = size;};
15 QCursor held_cursor;
17 int size;
18};
19
21 QWidget(parent),
22 d(new Private(size))
23{
24 d->default_cursor = Qt::OpenHandCursor;
25 d->held_cursor = Qt::ClosedHandCursor;
26 d->handle_icon = KisIconUtils::loadIcon("drag-handle");
27 this->setCursor(d->default_cursor);
28 setFixedSize(size, size);
29 setAttribute(Qt::WA_AcceptTouchEvents);
30}
31
35
37{
38 if(held)
39 {
40 this->setCursor(d->held_cursor);
41 }
42 else
43 {
44 this->setCursor(d->default_cursor);
45 }
46}
47
49{
50 QRect rect = geometry();
51
52 // Adjust the rect a bit to fill the right side of the bar properly
53 painter.fillRect(rect.marginsAdded(QMargins(-3, 4, 1, 4)), qApp->palette().window().color());
54
55 // Adjusting the icon location a bit to be properly centered
56 d->handle_icon.paint(&painter, QRect(rect.x() + 3, rect.y(), d->size, d->size));
57}
QIcon loadIcon(const QString &name)