Changeset 81944 in vbox
- Timestamp:
- Nov 18, 2019 3:38:57 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp
r81881 r81944 154 154 return QPointF(); 155 155 /* Normalize the vector and add it to starting point: */ 156 vectorP0P1 = (fDistance / length) * vectorP0P1 + p0;156 vectorP0P1 = (fDistance / length) * vectorP0P1 + p0; 157 157 return vectorP0P1; 158 158 } … … 189 189 190 190 public: 191 UISoftKeyboardPhysicalLayout(); 191 192 192 193 void setName(const QString &strName); … … 205 206 void updateLockKeyStates(bool fCapsLockState, bool fNumLockState, bool fScrollLockState); 206 207 void reset(); 208 209 void setDefaultKeyWidth(int iDefaultKeyWidth); 210 int defaultKeyWidth() const; 207 211 208 212 /** Returns the sum totalHeight() of all rows(). */ … … 216 220 QString m_strName; 217 221 QVector<UISoftKeyboardRow> m_rows; 222 int m_iDefaultKeyWidth; 218 223 /** Scroll, Num, and Caps Lock keys' states are updated thru some API events. Thus we keep their pointers in a containter. */ 219 224 QMap<int, UISoftKeyboardKey*> m_lockKeys; … … 446 451 const QPainterPath &painterPath() const; 447 452 453 454 void setCornerRadius(float fCornerRadius); 455 448 456 QPolygonF polygonInGlobal() const; 449 457 … … 494 502 * and has precedence over the captions defined in keyboard layout files. */ 495 503 QString m_strStaticCaption; 496 bool m_fIsOSMenuKey; 504 bool m_fIsOSMenuKey; 505 double m_fCornerRadius; 497 506 }; 498 507 … … 539 548 QString baseCaption(int iKeyPosition) const; 540 549 QString shiftCaption(int iKeyPosition) const; 550 541 551 QString altGrCaption(int iKeyPosition) const; 542 552 QString shiftAltGrCaption(int iKeyPosition) const; … … 545 555 bool editedButNotSaved() const; 546 556 547 void setUid(const QUuid &uid);557 void setUid(const QUuid &uid); 548 558 QUuid uid() const; 549 559 550 560 void drawTextInRect(const UISoftKeyboardKey &key, QPainter &painter); 551 552 553 561 554 562 private: … … 893 901 *********************************************************************************************************************************/ 894 902 903 UISoftKeyboardPhysicalLayout::UISoftKeyboardPhysicalLayout() 904 :m_iDefaultKeyWidth(50) 905 { 906 } 907 895 908 void UISoftKeyboardPhysicalLayout::setName(const QString &strName) 896 909 { … … 943 956 updateLockKeyState(fNumLockState, m_lockKeys.value(iNumLockPosition, 0)); 944 957 updateLockKeyState(fScrollLockState, m_lockKeys.value(iScrollLockPosition, 0)); 958 } 959 960 void UISoftKeyboardPhysicalLayout::setDefaultKeyWidth(int iDefaultKeyWidth) 961 { 962 m_iDefaultKeyWidth = iDefaultKeyWidth; 963 } 964 965 int UISoftKeyboardPhysicalLayout::defaultKeyWidth() const 966 { 967 return m_iDefaultKeyWidth; 945 968 } 946 969 … … 1554 1577 , m_enmKeyboardRegion(KeyboardRegion_Main) 1555 1578 , m_fIsOSMenuKey(false) 1579 , m_fCornerRadius(5.) 1556 1580 { 1557 1581 } … … 1734 1758 if (m_points.size() < 3) 1735 1759 return; 1736 qreal fRadius = 5; 1737 m_painterPath = QPainterPath(pointInBetween( fRadius, m_points[0], m_points[1]));1760 1761 m_painterPath = QPainterPath(pointInBetween(m_fCornerRadius, m_points[0], m_points[1])); 1738 1762 for (int i = 0; i < m_points.size(); ++i) 1739 1763 { 1740 QPointF p0 = pointInBetween( fRadius, m_points[(i+1)%m_points.size()], m_points[i]);1741 QPointF p1 = pointInBetween( fRadius, m_points[(i+1)%m_points.size()], m_points[(i+2)%m_points.size()]);1764 QPointF p0 = pointInBetween(m_fCornerRadius, m_points[(i+1)%m_points.size()], m_points[i]); 1765 QPointF p1 = pointInBetween(m_fCornerRadius, m_points[(i+1)%m_points.size()], m_points[(i+2)%m_points.size()]); 1742 1766 m_painterPath.lineTo(p0); 1743 1767 m_painterPath.quadTo(m_points[(i+1)%m_points.size()], p1); 1744 1768 } 1769 } 1770 1771 void UISoftKeyboardKey::setCornerRadius(float fCornerRadius) 1772 { 1773 m_fCornerRadius = fCornerRadius; 1745 1774 } 1746 1775 … … 2249 2278 int unitSize = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin); 2250 2279 float fLedRadius = 0.8 * unitSize; 2251 float fLedMargin = 0.6 * unitSize;2280 float fLedMargin = 5;//0.6 * unitSize; 2252 2281 2253 2282 UISoftKeyboardPhysicalLayout *pPhysicalLayout = findPhysicalLayout(currentLayout.physicalLayoutUuid()); … … 2968 2997 2969 2998 key.setKeyGeometry(QRect(iX, iY, key.width(), key.height())); 2999 key.setCornerRadius(0.1 * newPhysicalLayout->defaultKeyWidth()); 2970 3000 key.setPoints(UIPhysicalLayoutReader::computeKeyVertices(key)); 2971 3001 key.setParentWidget(this); … … 3229 3259 int iDefaultHeight = attributes.value("defaultHeight").toInt(); 3230 3260 QVector<UISoftKeyboardRow> &rows = physicalLayout.rows(); 3261 physicalLayout.setDefaultKeyWidth(iDefaultWidth); 3231 3262 3232 3263 while (m_xmlReader.readNextStartElement())
Note:
See TracChangeset
for help on using the changeset viewer.