Import a UI schema in PySide

2

I have a PyQt StyleSheet scheme in a separate document that I want to import into a UI.

I'm doing the following:

style_sheet_file = qc.QFile(os.path.join(os.path.dirname(__file__), 'stylesheets', 'scheme.qss'))
        style_sheet_file.open(qc.QFile.ReadOnly)
        self.setStyleSheet(qc.QLatin1String(style_sheet_file.readAll()))

However, I receive the following error in PySide:

  

AttributeError: 'module' object has no attribute 'QLatin1String'

What other alternatives could you use to do such an action?

I tried:

#style_sheet_file = mc.internalVar(usd=1) + 'digital_tutors\stylesheets\scheme.py'
#self.setStyleSheet(style_sheet_file)

and it runs me without error, but I do not care about the file inside the UI. That is, it is as if setSyleSheet was empty.

    
asked by Nestor Colt 17.07.2017 в 14:18
source

1 answer

1
   style_sheet_file = mc.internalVar(usd=1) + 'digital_tutors\stylesheets\scheme.txt'
    with open(style_sheet_file,'r') as styleSheet:
        data = str(styleSheet.read())
        self.setStyleSheet(data)

That's how I solved my problem.

    
answered by 17.07.2017 в 14:55