Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
5yutan5 committed Dec 12, 2022
1 parent 377b579 commit c8c7c51
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 8 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ Check out the [complete documentation](https://pyqtdarktheme.readthedocs.io).
- A flat dark and light theme
- Support PySide and PyQt
- Support PyInstaller
- Sync with OS's theme (Mac, Windows, Linux)
- Resolve the style differences between Qt versions
- QPalette of dark and light theme
- Provide dark/light theme QPalette
- Override Qt old standard icons

## Themes

Expand Down
5 changes: 3 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,18 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autosectionlabel",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx_design",
"sphinx_copybutton",
]

autosectionlabel_prefix_document = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand Down
30 changes: 30 additions & 0 deletions docs/source/how_to_use.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,36 @@ Append your own stylesheets
.. image:: ../../examples/customize_style/append_stylesheet.png
:class: dark-light

Use overridden Qt default icons
-------------------------------

If you setup theme with ``qdarktheme.setup_theme``, qdarktheme override ``QStyle.standardIcon()``. So you can easily use some `Google Material Design Icons <https://fonts.google.com/icons>`_. And these icons change color that adjust to theme when theme is changed.

.. tab-set::

.. tab-item:: Source

.. code-block:: Python
save_pixmap = QStyle.StandardPixmap.SP_DialogSaveButton
save_icon = win.style().standardIcon(save_pixmap)
push_button = QPushButton("Save")
push_button.setIcon(save_icon)
.. tab-item:: Full source

.. literalinclude:: ../../examples/icons/use_standard_icons.py

.. tab-item:: Result

.. image:: ../../examples/icons/use_standard_icons.png

.. tab-item:: Gallery

.. image:: ../../images/standard_icons.png


Use QPalette to your Qt Application
-----------------------------------

Expand Down
9 changes: 5 additions & 4 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ PyQtDarkTheme applies a flat dark theme to QtWidgets application(PySide and PyQt

**Features:**

* A flat Dark and Light theme
* Support PySide and PyQt
* Support PyInstaller
* A flat dark/light theme
* Support PySide, PyQt and PyInstaller
* Sync with OS's theme (Mac, Windows, Linux)
* Resolve the style differences between Qt versions
* QPalette of dark and light theme
* Provide dark/light theme QPalette
* :ref:`Override Qt old standard icons <how_to_use:Use overridden Qt default icons>`.

++++

Expand Down
Binary file added examples/icons/use_standard_icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions examples/icons/use_standard_icons.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import sys

from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton, QStyle

import qdarktheme

app = QApplication(sys.argv)
qdarktheme.setup_theme()

main_win = QMainWindow()
save_pixmap = QStyle.StandardPixmap.SP_DialogSaveButton
save_icon = main_win.style().standardIcon(save_pixmap)

push_button = QPushButton("Save")
push_button.setIcon(save_icon)
main_win.setCentralWidget(push_button)

main_win.show()

app.exec()
Binary file added images/standard_icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion qdarktheme/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def setup_theme(
This function doesn't only set the Qt stylesheet,
it applies the complete style to your Qt application using QPalette etc.
Also if theme is ``auto``, try to listen to changes to the OS's color scheme and switch to a
Also if theme is ``auto``, try to listen to changes to the OS's theme and switch to a
matching theme accordingly.
Args:
Expand Down

0 comments on commit c8c7c51

Please sign in to comment.