Browse Source

UI: Make color consistent, don't show alpha value

The color picker loads the label not showing alpha hex value but on
color change then shows the alpha level in the hex value (which is
hardcoded to 255).

This changes so the label always shows only RGB value.

Of course, can be easily changed back to ::Arbg later if a alpha picker
is added.
JohannMG 5 years ago
parent
commit
ae4d7cd528
1 changed files with 6 additions and 5 deletions
  1. 6 5
      UI/properties-view.cpp

+ 6 - 5
UI/properties-view.cpp

@@ -657,14 +657,15 @@ void OBSPropertiesView::AddColor(obs_property_t *prop, QFormLayout *layout,
 
 
 	QPalette palette = QPalette(color);
 	QPalette palette = QPalette(color);
 	colorLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel);
 	colorLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel);
+	// The picker doesn't have an alpha option, show only RGB
 	colorLabel->setText(color.name(QColor::HexRgb));
 	colorLabel->setText(color.name(QColor::HexRgb));
 	colorLabel->setPalette(palette);
 	colorLabel->setPalette(palette);
 	colorLabel->setStyleSheet(
 	colorLabel->setStyleSheet(
 		QString("background-color :%1; color: %2;")
 		QString("background-color :%1; color: %2;")
 			.arg(palette.color(QPalette::Window)
 			.arg(palette.color(QPalette::Window)
-				     .name(QColor::HexArgb))
+				     .name(QColor::HexRgb))
 			.arg(palette.color(QPalette::WindowText)
 			.arg(palette.color(QPalette::WindowText)
-				     .name(QColor::HexArgb)));
+				     .name(QColor::HexRgb)));
 	colorLabel->setAutoFillBackground(true);
 	colorLabel->setAutoFillBackground(true);
 	colorLabel->setAlignment(Qt::AlignCenter);
 	colorLabel->setAlignment(Qt::AlignCenter);
 	colorLabel->setToolTip(QT_UTF8(obs_property_long_description(prop)));
 	colorLabel->setToolTip(QT_UTF8(obs_property_long_description(prop)));
@@ -1710,14 +1711,14 @@ bool WidgetInfo::ColorChanged(const char *setting)
 		return false;
 		return false;
 
 
 	QLabel *label = static_cast<QLabel *>(widget);
 	QLabel *label = static_cast<QLabel *>(widget);
-	label->setText(color.name(QColor::HexArgb));
+	label->setText(color.name(QColor::HexRgb));
 	QPalette palette = QPalette(color);
 	QPalette palette = QPalette(color);
 	label->setPalette(palette);
 	label->setPalette(palette);
 	label->setStyleSheet(QString("background-color :%1; color: %2;")
 	label->setStyleSheet(QString("background-color :%1; color: %2;")
 				     .arg(palette.color(QPalette::Window)
 				     .arg(palette.color(QPalette::Window)
-						  .name(QColor::HexArgb))
+						  .name(QColor::HexRgb))
 				     .arg(palette.color(QPalette::WindowText)
 				     .arg(palette.color(QPalette::WindowText)
-						  .name(QColor::HexArgb)));
+						  .name(QColor::HexRgb)));
 
 
 	obs_data_set_int(view->settings, setting, color_to_int(color));
 	obs_data_set_int(view->settings, setting, color_to_int(color));