MCPcopy Create free account
hub / github.com/ChiyukiGana/Quickinput / SetColor

Method SetColor

source/ui/widget/QColorSelection.h:58–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56
57private:
58 void SetColor(QMouseEvent* e)
59 {
60 QPoint ms = e->pos();
61 QPoint pt(ms.x() + 25, ms.y() + 25);
62 POINT ams; GetCursorPos(&ams);
63 COLORREF rgb = GetPixel(hdc, ams.x, ams.y);
64 if ((pt.x() > vrect.width() - 25) && (pt.y() > vrect.height() - 25)) pt.setX(ms.x() - 45), pt.setY(ms.y() - 45);
65 else { if (pt.x() > vrect.width() - 25) pt.setX(vrect.width() - 25); if (pt.y() > vrect.height() - 25) pt.setY(vrect.height() - 25); }
66 color = qRgb(GetRValue(rgb), GetGValue(rgb), GetBValue(rgb));
67 colorBox.setColor(color);
68 colorBox.move(pt);
69 }
70
71protected:
72 void paintEvent(QPaintEvent*) { if (!end) { QPainter pa(this); pa.fillRect(this->rect(), QColor(127, 127, 127, 1)); } }

Callers

nothing calls this directly

Calls 5

widthMethod · 0.80
heightMethod · 0.80
setColorMethod · 0.80
posMethod · 0.45
moveMethod · 0.45

Tested by

no test coverage detected