Merge and add new style, fix disabled #112, fix #109

This commit is contained in:
Daniel Pizetta 2018-10-25 00:18:01 -03:00
commit 29431c9ced
6 changed files with 155 additions and 10 deletions

46
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,46 @@
<!-- You can erase any parts of this template not applicable/known to your Issue. -->
### Describe Your Environment
[Versions from your environment]
- QDarkStyle:
- OS:
- Python:
[If used, please inform their versions]
- PySide:
- PyQt:
- PyQtGraph:
- QtPy:
- QT_API:
- PYQTGRAPH_QT_LIB:
### Language
[Python] or [C++]
### Description / Steps to Reproduce [if necessary]
[Description of the issue]
1. [First Step]
2. [Second Step]
3. [and so on...]
### Actual Result
[A description, output ou image of the actual result]
### Expected Results / Proposed Result
[A description, output ou image of the expected/proposed result]
### Relevant Code [if necessary]
[A piece of code to reproduce and/or fix this issue]
```
# code here to reproduce the problem
```

View File

@ -19,5 +19,8 @@ These people contribute to bug fixes, improvements and so on.
Please, insert your information after the last one.
- Year - Name - `<contact>` - contribution.
- 2018 - [mowoolli](https://github.com/mowoolli) - bug fixes.
- 2018 - Xingyun Wu - `xingyun.wu@foxmail.com` - bug fixes.
- 2018 - [KcHNST](https://github.com/KcHNST) - bug fixes.
Thank you all!
Thank you all!

View File

@ -5,12 +5,22 @@
- Add get_info function on qdarkstyle to get environment information for
debbuging and/or issue tracker
- Add help dialog to example to show get_info information
- PySide 2 (Technical Preview) Support
- Improve menu indicator position on QPushButton, #102
- 2.5.4
- Fix indicator image of checkable QGroupBox for check/uncheck states, #93
- Fix wrong comma position, #95
- Added image for the missing QTreeView/QListView undeterminated state, fix #92
- 2.5.3
- Add future warning and pending deprecation for 3.0 version preparation #89
- Add ISSUE_TEMPLATE to ask for default information on issue tracker
- 2.5.2:
- Modularize files from example/ui to simplify edition (developers)
- Add scripts to process files and run example more easiy (developers)
- Better documentation (developers)
- Add CONTRIBUTE, CODE_OF_CONDUCT, and PRODUCTION files
- Lint markdown to standardize files
- Fix and add mor information in C++ example
- 2.5.1:
- Fix travis files, needs more improvement #74
- Improve modules description

View File

@ -4,6 +4,8 @@
[![Latest PyPI version](https://img.shields.io/pypi/v/QDarkStyle.svg)](https://pypi.python.org/pypi/QDarkStyle)
[![License: MIT](https://img.shields.io/dub/l/vibe-d.svg)](https://opensource.org/licenses/MIT)
[![License: CC BY 4.0](https://img.shields.io/badge/License-CC%20BY%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by/4.0/)
[![conduct](https://img.shields.io/badge/code%20of%20conduct-contributor%20covenant-green.svg?style=flat-square)](http://contributor-covenant.org/version/1/4/)
A dark stylesheet for Qt applications (Qt4, Qt5, PySide, PyQt4, PyQt5, QtPy,
PyQtGraph).
@ -40,12 +42,15 @@ From code: Download/clone the project, go to ``qdarkstyle`` folder then:
- **qdarkstyle/style.qrc**
- **qdarkstyle/rc/** (the whole directory)
- Add **qdarkstyle/style.qrc** to your **.pro file**
- Add **qdarkstyle/style.qrc** to your **.pro file** as follows:
```cpp
RESOURCES += qdarkstyle/style.qrc
```
- Load the stylesheet:
```cpp
QFile f("qdarkstyle/style.qss");
QFile f(":qdarkstyle/style.qss");
if (!f.exists())
{
printf("Unable to set stylesheet, file not found\n");
@ -58,6 +63,8 @@ From code: Download/clone the project, go to ``qdarkstyle`` folder then:
}
```
_Note: The ":" in the file name is necessary to define that file as a resource library. For more information see the discussion [here](https://github.com/ColinDuquesnoy/QDarkStyleSheet/pull/87)._
## Usage
Here is an example using PySide

View File

@ -19,6 +19,8 @@ as shown bellow
# PySide
dark_stylesheet = qdarkstyle.load_stylesheet_pyside()
# PySide
dark_stylesheet = qdarkstyle.load_stylesheet_pyside2()
# PyQt4
dark_stylesheet = qdarkstyle.load_stylesheet_pyqt()
# PyQt5
@ -128,6 +130,11 @@ def load_stylesheet_from_environment(is_pyqtgraph=False):
:return the stylesheet string
"""
warnings.warn(
"load_stylesheet_from_environment() will be deprecated in version 3,"
"use load_stylesheet()",
PendingDeprecationWarning
)
qt_api = ''
pyqtgraph_qt_lib = ''
@ -193,9 +200,30 @@ def load_stylesheet(pyside=True):
:return the stylesheet string
"""
warnings.warn(
"load_stylesheet() will not receive pyside parameter in version 3. "
"Set QtPy environment variable to specify the Qt binding insteady.",
FutureWarning
)
# Smart import of the rc file
pyside_ver = None
if pyside:
import qdarkstyle.pyside_style_rc
# Detect the PySide version available
try:
import PySide
except ModuleNotFoundError:
import PySide2
pyside_ver = 2
else:
pyside_ver = 1
if pyside_ver == 1:
import qdarkstyle.pyside_style_rc
else:
import qdarkstyle.pyside2_style_rc
else:
import qdarkstyle.pyqt_style_rc
@ -203,7 +231,10 @@ def load_stylesheet(pyside=True):
if not pyside:
from PyQt4.QtCore import QFile, QTextStream
else:
from PySide.QtCore import QFile, QTextStream
if pyside_ver == 1:
from PySide.QtCore import QFile, QTextStream
else:
from PySide2.QtCore import QFile, QTextStream
f = QFile(":qdarkstyle/style.qss")
if not f.exists():
@ -233,6 +264,12 @@ def load_stylesheet_pyside():
:return the stylesheet string
"""
warnings.warn(
"load_stylesheet_pyside() will be deprecated in version 3,"
"set QtPy environment variable to specify the Qt binding and "
"use load_stylesheet()",
PendingDeprecationWarning
)
return load_stylesheet(pyside=True)
@ -242,7 +279,13 @@ def load_stylesheet_pyside2():
:raise NotImplementedError: Because it is not supported yet
"""
raise NotImplementedError("PySide 2 is not supported yet.")
warnings.warn(
"load_stylesheet_pyside2() will be deprecated in version 3,"
"set QtPy environment variable to specify the Qt binding and "
"use load_stylesheet()",
PendingDeprecationWarning
)
return load_stylesheet(pyside=True)
def load_stylesheet_pyqt():
@ -251,6 +294,12 @@ def load_stylesheet_pyqt():
:return the stylesheet string
"""
warnings.warn(
"load_stylesheet_pyqt() will be deprecated in version 3,"
"set QtPy environment variable to specify the Qt binding and "
"use load_stylesheet()",
PendingDeprecationWarning
)
return load_stylesheet(pyside=False)
@ -262,6 +311,12 @@ def load_stylesheet_pyqt5():
:return the stylesheet string
"""
warnings.warn(
"load_stylesheet_pyqt5() will be deprecated in version 3,"
"set QtPy environment variable to specify the Qt binding and "
"use load_stylesheet()",
PendingDeprecationWarning
)
# Smart import of the rc file
import qdarkstyle.pyqt5_style_rc

View File

@ -151,7 +151,6 @@ QCheckBox::indicator:checked:pressed {
}
QCheckBox::indicator:checked:disabled,
QGroupBox::indicator:checked:disabled {
image: url(:/qss_icons/rc/checkbox_checked_disabled.png);
}
@ -191,6 +190,11 @@ QGroupBox::indicator:checked:pressed {
image: url(:/qss_icons/rc/checkbox_checked_focus.png);
}
QGroupBox::indicator:checked:disabled {
image: url(:/qss_icons/rc/checkbox_checked_disabled.png);
}
/* QRadioButton ----------------------------------------------------------- */
QRadioButton {
@ -839,6 +843,7 @@ QPushButton:disabled {
padding: 3px;
}
QPushButton:checked {
background-color: #31363B;
border: 1px solid #31363B;
@ -859,7 +864,12 @@ QPushButton:checked:disabled {
QPushButton::menu-indicator {
subcontrol-origin: padding;
subcontrol-position: bottom right;
left: 8px;
bottom: 5px;
}
QPushButton:pressed {
background-color: #232629;
border: 1px solid #179AE0;
}
/* QToolButton ------------------------------------------------------------ */
@ -892,7 +902,7 @@ QToolButton:checked,
QToolButton:pressed,
QToolButton::menu-button:pressed {
background-color: #232629;
border: 1px solid #31363B;
border: 1px solid #179AE0;
padding: 0px;
}
@ -958,7 +968,7 @@ QComboBox {
border: 1px solid #31363B;
border-radius: 4px;
padding: 4px;
min-width: 75px;
/* min-width: 75px; removed for fix #109 */
selection-background-color: #3375A3;
}
@ -1370,6 +1380,20 @@ QListView::indicator:unchecked:pressed {
image: url(:/qss_icons/rc/checkbox_unchecked_focus.png);
}
QTreeView::indicator:indeterminate:hover,
QTreeView::indicator:indeterminate:focus,
QTreeView::indicator:indeterminate:pressed,
QListView::indicator:indeterminate:hover,
QListView::indicator:indeterminate:focus,
QListView::indicator:indeterminate:pressed {
image: url(:/qss_icons/rc/checkbox_indeterminate_focus.png);
}
QTreeView::indicator:indeterminate,
QListView::indicator:indeterminate {
image: url(:/qss_icons/rc/checkbox_indeterminate.png);
}
QListView,
QTreeView,
QTableView,