mirror of
https://github.com/Linloir/SceneEditor.git
synced 2025-12-18 16:08:11 +08:00
[UI][FIX] Fix color name in style sheet
This commit is contained in:
parent
2fd1d6db24
commit
5ff60b1e86
@ -38,7 +38,7 @@ void RoundedCornerWidget::initializeWidgetUI() {
|
|||||||
_borderWidget = new QWidget(this);
|
_borderWidget = new QWidget(this);
|
||||||
_borderWidget->setObjectName("borderWidget");
|
_borderWidget->setObjectName("borderWidget");
|
||||||
QString borderWidgetStyleSheet =
|
QString borderWidgetStyleSheet =
|
||||||
"QWidget#borderWidget{background-color:#00FFFFFF;border:2px solid " + _borderColor.name() + ";"
|
"QWidget#borderWidget{background-color:#00FFFFFF;border:2px solid " + _borderColor.name(QColor::HexArgb) + ";"
|
||||||
"border-radius:" + QString::number(_cornerRadius) + "px;}";
|
"border-radius:" + QString::number(_cornerRadius) + "px;}";
|
||||||
_borderWidget->setStyleSheet(borderWidgetStyleSheet);
|
_borderWidget->setStyleSheet(borderWidgetStyleSheet);
|
||||||
_borderWidget->setAttribute(Qt::WA_TransparentForMouseEvents);
|
_borderWidget->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
@ -74,10 +74,12 @@ void RoundedCornerWidget::setCornerRadius(int radius) {
|
|||||||
_cornerRadius = radius;
|
_cornerRadius = radius;
|
||||||
|
|
||||||
// Modify the corner radius in the current style sheet of the border widget
|
// Modify the corner radius in the current style sheet of the border widget
|
||||||
|
if (_borderWidget != nullptr) {
|
||||||
QString styleSheet = _borderWidget->styleSheet();
|
QString styleSheet = _borderWidget->styleSheet();
|
||||||
styleSheet.replace(QRegularExpression("border-radius:\\d+px;"),
|
styleSheet.replace(QRegularExpression("border-radius:\\d+px;"),
|
||||||
QString("border-radius:%1px;").arg(_cornerRadius));
|
QString("border-radius:%1px;").arg(_cornerRadius));
|
||||||
_borderWidget->setStyleSheet(styleSheet);
|
_borderWidget->setStyleSheet(styleSheet);
|
||||||
|
}
|
||||||
|
|
||||||
// Reset the mask of the main widget
|
// Reset the mask of the main widget
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
@ -91,10 +93,12 @@ void RoundedCornerWidget::setBorderColor(QColor color) {
|
|||||||
_borderColor = color;
|
_borderColor = color;
|
||||||
|
|
||||||
// Modify the border color in the current style sheet of the border widget
|
// Modify the border color in the current style sheet of the border widget
|
||||||
|
if (_borderWidget != nullptr) {
|
||||||
QString styleSheet = _borderWidget->styleSheet();
|
QString styleSheet = _borderWidget->styleSheet();
|
||||||
styleSheet.replace(QRegularExpression("border:2px solid #\\w+;"),
|
styleSheet.replace(QRegularExpression("border:2px solid #\\w+;"),
|
||||||
QString("border:2px solid %1;").arg(_borderColor.name()));
|
QString("border:2px solid %1;").arg(_borderColor.name(QColor::HexArgb)));
|
||||||
_borderWidget->setStyleSheet(styleSheet);
|
_borderWidget->setStyleSheet(styleSheet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* RoundedCornerWidget::mainWidget() const {
|
QWidget* RoundedCornerWidget::mainWidget() const {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user