A dark stylesheet for Qt applications.
This project is licensed under the MIT license.
Install the qdarkstyle package using the setup script or using pip:
python setup.py install
or
pip install qdarkstyle
- Download/clone the project and copy the following files to your application directory (keep the existing directory hierarchy):
- qdarkstyle/style.qss
- qdarkstyle/style.qrc
- qdarkstyle/rc/ (the whole directory)
-
Add qdarkstyle/style.qrc to your .pro file
-
Add qdarkstyle/style.qss to your resources.
-
Load the stylesheet:
QFile data(":path/to/style.qss"); // TODO: set your own resource path
if (!f.exists())
{
printf("Unable to set stylesheet, file not found\n");
}
else
{
f.open(QFile::ReadOnly | QFile::Text);
QTextStream ts(&data);
QApplication::instance()->setStyleSheet(ts.readAll());
}
Here is an example using PySide:
import sys
import qdarkstyle
from PySide import QtGui
# create the application and the main window
app = QtGui.QApplication(sys.argv)
window = QtGui.QMainWindow()
# setup stylesheet
app.setStyleSheet(qdarkstyle.load_stylesheet())
# run
window.show()
app.exec_()
To use PyQt4 instead of PySide, you just need to replace
app.setStyleSheet(qdarkstyle.load_stylesheet())
by
app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False))
There is an example included in the example folder. You can run the script without installing qdarkstyle. You only need to have PySide or PyQt4 installed on your system.
The following widgets are styled:
- QMainWindow
- QWidget
- QMenu, QMenuBar
- QToolTip
- QAbstractItemView
- QLineEdit
- QGroupBox
- QTextEdit, QPlainTextEdit
- QTreeView,
- QScrollBar
- QRadioButton
- QCheckBox
- QComboBox
- QPushButton
- QToolButton
- QToolBar
- QProgressBar
- QSpinBox
- QFrame
- QTabWidget, QTabBar
- QDockWidget
- QSlider (horizontal and vertical)
What still needs to be done:
- QAbstractScrollArea
- QSplitter
- QStatusBar
- QToolBox
* 1.3:
- remove outline on button, checkbox and radio button
- add support for closable tabs
- better disabled buttons
- fix QTextEdit background color to match the color of QPlainTextEdit and QLineEdit
- better hover/selected states for QTreeView and QListView
- add QHeaderView support
* 1.2:
- Improve QTableView support
* 1.1:
- Switch to MIT license
- Add python 3 support
* 1.0:
- First public release (LGPL v2)
- Maintainer: colin.duquesnoy@gmail.com
- Homepage: https://github.com/ColinDuquesnoy/QDarkStyleSheet
Here are the snapshots of the example application:
![alt text](/screenshots/QDarkStyle example 1.png "QDarkStyle example 1") ![alt text](/screenshots/QDarkStyle example 2.png "QDarkStyle example 2")
And here is a snapshot of an internal app I made at work: