Fix for QMainWindow style problem
This commit is contained in:
parent
57ab7d2e0f
commit
bbe0e15be2
|
@ -985,7 +985,7 @@ class Spin(Element):
|
||||||
self.setRange(0, len(strings) - 1)
|
self.setRange(0, len(strings) - 1)
|
||||||
|
|
||||||
def textFromValue(self, value):
|
def textFromValue(self, value):
|
||||||
return self._strings[value]
|
return str(self._strings[value])
|
||||||
|
|
||||||
def valueFromText(self, text):
|
def valueFromText(self, text):
|
||||||
return self._values[text]
|
return self._values[text]
|
||||||
|
@ -4384,6 +4384,20 @@ def AddMenuItem(top_menu, sub_menu_info, element, is_sub_menu=False, skip=False)
|
||||||
# ===================================== TK CODE STARTS HERE ====================================================== #
|
# ===================================== TK CODE STARTS HERE ====================================================== #
|
||||||
# ------------------------------------------------------------------------------------------------------------------ #
|
# ------------------------------------------------------------------------------------------------------------------ #
|
||||||
# ------------------------------------------------------------------------------------------------------------------ #
|
# ------------------------------------------------------------------------------------------------------------------ #
|
||||||
|
def style_entry(**kwargs):
|
||||||
|
generated_style = ''
|
||||||
|
for Qt_property, value in kwargs.items():
|
||||||
|
generated_style += "\t{} : {};\n".format(Qt_property.replace('_','-'), value)
|
||||||
|
|
||||||
|
# generated_style += "}"
|
||||||
|
return generated_style
|
||||||
|
|
||||||
|
def generate_style(qt_element_type, entries):
|
||||||
|
generated_style = qt_element_type + " {\n"
|
||||||
|
generated_style += entries
|
||||||
|
generated_style += "}"
|
||||||
|
return generated_style
|
||||||
|
|
||||||
|
|
||||||
def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
||||||
|
|
||||||
|
@ -4593,15 +4607,15 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
||||||
element.QT_QLineEdit.setAlignment(Qt.AlignRight)
|
element.QT_QLineEdit.setAlignment(Qt.AlignRight)
|
||||||
|
|
||||||
element.QT_QLineEdit.setText(str(default_text))
|
element.QT_QLineEdit.setText(str(default_text))
|
||||||
style = 'QLineEdit {'
|
|
||||||
style += create_style_from_font(font)
|
style = create_style_from_font(font)
|
||||||
if element.TextColor is not None:
|
if element.TextColor is not None and element.TextColor != COLOR_SYSTEM_DEFAULT:
|
||||||
style += 'color: %s;' % element.TextColor
|
style += style_entry(color=element.TextColor)
|
||||||
if element.BackgroundColor is not None:
|
if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT:
|
||||||
style += 'background-color: %s;' % element.BackgroundColor
|
style += style_entry(background_color=element.BackgroundColor)
|
||||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
style += style_entry(margin ='{}px {}px {}px {}px;'.format(*full_element_pad),
|
||||||
style += 'border: {}px solid gray; '.format(border_depth)
|
border='{}px solid gray; '.format(border_depth))
|
||||||
style += '}'
|
style = generate_style('QLineEdit', style)
|
||||||
element.QT_QLineEdit.setStyleSheet(style)
|
element.QT_QLineEdit.setStyleSheet(style)
|
||||||
|
|
||||||
if element.AutoSizeText is False or toplevel_win.AutoSizeText is False or element.Size[0] is not None:
|
if element.AutoSizeText is False or toplevel_win.AutoSizeText is False or element.Size[0] is not None:
|
||||||
|
@ -5029,8 +5043,11 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
||||||
element.QT_QGraphicsView.setScene(element.QT_QGraphicsScene)
|
element.QT_QGraphicsView.setScene(element.QT_QGraphicsScene)
|
||||||
style = ''
|
style = ''
|
||||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||||
|
|
||||||
|
print(style)
|
||||||
element.QT_QGraphicsView.setStyleSheet(style)
|
element.QT_QGraphicsView.setStyleSheet(style)
|
||||||
|
|
||||||
|
|
||||||
qgraphicsview.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
qgraphicsview.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||||
qgraphicsview.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
qgraphicsview.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||||
# qt_row_layout.setContentsMargins(*full_element_pad)
|
# qt_row_layout.setContentsMargins(*full_element_pad)
|
||||||
|
@ -5518,11 +5535,12 @@ def StartupTK(window):
|
||||||
# window.QTWindow.setWindowFlags(Qt.WindowStaysOnTopHint)
|
# window.QTWindow.setWindowFlags(Qt.WindowStaysOnTopHint)
|
||||||
|
|
||||||
|
|
||||||
style = 'QMainWindow {'
|
# style = 'QMainWindow {'
|
||||||
|
# style = window.QT_QMainWindow.styleSheet()
|
||||||
if window.BackgroundColor is not None and window.BackgroundColor != COLOR_SYSTEM_DEFAULT:
|
if window.BackgroundColor is not None and window.BackgroundColor != COLOR_SYSTEM_DEFAULT:
|
||||||
style += 'background-color: %s;' % window.BackgroundColor
|
style = 'background-color: %s;' % window.BackgroundColor
|
||||||
style += '}'
|
# style += '}'
|
||||||
window.QT_QMainWindow.setStyleSheet(style)
|
window.QT_QMainWindow.setStyleSheet(style)
|
||||||
|
|
||||||
if window.BackgroundImage is not None:
|
if window.BackgroundImage is not None:
|
||||||
qlabel = QLabel(window.QTWindow)
|
qlabel = QLabel(window.QTWindow)
|
||||||
|
|
Loading…
Reference in New Issue