mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-02-03 09:44:24 -05:00
Added qrc file for stylesheets specific resources + a script to compile the qrc to different qt system( qt c++, python qt)
This commit is contained in:
parent
8ecb842a25
commit
d0b29eb734
35
README.md
35
README.md
@ -9,33 +9,31 @@ Usage
|
||||
============
|
||||
|
||||
- Download/clone the project next to your main executable (or wherever you find it fits well)
|
||||
- Compile the qrc file for your system and add it to your application. (simply compile_qrc.py script, it will compile the qrc file for use with Qt (c++), PyQt4 and Pyside.
|
||||
- Load QDarkStyleSheets/style.qss and
|
||||
- Format the stylesheet string to give it the correct location (otherwise
|
||||
resources won't show).
|
||||
People that don't want to format may replace all "%(location)s/" occurrences in the style.qss file by their own resource
|
||||
location.
|
||||
- apply it on your QApplication instance
|
||||
|
||||
Here is a quick snippet in python (PySide/PyQt) that shows how to use the
|
||||
Here is a quick snippet in python (PySide) that shows how to use the
|
||||
stylesheet.
|
||||
|
||||
|
||||
```Python
|
||||
def main():
|
||||
# create the qt application
|
||||
app = QApplication()
|
||||
import sys
|
||||
from PySide import QtGui
|
||||
# import the style resources comiled by compile_rc.py
|
||||
import style_pyside_rc
|
||||
|
||||
# Load the stylesheet
|
||||
f = open("QDarkStyleSheet/style.qss","r")
|
||||
style_sheet = f.read()
|
||||
f.close()
|
||||
# create the application and the main window
|
||||
app = QtGui.QApplication(sys.argv)
|
||||
window = QtGui.QMainWindow()
|
||||
|
||||
# format style_sheet to get the correct resource path.
|
||||
path = "" # here we use the working directory but it might somewhere else
|
||||
style_sheet = style_sheet % {"location":path}
|
||||
|
||||
# apply the stylesheet
|
||||
app.setStyleSheet(style_sheet)
|
||||
# setup stylesheet
|
||||
with open("style.qss", 'r') as stylesheet:
|
||||
app.setStyleSheet(stylesheet.read())
|
||||
|
||||
# run
|
||||
window.show()
|
||||
app.exec_()
|
||||
```
|
||||
|
||||
Status:
|
||||
@ -71,7 +69,6 @@ What still needs to be done:
|
||||
- QAbstractScrollArea
|
||||
- QSplitter
|
||||
- QStatusBar
|
||||
- QTableView
|
||||
- QToolBox
|
||||
|
||||
Contact information:
|
||||
|
18
compile_qrc.py
Executable file
18
compile_qrc.py
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Compiles the qrc file using rcc, pyside-rcc and pyrcc4.
|
||||
"""
|
||||
import os
|
||||
|
||||
# Compile for use with Qt (c++)
|
||||
print("Compiling for Qt: style.qrc -> style.rcc")
|
||||
os.system("rcc style.qrc -o style.rcc")
|
||||
|
||||
# Compile for use with PyQt4
|
||||
print("Compiling for PyQt4: style.qrc -> style_pyqt_rc.py")
|
||||
os.system("pyrcc4 style.qrc -o style_pyqt_rc.py")
|
||||
|
||||
# Compile for use with PySide
|
||||
print("Compiling for PySide: style.qrc -> style_pyside_rc.py")
|
||||
os.system("pyside-rcc style.qrc -o style_pyside_rc.py")
|
||||
|
29
style.qrc
Normal file
29
style.qrc
Normal file
@ -0,0 +1,29 @@
|
||||
<RCC>
|
||||
<qresource prefix="qss_icons">
|
||||
<file>rc/up_arrow_disabled.png</file>
|
||||
<file>rc/Hmovetoolbar.png</file>
|
||||
<file>rc/stylesheet-branch-end.png</file>
|
||||
<file>rc/branch_closed-on.png</file>
|
||||
<file>rc/stylesheet-vline.png</file>
|
||||
<file>rc/branch_closed.png</file>
|
||||
<file>rc/branch_open-on.png</file>
|
||||
<file>rc/transparent.png</file>
|
||||
<file>rc/right_arrow_disabled.png</file>
|
||||
<file>rc/sizegrip.png</file>
|
||||
<file>rc/close.png</file>
|
||||
<file>rc/down_arrow.png</file>
|
||||
<file>rc/Vmovetoolbar.png</file>
|
||||
<file>rc/left_arrow.png</file>
|
||||
<file>rc/stylesheet-branch-more.png</file>
|
||||
<file>rc/up_arrow.png</file>
|
||||
<file>rc/right_arrow.png</file>
|
||||
<file>rc/left_arrow_disabled.png</file>
|
||||
<file>rc/Hsepartoolbar.png</file>
|
||||
<file>rc/checkbox.png</file>
|
||||
<file>rc/branch_open.png</file>
|
||||
<file>rc/Vsepartoolbar.png</file>
|
||||
<file>rc/down_arrow_disabled.png</file>
|
||||
<file>rc/undock.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
65
style.qss
65
style.qss
@ -155,7 +155,7 @@ QScrollBar::handle:horizontal
|
||||
|
||||
QScrollBar::sub-line:horizontal
|
||||
{
|
||||
border-image: url(%(location)s/QDarkStyleSheet/rc/right_arrow_disabled.png);
|
||||
border-image: url(:/qss_icons/rc/right_arrow_disabled.png);
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
subcontrol-position: right;
|
||||
@ -164,8 +164,7 @@ QScrollBar::sub-line:horizontal
|
||||
|
||||
QScrollBar::add-line:horizontal
|
||||
{
|
||||
|
||||
border-image: url(%(location)s/QDarkStyleSheet/rc/left_arrow_disabled.png);
|
||||
border-image: url(:/qss_icons/rc/left_arrow_disabled.png);
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
subcontrol-position: left;
|
||||
@ -174,7 +173,7 @@ QScrollBar::add-line:horizontal
|
||||
|
||||
QScrollBar::sub-line:horizontal:hover,QScrollBar::sub-line:horizontal:on
|
||||
{
|
||||
border-image: url(%(location)s/QDarkStyleSheet/rc/right_arrow.png);
|
||||
border-image: url(:/qss_icons/rc/right_arrow.png);
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
subcontrol-position: right;
|
||||
@ -184,7 +183,7 @@ QScrollBar::sub-line:horizontal:hover,QScrollBar::sub-line:horizontal:on
|
||||
|
||||
QScrollBar::add-line:horizontal:hover, QScrollBar::add-line:horizontal:on
|
||||
{
|
||||
border-image: url(%(location)s/QDarkStyleSheet/rc/left_arrow.png);
|
||||
border-image: url(:/qss_icons/rc/left_arrow.png);
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
subcontrol-position: left;
|
||||
@ -222,7 +221,7 @@ QScrollBar::handle:vertical
|
||||
|
||||
QScrollBar::sub-line:vertical
|
||||
{
|
||||
border-image: url(%(location)s/QDarkStyleSheet/rc/up_arrow_disabled.png);
|
||||
border-image: url(:/qss_icons/rc/up_arrow_disabled.png);
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
subcontrol-position: top;
|
||||
@ -232,7 +231,7 @@ QScrollBar::sub-line:vertical
|
||||
QScrollBar::add-line:vertical
|
||||
{
|
||||
|
||||
border-image: url(%(location)s/QDarkStyleSheet/rc/down_arrow_disabled.png);
|
||||
border-image: url(:/qss_icons/rc/down_arrow_disabled.png);
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
subcontrol-position: bottom;
|
||||
@ -242,7 +241,7 @@ QScrollBar::add-line:vertical
|
||||
QScrollBar::sub-line:vertical:hover,QScrollBar::sub-line:vertical:on
|
||||
{
|
||||
|
||||
border-image: url(%(location)s/QDarkStyleSheet/rc/up_arrow.png);
|
||||
border-image: url(:/qss_icons/rc/up_arrow.png);
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
subcontrol-position: top;
|
||||
@ -252,7 +251,7 @@ QScrollBar::sub-line:vertical:hover,QScrollBar::sub-line:vertical:on
|
||||
|
||||
QScrollBar::add-line:vertical:hover, QScrollBar::add-line:vertical:on
|
||||
{
|
||||
border-image: url(%(location)s/QDarkStyleSheet/rc/down_arrow.png);
|
||||
border-image: url(:/qss_icons/rc/down_arrow.png);
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
subcontrol-position: bottom;
|
||||
@ -299,7 +298,7 @@ QCheckBox:disabled
|
||||
}
|
||||
|
||||
QSizeGrip {
|
||||
image: url(%(location)s/QDarkStyleSheet/rc/sizegrip.png);
|
||||
image: url(:/qss_icons/rc/sizegrip.png);
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
@ -380,7 +379,7 @@ QRadioButton::indicator:hover, QCheckBox::indicator:hover
|
||||
|
||||
QCheckBox::indicator:checked
|
||||
{
|
||||
image:url(%(location)s/QDarkStyleSheet/rc/checkbox.png);
|
||||
image:url(:/qss_icons/rc/checkbox.png);
|
||||
}
|
||||
|
||||
QCheckBox::indicator:disabled, QRadioButton::indicator:disabled
|
||||
@ -405,16 +404,16 @@ QToolBar {
|
||||
}
|
||||
|
||||
QToolBar::handle:horizontal {
|
||||
image: url(%(location)s/QDarkStyleSheet/rc/Hmovetoolbar.png);
|
||||
image: url(:/qss_icons/rc/Hmovetoolbar.png);
|
||||
}
|
||||
QToolBar::handle:vertical {
|
||||
image: url(%(location)s/QDarkStyleSheet/rc/Vmovetoolbar.png);
|
||||
image: url(:/qss_icons/rc/Vmovetoolbar.png);
|
||||
}
|
||||
QToolBar::separator:horizontal {
|
||||
image: url(%(location)s/QDarkStyleSheet/rc/Hsepartoolbar.png);
|
||||
image: url(:/qss_icons/rc/Hsepartoolbar.png);
|
||||
}
|
||||
QToolBar::separator:vertical {
|
||||
image: url(%(location)s/QDarkStyleSheet/rc/Vsepartoolbars.png);
|
||||
image: url(:/qss_icons/rc/Vsepartoolbars.png);
|
||||
}
|
||||
|
||||
QPushButton
|
||||
@ -495,13 +494,13 @@ QComboBox::drop-down
|
||||
|
||||
QComboBox::down-arrow
|
||||
{
|
||||
image: url(%(location)s/QDarkStyleSheet/rc/down_arrow_disabled.png);
|
||||
image: url(:/qss_icons/rc/down_arrow_disabled.png);
|
||||
}
|
||||
|
||||
QComboBox::down-arrow:on, QComboBox::down-arrow:hover,
|
||||
QComboBox::down-arrow:focus
|
||||
{
|
||||
image: url(%(location)s/QDarkStyleSheet/rc/down_arrow.png);
|
||||
image: url(:/qss_icons/rc/down_arrow.png);
|
||||
}
|
||||
|
||||
QPushButton:pressed
|
||||
@ -534,25 +533,25 @@ QAbstractSpinBox:down-button
|
||||
}
|
||||
|
||||
QAbstractSpinBox::up-arrow,QAbstractSpinBox::up-arrow:disabled,QAbstractSpinBox::up-arrow:off {
|
||||
image: url(%(location)s/QDarkStyleSheet/rc/up_arrow_disabled.png);
|
||||
image: url(:/qss_icons/rc/up_arrow_disabled.png);
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
QAbstractSpinBox::up-arrow:hover
|
||||
{
|
||||
image: url(%(location)s/QDarkStyleSheet/rc/up_arrow.png);
|
||||
image: url(:/qss_icons/rc/up_arrow.png);
|
||||
}
|
||||
|
||||
|
||||
QAbstractSpinBox::down-arrow,QAbstractSpinBox::down-arrow:disabled,QAbstractSpinBox::down-arrow:off
|
||||
{
|
||||
image: url(%(location)s/QDarkStyleSheet/rc/down_arrow_disabled.png);
|
||||
image: url(:/qss_icons/rc/down_arrow_disabled.png);
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
QAbstractSpinBox::down-arrow:hover
|
||||
{
|
||||
image: url(%(location)s/QDarkStyleSheet/rc/down_arrow.png);
|
||||
image: url(:/qss_icons/rc/down_arrow.png);
|
||||
}
|
||||
|
||||
|
||||
@ -625,8 +624,8 @@ QTabBar::tab:selected:hover
|
||||
QDockWidget
|
||||
{
|
||||
color: silver;
|
||||
titlebar-close-icon: url(%(location)s/QDarkStyleSheet/rc/close.png);
|
||||
titlebar-normal-icon: url(%(location)s/QDarkStyleSheet/rc/undock.png);
|
||||
titlebar-close-icon: url(:/qss_icons/rc/close.png);
|
||||
titlebar-normal-icon: url(:/qss_icons/rc/undock.png);
|
||||
}
|
||||
|
||||
QDockWidget::title
|
||||
@ -643,8 +642,8 @@ QDockWidget::title
|
||||
|
||||
QDockWidget {
|
||||
border: 1px solid lightgray;
|
||||
titlebar-close-icon: url(%(location)s/QDarkStyleSheet/rc/close.png);
|
||||
titlebar-normal-icon: url(%(location)s/QDarkStyleSheet/rc/undock.png);
|
||||
titlebar-close-icon: url(:/qss_icons/rc/close.png);
|
||||
titlebar-normal-icon: url(:/qss_icons/rc/undock.png);
|
||||
}
|
||||
|
||||
QDockWidget::close-button, QDockWidget::float-button {
|
||||
@ -670,39 +669,39 @@ QTreeView, QListView, QTableView
|
||||
|
||||
QTreeView:branch:selected, QTreeView:branch:hover
|
||||
{
|
||||
background: url(%(location)s/QDarkStyleSheet/rc/transparent.png);
|
||||
background: url(:/qss_icons/rc/transparent.png);
|
||||
}
|
||||
|
||||
QTreeView::branch:has-siblings:!adjoins-item {
|
||||
border-image: url(%(location)s/QDarkStyleSheet/rc/transparent.png);
|
||||
border-image: url(:/qss_icons/rc/transparent.png);
|
||||
}
|
||||
|
||||
QTreeView::branch:has-siblings:adjoins-item {
|
||||
border-image: url(%(location)s/QDarkStyleSheet/rc/transparent.png);
|
||||
border-image: url(:/qss_icons/rc/transparent.png);
|
||||
}
|
||||
|
||||
QTreeView::branch:!has-children:!has-siblings:adjoins-item {
|
||||
border-image: url(%(location)s/QDarkStyleSheet/rc/transparent.png);
|
||||
border-image: url(:/qss_icons/rc/transparent.png);
|
||||
}
|
||||
|
||||
QTreeView::branch:has-children:!has-siblings:closed,
|
||||
QTreeView::branch:closed:has-children:has-siblings {
|
||||
image: url(%(location)s/QDarkStyleSheet/rc/branch_closed.png);
|
||||
image: url(:/qss_icons/rc/branch_closed.png);
|
||||
}
|
||||
|
||||
QTreeView::branch:open:has-children:!has-siblings,
|
||||
QTreeView::branch:open:has-children:has-siblings {
|
||||
image: url(%(location)s/QDarkStyleSheet/rc/branch_open.png);
|
||||
image: url(:/qss_icons/rc/branch_open.png);
|
||||
}
|
||||
|
||||
QTreeView::branch:has-children:!has-siblings:closed:hover,
|
||||
QTreeView::branch:closed:has-children:has-siblings:hover {
|
||||
image: url(%(location)s/QDarkStyleSheet/rc/branch_closed-on.png);
|
||||
image: url(:/qss_icons/rc/branch_closed-on.png);
|
||||
}
|
||||
|
||||
QTreeView::branch:open:has-children:!has-siblings:hover,
|
||||
QTreeView::branch:open:has-children:has-siblings:hover {
|
||||
image: url(%(location)s/QDarkStyleSheet/rc/branch_open-on.png);
|
||||
image: url(:/qss_icons/rc/branch_open-on.png);
|
||||
}
|
||||
|
||||
QSlider::groove:horizontal {
|
||||
|
Loading…
Reference in New Issue
Block a user