MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / RectKey

Method RectKey

gui/qt/keypad/rectkey.cpp:3–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "rectkey.h"
2
3RectKey::RectKey(KeyCode keycode, const QRect &textGeometry, const QRect &keyGeometry,
4 const QSize &labelSize,
5 int topLeft, int topRight, int bottomLeft, int bottomRight,
6 const QColor &keyColor, const QColor &textColor, const QColor &secondColor, const QColor &alphaColor,
7 const QString &labelText, const QString &secondText, const QString &alphaText,
8 const QFont &labelFont, const QFont &secondFont, const QFont &alphaFont,
9 Qt::Alignment labelAlign, Qt::Alignment secondAlign, Qt::Alignment alphaAlign)
10 : Key{keycode, textGeometry, keyGeometry, keyColor},
11 mTextColor{textColor}, mSecondColor{secondColor}, mAlphaColor{alphaColor},
12 mLabelAlign{labelAlign}, mSecondAlign{secondAlign}, mAlphaAlign{alphaAlign},
13 mLabelFont{labelFont}, mSecondFont{secondFont.resolve(labelFont)},
14 mAlphaFont{alphaFont.resolve(labelFont)},
15 mSecondText{secondText}, mAlphaText{alphaText} {
16 QRect corner;
17 mLabelText = labelText;
18 mKeyShape.moveTo(keyGeometry.topLeft() + QPointF{0, topLeft * .5});
19 corner.setSize({bottomLeft, bottomLeft});
20 corner.moveBottomLeft(keyGeometry.bottomLeft());
21 mKeyShape.arcTo(corner, 90 * 2, 90);
22 corner.setSize({bottomRight, bottomRight});
23 corner.moveBottomRight(keyGeometry.bottomRight());
24 mKeyShape.arcTo(corner, 90 * 3, 90);
25 corner.setSize({topRight, topRight});
26 corner.moveTopRight(keyGeometry.topRight());
27 mKeyShape.arcTo(corner, 90 * 0, 90);
28 corner.setSize({topLeft, topLeft});
29 corner.moveTopLeft(keyGeometry.topLeft());
30 mKeyShape.arcTo(corner, 90 * 1, 90);
31
32 mLabelFont.setPixelSize(labelSize.height());
33 mLabelFont.setStretch(labelSize.width() * mLabelFont.stretch() /
34 QFontMetricsF(mLabelFont).size(Qt::TextSingleLine, mLabelText).width());
35}
36
37void RectKey::paint(QPainter &painter) const {
38 Key::paint(painter);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected