Krita Source Code Documentation
Loading...
Searching...
No Matches
KisSelectionActionsPanelHandle Class Reference

#include <kis_selection_actions_panel_handle.h>

+ Inheritance diagram for KisSelectionActionsPanelHandle:

Classes

struct  Private
 

Public Member Functions

void draw (QPainter &painter)
 
 KisSelectionActionsPanelHandle (int size, QWidget *parent)
 
void set_held (bool held)
 
 ~KisSelectionActionsPanelHandle ()
 

Private Attributes

QScopedPointer< Privated
 

Detailed Description

Definition at line 12 of file kis_selection_actions_panel_handle.h.

Constructor & Destructor Documentation

◆ KisSelectionActionsPanelHandle()

KisSelectionActionsPanelHandle::KisSelectionActionsPanelHandle ( int size,
QWidget * parent )

Definition at line 19 of file kis_selection_actions_panel_handle.cpp.

19 :
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}
QIcon loadIcon(const QString &name)

References d, and KisIconUtils::loadIcon().

◆ ~KisSelectionActionsPanelHandle()

KisSelectionActionsPanelHandle::~KisSelectionActionsPanelHandle ( )

Definition at line 30 of file kis_selection_actions_panel_handle.cpp.

31{
32}

Member Function Documentation

◆ draw()

void KisSelectionActionsPanelHandle::draw ( QPainter & painter)

Definition at line 46 of file kis_selection_actions_panel_handle.cpp.

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}

References d.

◆ set_held()

void KisSelectionActionsPanelHandle::set_held ( bool held)

Definition at line 34 of file kis_selection_actions_panel_handle.cpp.

35{
36 if(held)
37 {
38 this->setCursor(d->held_cursor);
39 }
40 else
41 {
42 this->setCursor(d->default_cursor);
43 }
44}

References d.

Member Data Documentation

◆ d

QScopedPointer<Private> KisSelectionActionsPanelHandle::d
private

Definition at line 21 of file kis_selection_actions_panel_handle.h.


The documentation for this class was generated from the following files: