Просмотр исходного кода

UI: Fix source toolbar color selection on color source

When selecting a color on the color source, if you pressed cancel, it
would cause it to set the color to black.  Instead, make sure to check
isValid() on the returned color value to see if the user pressed cancel
when selecting a color.
jp9000 5 лет назад
Родитель
Сommit
55c21319e0
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      UI/context-bar-controls.cpp

+ 6 - 1
UI/context-bar-controls.cpp

@@ -455,7 +455,12 @@ void ColorSourceToolbar::on_choose_clicked()
 	options |= QColorDialog::DontUseNativeDialog;
 #endif
 
-	color = QColorDialog::getColor(color, this, desc, options);
+	QColor newColor = QColorDialog::getColor(color, this, desc, options);
+	if (!newColor.isValid()) {
+		return;
+	}
+
+	color = newColor;
 	UpdateColor();
 
 	obs_data_t *settings = obs_data_create();