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
11{
12 Private(int size) { this->size = size;};
14 QCursor held_cursor;
16 int size;
17};
18
20 QWidget(parent),
21 d(new Private(size))
22{
23 d->default_cursor = Qt::OpenHandCursor;
24 d->held_cursor = Qt::ClosedHandCursor;
25 d->handle_icon = KisIconUtils::loadIcon("drag-handle");
26 this->setCursor(d->default_cursor);
27 setFixedSize(size, size);
28}
29
33
35{
36 if(held)
37 {
38 this->setCursor(d->held_cursor);
39 }
40 else
41 {
42 this->setCursor(d->default_cursor);
43 }
44}
45
47{
48 QPixmap map = d->handle_icon.pixmap(d->size);
49
50 QRect rect = geometry();
51 //Adjust the rct a bit to fill the right side of the bar properly
52 rect.setY(rect.y() - 4);
53 rect.setHeight(rect.height() + 4);
54 rect.setX(rect.x() + 3);
55 rect.setWidth(rect.width() + 1);
56
57 QColor bgColor = Qt::darkGray;
58 painter.fillRect(rect, bgColor);
59
60 painter.fillRect(rect, bgColor);
61 // Adjusting the icon location a bit to be properly centered
62 painter.drawPixmap(geometry().x() + 3, geometry().y(), map);
63}
QIcon loadIcon(const QString &name)