Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Title editor: Convert opacity to QColor alpha level #3331

Merged
merged 1 commit into from
Apr 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/windows/title_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ def btnFontColor_clicked(self):
if col.isValid():
self.set_font_color_elements(col.name(), col.alphaF())
self.update_font_color_button()
self.font_color_code = col

# Something changed, so update temp SVG
self.writeToFile(self.xmldoc)
Expand All @@ -374,7 +373,6 @@ def btnBackgroundColor_clicked(self):
if col.isValid():
self.set_bg_style(col.name(), col.alphaF())
self.update_background_color_button()
self.bg_color_code = col

# Something changed, so update temp SVG
self.writeToFile(self.xmldoc)
Expand Down Expand Up @@ -461,13 +459,13 @@ def update_font_color_button(self):
else:
text_color = QtGui.QColor(Qt.black)

# Convert the opacity into the alpha value
alpha = int(opacity * 65535.0)

# Set the colors of the button
# Set the color of the button, ignoring alpha
self.btnFontColor.setStyleSheet(
"background-color: %s; opacity: %s; color: %s;"
% (color.name(), alpha, text_color.name()))
% (color.name(), 1, text_color.name()))

# Store the opacity as the color's alpha level
color.setAlphaF(opacity)
self.font_color_code = color

def update_background_color_button(self):
Expand Down Expand Up @@ -519,13 +517,13 @@ def update_background_color_button(self):
else:
text_color = QtGui.QColor(Qt.black)

# Convert the opacity into the alpha value
alpha = int(opacity * 65535.0)

# Set the colors of the button
# Set the colors of the button, ignoring opacity
self.btnBackgroundColor.setStyleSheet(
"background-color: %s; opacity: %s; color: %s;"
% (color.name(), alpha, text_color.name()))
% (color.name(), 1, text_color.name()))

# Store the opacity as the color's alpha level
color.setAlphaF(opacity)
self.bg_color_code = color

def set_font_style(self):
Expand Down