Skip to main content

Merge qss files by using @import

Project description

qssimport

qssimport allows you to use multiple qt stylesheet files for a single project by merging those stylesheets into a main qss file. Simply create a base .qss file that defines 1 or more @import statements that point to other stylesheets.

Installation

sudo pip install qssimport

Usage

  • The base_dir is the path to the stylesheets
  • The import_def file is assumed to be stored in the stylesheets directory
    • import_def is file where all of the @imports need to be defined
  • The main_stylesheet is an optional argument that defines the name of the compiled stylesheet. if a name is not provided, the program defaults to mainStyle.qss
from qssimport import stylesheet
...
app = QApplication([])
  my_q_stylesheet = stylesheet.Stylesheet(base_dir='/path/to/stylesheets/',
                            import_def_file='imports.qss',
                            main_stylesheet='myStyle.qss')
app.setStyleSheet(my_q_stylesheet.load_stylesheet())
...	   

Example

Given the following:

import.qss
@import "lineEdit.qss";
@import "widget.qss";
lineEdit.qss
QLineEdit{color:#FFF;}
QLineEdit{background:#A06;}
widget.qss
QWidget{background:#434343;}
QWidget#MyWidget{background:#909090;}
The file you specified as main_stylesheet will contain all of the lines from lineEdit.qss and widget.qss
myStyle.qss
QLineEdit{color:#FFF;}
QLineEdit{background:#A06;}
QWidget{background:#434343;}
QWidget#MyWidget{background:#909090;}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qssimport-1.0.2.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qssimport-1.0.2-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file qssimport-1.0.2.tar.gz.

File metadata

  • Download URL: qssimport-1.0.2.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for qssimport-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a43421d1d6a76552c8d2da871a6fb7db4434ab6b11ee72dfc040785b2b943557
MD5 e8c243d0f01d9fa0959f2e67f4299620
BLAKE2b-256 99c3fd6e74ddfbc5b0de248e909ec578b79047c362132b7767355dc8c6b357a9

See more details on using hashes here.

File details

Details for the file qssimport-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: qssimport-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for qssimport-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0b708447b6b580946c72ac0fa0bbb01fa825cc5a9a86d0e163135c0e7e5e42e7
MD5 38d0feae8d9eb41f47049d64c03f6962
BLAKE2b-256 2732feb84633fe512637eef661053f8c327b24578cc6919f22066b17a3fa1709

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page