Skip to content

Commit 6daab72

Browse files
committed
update example, readme
1 parent a9d1c49 commit 6daab72

File tree

12 files changed

+843
-215
lines changed

12 files changed

+843
-215
lines changed

.travis.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

README.rst

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,45 @@
11
====================
2-
qtmodern for PySide6
2+
qtmodern6
33
====================
44

5-
.. image:: https://travis-ci.org/gmarull/qtmodern.svg?branch=master
6-
:target: https://travis-ci.org/gmarull/qtmodern
7-
:alt: Travis build
8-
9-
.. image:: https://img.shields.io/pypi/v/qtmodern.svg
10-
:target: https://pypi.python.org/pypi/qtmodern
5+
.. image:: https://img.shields.io/pypi/v/qtmodern6.svg
6+
:target: https://pypi.python.org/pypi/qtmodern6
117
:alt: PyPI Version
128

13-
``qtmodern`` is a Python package aimed to make PyQt/PySide applications look
14-
better and consistent on multiple platforms. It provides a custom frameless
15-
window and a dark theme. In order to be compatible with multiple Python Qt
16-
wrappers `QtPy <https://github.com/spyder-ide/qtpy>`_ is used. The initial idea
17-
comes from `this project <https://github.com/Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle>`_.
9+
``qtmodern6`` 是在``gmarull/qtmodern``项目基础上修改而来的。
10+
查看原项目请点击:<https://github.com/gmarull/qtmodern>
11+
12+
原项目只能支持``PyQt``、``PySide2``,且已经停止维护。git上也没能找到类似的项目。
13+
因此就考虑修改原项目以适配``PySide6``。
14+
15+
16+
主题界面如下图(可能稍有不同):
1817

1918
.. image:: examples/mainwindow.png
2019
:width: 450px
2120
:align: center
2221
:alt: Example
2322

24-
Installation
25-
------------
23+
基本用法和原来一样。
2624

27-
The recommended way to install is by using ``pip``, i.e::
28-
29-
pip install qtmodern
30-
31-
Usage
25+
安装(python版本>=3.9):
3226
-----
3327

34-
In order to use ``qtmodern``, simply apply the style you want to your
35-
application and then, create a ``ModernWindow`` enclosing the window you want to
36-
*modernize*::
28+
pip install qtmodern6
29+
30+
如何使用:
31+
--------
3732

38-
import qtmodern.styles
39-
import qtmodern.windows
33+
import qtmodern6.styles
34+
import qtmodern6.windows
4035

4136
...
4237

4338
app = QApplication()
4439
win = YourWindow()
4540

46-
qtmodern.styles.dark(app)
47-
mw = qtmodern.windows.ModernWindow(win)
41+
qtmodern6.styles.dark(app)
42+
mw = qtmodern6.windows.ModernWindow(win)
4843
mw.show()
4944

5045
...

examples/mainwindow.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import sys
22
from time import sleep
3-
from os.path import join, dirname, abspath, basename, isdir
3+
from os.path import dirname, abspath, basename, isdir
44
from os import listdir
55

6-
from qtpy import uic
7-
from qtpy.QtCore import Slot, QThread, Signal
8-
from qtpy.QtWidgets import QApplication, QMainWindow, QMessageBox, QTreeWidgetItem
6+
from PySide6.QtCore import Slot, QThread, Signal
7+
from PySide6.QtWidgets import QMainWindow, QApplication, QMessageBox, QTreeWidgetItem
8+
from mainwindow_ui import Ui_MainWindow
99

10-
import qtmodern.styles
11-
import qtmodern.windows
12-
13-
14-
_UI = join(dirname(abspath(__file__)), 'mainwindow.ui')
10+
import qtmodern6.styles
11+
import qtmodern6.windows
1512

1613

1714
class ProgressThread(QThread):
@@ -28,11 +25,10 @@ def run(self):
2825
sleep(0.5)
2926

3027

31-
class MainWindow(QMainWindow):
28+
class MainWindow(Ui_MainWindow, QMainWindow):
3229
def __init__(self):
3330
QMainWindow.__init__(self)
34-
35-
uic.loadUi(_UI, self) # Load the ui into self
31+
self.setupUi(self)
3632

3733
self.tooltiplabel.setToolTip("This is a tool tip that shows a tip about the tool")
3834

@@ -59,10 +55,10 @@ def update_progress(self, progress):
5955
self.progressBar.setValue(progress)
6056

6157
def lightTheme(self):
62-
qtmodern.styles.light(QApplication.instance())
58+
qtmodern6.styles.light(QApplication.instance())
6359

6460
def darkTheme(self):
65-
qtmodern.styles.dark(QApplication.instance())
61+
qtmodern6.styles.dark(QApplication.instance())
6662

6763
@Slot()
6864
def on_pushButton_clicked(self):
@@ -80,8 +76,8 @@ def closeEvent(self, event):
8076
if __name__ == '__main__':
8177
app = QApplication(sys.argv)
8278

83-
qtmodern.styles.dark(app)
84-
mw = qtmodern.windows.ModernWindow(MainWindow())
79+
qtmodern6.styles.dark(app)
80+
mw = qtmodern6.windows.ModernWindow(MainWindow())
8581
mw.show()
8682

8783
sys.exit(app.exec_())

0 commit comments

Comments
 (0)