diff options
-rw-r--r-- | src/settingsui/qtbuttonimageproviderplugin/QtButton.qml | 5 | ||||
-rw-r--r-- | src/settingsui/qtbuttonimageproviderplugin/qtbuttonimageprovider.cpp | 26 |
2 files changed, 19 insertions, 12 deletions
diff --git a/src/settingsui/qtbuttonimageproviderplugin/QtButton.qml b/src/settingsui/qtbuttonimageproviderplugin/QtButton.qml index 9501aa1..6fb61f4 100644 --- a/src/settingsui/qtbuttonimageproviderplugin/QtButton.qml +++ b/src/settingsui/qtbuttonimageproviderplugin/QtButton.qml @@ -34,14 +34,15 @@ Image { sourceSize: Qt.size(width, height) property string state: "enabled" property int cutSize: 10 - property color fillColor: "white" - property color borderColor: "black" + property color fillColor: viewSettings.buttonGreenColor + property color borderColor: mouseArea.pressed ? viewSettings.buttonActiveColor : viewSettings.buttonGreenColor property alias text: buttonText.text signal clicked() width: buttonText.contentWidth + cutSize * 4 MouseArea { + id: mouseArea anchors.fill: parent onClicked: root.clicked() } diff --git a/src/settingsui/qtbuttonimageproviderplugin/qtbuttonimageprovider.cpp b/src/settingsui/qtbuttonimageproviderplugin/qtbuttonimageprovider.cpp index c69b053..3879d9b 100644 --- a/src/settingsui/qtbuttonimageproviderplugin/qtbuttonimageprovider.cpp +++ b/src/settingsui/qtbuttonimageproviderplugin/qtbuttonimageprovider.cpp @@ -78,19 +78,25 @@ public: pixmap.fill(Qt::transparent); QPainter painter(&pixmap); - painter.setRenderHint(QPainter::Antialiasing); - painter.setPen(borderColor); + const qreal borderPenWidth = 2; + QPen borderPen(QBrush(borderColor), borderPenWidth); + borderPen.setJoinStyle(Qt::MiterJoin); + painter.setRenderHint(QPainter::Antialiasing, true); + painter.setPen(borderPen); painter.setBrush(fillColor); QPainterPath path; - path.moveTo(cutSize,0); - path.lineTo(pixmap.width(), 0); - path.lineTo(pixmap.width(), pixmap.height()-cutSize); - path.lineTo(pixmap.width()-cutSize, pixmap.height()); - path.lineTo(0, pixmap.height()); - path.lineTo(0, cutSize); - path.lineTo(cutSize, 0); - path.closeSubpath(); + qreal top = borderPenWidth - 1; + qreal left = borderPenWidth - 1; + qreal bottom = pixmap.height() - borderPenWidth; + qreal right = pixmap.width() - borderPenWidth; + path.moveTo(left + cutSize, top); + path.lineTo(right, top); + path.lineTo(right, bottom - cutSize); + path.lineTo(right - cutSize, bottom); + path.lineTo(left, bottom); + path.lineTo(left, top + cutSize); + path.lineTo(left + cutSize, top); painter.drawPath(path); return pixmap; |