2013-03-10 10:32:24 -04:00
|
|
|
QDarkStylesheet
|
2017-05-01 23:13:06 -04:00
|
|
|
===============
|
2013-03-10 10:32:24 -04:00
|
|
|
|
2014-01-02 10:30:44 -05:00
|
|
|
[![Build Status](https://travis-ci.org/ColinDuquesnoy/QDarkStyleSheet.png?branch=master)](https://travis-ci.org/ColinDuquesnoy/QDarkStyleSheet)
|
2015-05-28 13:46:58 -04:00
|
|
|
[![Number of PyPI downloads](https://img.shields.io/pypi/dm/QDarkStyle.svg)](https://pypi.python.org/pypi/QDarkStyle)
|
|
|
|
[![Latest PyPI version](https://img.shields.io/pypi/v/QDarkStyle.svg)](https://pypi.python.org/pypi/QDarkStyle)
|
2014-01-02 10:20:29 -05:00
|
|
|
|
2014-05-17 14:41:39 -04:00
|
|
|
A dark stylesheet for Qt applications (Qt4, Qt5, PySide, PyQt4 and PyQt5).
|
2013-03-10 12:59:50 -04:00
|
|
|
|
|
|
|
|
|
|
|
License
|
2017-05-01 23:13:06 -04:00
|
|
|
=======
|
2013-03-10 12:59:50 -04:00
|
|
|
|
2014-01-02 09:57:14 -05:00
|
|
|
This project is licensed under the MIT license.
|
2013-03-10 12:59:50 -04:00
|
|
|
|
|
|
|
|
|
|
|
Installation
|
2017-05-01 23:13:06 -04:00
|
|
|
============
|
2013-03-10 12:59:50 -04:00
|
|
|
|
2014-01-02 10:25:15 -05:00
|
|
|
Python
|
2017-05-01 23:13:06 -04:00
|
|
|
------
|
2014-01-02 10:25:15 -05:00
|
|
|
|
2014-05-17 14:41:39 -04:00
|
|
|
Install ``qdarkstyle`` package using the *setup* script or using *pip*:
|
2013-03-10 12:59:50 -04:00
|
|
|
|
|
|
|
```bash
|
2013-03-10 16:01:58 -04:00
|
|
|
python setup.py install
|
2013-03-10 12:59:50 -04:00
|
|
|
```
|
2014-01-02 10:25:15 -05:00
|
|
|
|
|
|
|
or
|
|
|
|
|
2013-03-10 12:59:50 -04:00
|
|
|
```bash
|
2013-03-10 16:01:58 -04:00
|
|
|
pip install qdarkstyle
|
2013-03-10 12:59:50 -04:00
|
|
|
```
|
|
|
|
|
2014-01-02 10:25:15 -05:00
|
|
|
C++
|
2017-05-01 23:13:06 -04:00
|
|
|
---
|
2014-01-02 10:25:15 -05:00
|
|
|
|
2014-01-29 11:52:23 -05:00
|
|
|
1) 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)
|
|
|
|
|
|
|
|
2) Add **qdarkstyle/style.qrc** to your **.pro file**
|
|
|
|
|
2014-02-17 09:58:00 -05:00
|
|
|
3) Load the stylesheet:
|
2014-01-29 11:52:23 -05:00
|
|
|
|
2014-01-29 12:07:30 -05:00
|
|
|
```cpp
|
2014-02-17 09:58:00 -05:00
|
|
|
QFile f(":qdarkstyle/style.qss");
|
2014-01-29 12:07:30 -05:00
|
|
|
if (!f.exists())
|
2014-01-29 11:52:23 -05:00
|
|
|
{
|
2014-01-29 12:07:30 -05:00
|
|
|
printf("Unable to set stylesheet, file not found\n");
|
2014-01-29 11:52:23 -05:00
|
|
|
}
|
2016-06-19 08:53:30 -04:00
|
|
|
else
|
2014-01-29 11:52:23 -05:00
|
|
|
{
|
|
|
|
f.open(QFile::ReadOnly | QFile::Text);
|
2014-02-17 09:58:00 -05:00
|
|
|
QTextStream ts(&f);
|
2015-12-12 10:44:49 -05:00
|
|
|
qApp->setStyleSheet(ts.readAll());
|
2014-01-29 11:52:23 -05:00
|
|
|
}
|
2014-01-29 12:07:30 -05:00
|
|
|
|
2014-01-29 11:52:23 -05:00
|
|
|
```
|
|
|
|
|
2014-01-02 10:25:15 -05:00
|
|
|
|
2012-08-23 08:30:23 -04:00
|
|
|
|
2012-11-05 13:42:35 -05:00
|
|
|
Usage
|
2017-05-01 23:13:06 -04:00
|
|
|
=====
|
2012-08-23 09:03:05 -04:00
|
|
|
|
2013-03-10 12:59:50 -04:00
|
|
|
Here is an example using PySide:
|
2012-08-23 09:03:05 -04:00
|
|
|
|
2012-11-05 13:42:35 -05:00
|
|
|
|
|
|
|
```Python
|
2013-03-10 10:23:21 -04:00
|
|
|
import sys
|
2013-03-10 12:59:50 -04:00
|
|
|
import qdarkstyle
|
2013-03-10 10:23:21 -04:00
|
|
|
from PySide import QtGui
|
2013-03-10 12:59:50 -04:00
|
|
|
|
2013-03-10 10:23:21 -04:00
|
|
|
# create the application and the main window
|
|
|
|
app = QtGui.QApplication(sys.argv)
|
|
|
|
window = QtGui.QMainWindow()
|
|
|
|
|
|
|
|
# setup stylesheet
|
2018-01-22 17:25:39 -05:00
|
|
|
app.setStyleSheet(qdarkstyle.load_stylesheet_pyside())
|
2013-03-10 10:23:21 -04:00
|
|
|
|
|
|
|
# run
|
|
|
|
window.show()
|
|
|
|
app.exec_()
|
2012-11-05 13:42:35 -05:00
|
|
|
```
|
2012-08-23 09:03:05 -04:00
|
|
|
|
2018-01-22 17:25:39 -05:00
|
|
|
To use another wrapper for Qt, you just need to replace some lines. See examples bellow.
|
|
|
|
|
|
|
|
To use PyQt4, change two lines:
|
2014-01-02 10:20:29 -05:00
|
|
|
|
|
|
|
```Python
|
2018-01-22 17:25:39 -05:00
|
|
|
from PySide import QtGui
|
|
|
|
app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt())
|
2014-01-02 10:20:29 -05:00
|
|
|
```
|
|
|
|
|
2018-01-22 17:25:39 -05:00
|
|
|
If PyQt5, more lines need to be changed because of its API, see the complete example
|
2014-01-02 10:20:29 -05:00
|
|
|
|
|
|
|
```Python
|
2018-01-22 17:25:39 -05:00
|
|
|
import sys
|
|
|
|
import qdarkstyle
|
|
|
|
from PyQt5 import QtWidgets
|
2013-03-10 12:59:50 -04:00
|
|
|
|
2018-01-22 17:25:39 -05:00
|
|
|
# create the application and the main window
|
|
|
|
app = QtWidgets.QApplication(sys.argv)
|
|
|
|
window = QtWidgets.QMainWindow()
|
|
|
|
|
|
|
|
# setup stylesheet
|
|
|
|
app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
|
|
|
|
|
|
|
|
# run
|
|
|
|
window.show()
|
|
|
|
app.exec_()
|
2015-06-26 08:36:20 -04:00
|
|
|
```
|
|
|
|
|
2018-01-22 17:25:39 -05:00
|
|
|
If your project uses QtPy or you need to set it programmatically, it is far more simple:
|
2015-06-26 08:36:20 -04:00
|
|
|
|
2017-05-01 23:13:06 -04:00
|
|
|
```Python
|
2018-01-22 17:25:39 -05:00
|
|
|
|
|
|
|
import sys
|
|
|
|
import qdarkstyle
|
|
|
|
import os
|
|
|
|
|
|
|
|
# set the environment variable to use a specific wrapper
|
|
|
|
# it can be set to pyqt, pyqt5, pyside or pyside2 (not implemented yet)
|
|
|
|
# you do not need to use QtPy to set this variable
|
|
|
|
os.environ['QT_API'] = 'pyqt'
|
|
|
|
|
|
|
|
# import from QtPy instead of doing it directly
|
|
|
|
# note that QtPy always uses PyQt5 API
|
|
|
|
from qtpy import QtWidgets
|
|
|
|
|
|
|
|
# create the application and the main window
|
|
|
|
app = QtWidgets.QApplication(sys.argv)
|
|
|
|
window = QtWidgets.QMainWindow()
|
|
|
|
|
|
|
|
# setup stylesheet
|
|
|
|
app.setStyleSheet(qdarkstyle.load_stylesheet_from_environment())
|
|
|
|
|
|
|
|
# run
|
|
|
|
window.show()
|
|
|
|
app.exec_()
|
2015-06-26 08:36:20 -04:00
|
|
|
```
|
|
|
|
|
2018-01-22 17:25:39 -05:00
|
|
|
It is also simple if you use PyQtGraph:
|
2014-05-17 14:41:39 -04:00
|
|
|
|
2017-05-01 23:13:06 -04:00
|
|
|
```Python
|
2018-01-22 17:25:39 -05:00
|
|
|
import sys
|
|
|
|
import qdarkstyle
|
|
|
|
import os
|
|
|
|
|
|
|
|
# set the environment variable to use a specific wrapper
|
|
|
|
# it can be set to PyQt, PyQt5, PySide or PySide2 (not implemented yet)
|
|
|
|
os.environ['PYQTGRAPH_QT_LIB'] = 'PyQt'
|
|
|
|
|
|
|
|
# import from pyqtgraph instead of doing it directly
|
|
|
|
# note that PyQtGraph always uses PyQt4 API
|
|
|
|
from pyqtgraph.Qt import QtGui
|
|
|
|
|
|
|
|
# create the application and the main window
|
|
|
|
app = QtGui.QApplication(sys.argv)
|
|
|
|
window = QtGui.QMainWindow()
|
|
|
|
|
|
|
|
# setup stylesheet
|
|
|
|
app.setStyleSheet(qdarkstyle.load_stylesheet_from_environment(is_pyqtgraph=True))
|
|
|
|
|
|
|
|
# run
|
|
|
|
window.show()
|
|
|
|
app.exec_()
|
2017-05-01 23:13:06 -04:00
|
|
|
```
|
|
|
|
|
2014-05-17 14:41:39 -04:00
|
|
|
_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 or PyQt5) installed on your system._
|
2013-03-10 12:59:50 -04:00
|
|
|
|
2012-08-23 09:03:05 -04:00
|
|
|
Status:
|
2017-05-01 23:13:06 -04:00
|
|
|
=======
|
2012-08-23 09:03:05 -04:00
|
|
|
|
2014-02-20 07:29:06 -05:00
|
|
|
Most widgets have been styled. If you find a widget that has not been
|
|
|
|
style, just open an issue on the issue tracker or, better, submit a pull
|
|
|
|
request.
|
2013-03-10 12:59:50 -04:00
|
|
|
|
2014-01-26 10:06:23 -05:00
|
|
|
Changelog
|
2017-05-01 23:13:06 -04:00
|
|
|
=========
|
2018-01-22 17:25:39 -05:00
|
|
|
* 2.4:
|
|
|
|
- Add function to get Qt information from environment variable
|
2015-05-01 07:28:12 -04:00
|
|
|
|
2017-05-13 07:26:33 -04:00
|
|
|
* 2.3.1:
|
|
|
|
- Improve checkbox color (use accent color used in other widgets) and darken view hover/selected colors to play nicer with other widget colors
|
|
|
|
- Shift to the right the first tab
|
|
|
|
- Update license year
|
|
|
|
- Update README.md (fix snapshots links and formatting)
|
|
|
|
- Removed QLineEdit top/bottom padding which cut off text while editing QListView items
|
|
|
|
|
2016-11-27 07:13:06 -05:00
|
|
|
* 2.3.0:
|
|
|
|
- Add support for QDateEdit
|
|
|
|
|
2016-11-20 11:44:59 -05:00
|
|
|
* 2.2.2:
|
|
|
|
- Add hover to unselected item in QListView/QTreeView
|
|
|
|
- Fixes for vertical QToolBar, QToolBar Extend Button & QTabWidget's Pane Misalignment
|
|
|
|
- Fixed consistency of QTabBar depending on position
|
|
|
|
|
2016-07-17 11:52:12 -04:00
|
|
|
* 2.2.1:
|
|
|
|
- remove border of status bar widgets
|
|
|
|
|
2016-06-19 08:53:30 -04:00
|
|
|
* 2.2:
|
|
|
|
- Major update of the color scheme based on the Breeze Dark theme of KDE 5
|
|
|
|
- fix issues #29, #30, #31, #32 and #35
|
2015-06-28 08:20:33 -04:00
|
|
|
* 2.1:
|
|
|
|
- Add style for QPushButton:checked
|
|
|
|
- Improve QCheckBox and QRadioButton style
|
|
|
|
- Add style for QMenu::right-arrow
|
2015-05-01 07:28:12 -04:00
|
|
|
* 2.0: Improve stylesheet to make it look a bit more modern (see pull request #25)
|
2015-04-06 06:00:12 -04:00
|
|
|
* 1.16: fix QGroupBox title padding (see issue #20)
|
2015-01-10 06:05:53 -05:00
|
|
|
* 1.15: improve tristate checkbox graphics: undetermined state is now represented by a dash
|
2015-01-09 11:27:07 -05:00
|
|
|
* 1.14: add support for tristate check boxes and for vertical and horizontal lines
|
2014-12-16 11:44:00 -05:00
|
|
|
* 1.13: fix issue with horizontal scrollbar arrows, left and right were inversed.
|
2014-09-11 09:29:24 -04:00
|
|
|
* 1.12: fix minimum size of input widgets (see issue #14)
|
2014-05-29 18:05:01 -04:00
|
|
|
* 1.11:
|
|
|
|
- Fix QDockWidget title position on Mac.
|
|
|
|
- Add QStatusBar support
|
|
|
|
- Improve QToolButton especially the MenuButtonPopup and InstantPopup modes
|
2014-05-17 14:41:39 -04:00
|
|
|
* 1.10:
|
|
|
|
- Add PyQt5 support
|
|
|
|
- Fix bug #12 (dock widget title not dark on OSX. Note that this reopens
|
|
|
|
issue #8 for MAC users)
|
2014-03-21 08:26:41 -04:00
|
|
|
* 1.9:
|
|
|
|
- Improve QTabBar consistency and make selected tabs more distinctive
|
2014-02-25 03:30:02 -05:00
|
|
|
* 1.8:
|
|
|
|
- Add support for QToolBox
|
|
|
|
- Fix issue with grid line in QTableView if there is only ONE row/column
|
2014-02-24 07:20:43 -05:00
|
|
|
* 1.7:
|
|
|
|
- Fix appearance of bottom tab bars (invert gradient)
|
|
|
|
- Improve QTableView: add grid line and fix section borders
|
|
|
|
- Fix bug #7: bug when resizing QTableView
|
|
|
|
- Fix bug #8: text elidation no working on QDockWidget
|
2014-02-20 07:29:06 -05:00
|
|
|
* 1.6:
|
|
|
|
- Improve QToolButton style
|
|
|
|
- Add support for InstantPopup and MenuButtonPopup
|
|
|
|
- Improve QMenu style (better spacing with icons)
|
2014-02-20 07:31:34 -05:00
|
|
|
- Add __version__ to python package.
|
2014-02-20 05:07:53 -05:00
|
|
|
* 1.5:
|
|
|
|
- improve QTabBar style: now works with all tab bar positions (North, South, West and East)
|
|
|
|
- fix bug #6: hide QTabBar base to avoid stange lines at the base of the tab bar.
|
2014-02-17 09:59:08 -05:00
|
|
|
* 1.4: Add style.qss to qrc file, this fix issues with cx_freeze
|
2014-01-30 05:23:57 -05:00
|
|
|
* 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
|
2014-01-26 10:06:23 -05:00
|
|
|
* 1.2:
|
|
|
|
- Improve QTableView support
|
|
|
|
* 1.1:
|
|
|
|
- Switch to MIT license
|
|
|
|
- Add python 3 support
|
|
|
|
* 1.0:
|
|
|
|
- First public release (LGPL v2)
|
2015-05-01 07:28:12 -04:00
|
|
|
|
2014-01-26 10:06:23 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-23 09:03:05 -04:00
|
|
|
Contact information:
|
2017-05-01 23:13:06 -04:00
|
|
|
====================
|
2012-08-23 09:03:05 -04:00
|
|
|
|
|
|
|
- Maintainer: colin.duquesnoy@gmail.com
|
2012-11-05 16:03:11 -05:00
|
|
|
- Homepage: https://github.com/ColinDuquesnoy/QDarkStyleSheet
|
2013-03-10 10:32:04 -04:00
|
|
|
|
2013-03-10 12:59:50 -04:00
|
|
|
|
|
|
|
Snapshots
|
2017-05-01 23:13:06 -04:00
|
|
|
=========
|
2013-03-10 10:32:04 -04:00
|
|
|
|
2015-04-25 15:42:10 -04:00
|
|
|
Here are a few snapshots:
|
2014-01-30 05:17:32 -05:00
|
|
|
|
2017-05-01 23:13:06 -04:00
|
|
|
![alt text](https://github.com/ColinDuquesnoy/QDarkStyleSheet/blob/master/screenshots/QDarkStyle%20example%201.png "QDarkStyle example 1")
|
|
|
|
![alt text](https://github.com/ColinDuquesnoy/QDarkStyleSheet/blob/master/screenshots/QDarkStyle%20example%202.png "QDarkStyle example 2")
|