Giter Club home page Giter Club logo

pyqtdarktheme's People

Contributors

5yutan5 avatar dependabot[bot] avatar github-actions[bot] avatar henriquegemignani avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyqtdarktheme's Issues

Slider fill reversed in vertical slider

The fill color in the slider goes the wrong way in vertical sliders when PyQtDarkTheme is applied
see pictures below.
Tested in Python 3.9.13, pyside6 6.4.1, OSX 11.7.1

correct

incorrect

Vertical Header Labels not showing up when using Stylesheets from this package

Normally my table should look like this:
image
But with the stylesheet enabled it looks like this:
image
If I comment out the line that sets those header labels, it works, but I can't use my labels.
image

For reference, this is what I use to set those labels : self.table_tableview.setVerticalHeaderLabels(tabledata[1:, 0]), table_tableview is a QTableWidget, and I use the dates from this file: https://gist.githubusercontent.com/Benibla124/7afd02650845c5e6addf4924cfbf8e02/raw/fbf5ff94d9b036a9a3adcd9d0a657ffc4474ec00/Data.txt

Remove the underline

When the mouse is over the radio button,the underline will appear.
how can I remove it?

QQ截图20230116085826

PyInstaller executable doesn't work if I include qdarktheme

Hello, so I'm encountering a problem, I have an project that uses qdarktheme and if I run py main.py the theme works and it's nice but when I build to exe using PyInstaller and run the executable, it fails with this message:

File "main.py", line 12, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "qdarktheme\__init__.py", line 45, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "qdarktheme\_main.py", line 9, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "qdarktheme\_style_loader.py", line 9, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "qdarktheme\_template\filter.py", line 10, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "qdarktheme\qtpy\__init__.py", line 3, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "qdarktheme\qtpy\qt_version.py", line 8, in <module>
ImportError: DLL load failed while importing QtCore: The specified module could not be found.

also note that if I build the exe without qdarktheme the exe works, so I really wanna use your theme, so I hope I get a quick response. thank you

Chart theme support

This package doesn't seem to adjust the 2d and 3d chart/plot themes in dark mode.

This works well for 3d plots:
.activeTheme().setType(Q3DTheme.ThemeEbony)

And this is good for 2d plot:
.setTheme(QChart.ChartThemeDark)

can not change the background colors of individual headerItem in TableWidget

Hello and thank you for the awesome work.

I've faced the issue;
I cannot change the background colors of individual headerItem in TableWidget.

I'd like to change the background color of the first column header.

hi = QTableWidgetItem()
hi.setText("Header1")
hi.setBackground(QColor('red'))

table.setHorizontalHeaderItem(0, hi)

but nothing happens.

Is there any solution?

Thanks in advance.

QComboBox's colours not consistent in Dark theme

This is the Dark mode drop down failing (it is not consistent):
image

Switching to Light and back to Dark gives the correct results (always):
image

Is there some other programmatic way to refresh the combos that I can run on start up ?
I have only seen this on QComboBoxes

I am also running this

        # set the ComboBox dropdown width.
        self.combo_Bandits.view().setMinimumWidth(
            self.combo_Bandits.minimumSizeHint().width()
        )

Poetry show gives
pyqtdarktheme 1.1.0 Flat dark theme for PySide and PyQt.
pyside6 6.3.1 Python bindings for the Qt cross-platform application and UI framework

X

svg icons not showing

The radio button does not appear in Windows whether in the light and dark modes. I tried PySide2 and 6. It works fine in MacOS though.

Padding

After apply the theme, my coluns is having a padding, and I can't remove.

Whith Theme
image

Whitout theme
image

Theme customization

I like this theme because it's simpler and lighter, but is or will there be a way to easily customize it? Perhaps the generated stylesheets can still have placeholders which are formatted on load after the user of the library passes the wanted customizations.

Mainly the default accent color and maybe the borders and padding of widgets. QFrame and QGroupBox for example have border and padding even with the frame set to NoFrame which makes grouping widgets a bit cluttered. Otherwise manually applying a stylesheet after qdarktheme creates issues with spacing and borders near scrollbars.

No radio button, checkbox or icon is visible

Hi there, this theme is really good, but I dunno why it's working not well on my computer. pls see the screenshot below and tell me what's possibly wrong? I uninstalled and reinstalled but still no luck.
thx!
Snipaste_2022-08-14_16-05-54

Menu section & group header texts not displayed

With both Light & Dark themes, the header text for sections and 'menu groups' disappears.
A section is a menu item separator with a header text (set in QT, for instance, via addSection).
Menu groups are groups of menu items preceded by a separator with a header text (set in QT, for instance, via QActionGroup).

Attached are screenshots. The "none" color theme shows the normal rendering of a menu with Windows 10's default color theme. "light" and "dark" show what happens when using these color themes
dark theme
light theme
none theme
.

Not really sure how to explain this

So, this is what the GUI looks like normally without any themes:
Screenshot 2022-07-27 00 22 58

And this is what it looks like in dark theme:
Screenshot 2022-07-27 00 23 19

I like it alot, but at the second checkbox "Make it so that you answer a question incorrectly ever----", the theme just cuts it out the 'y'
The checkbox, spinbox and label are all in a QGridLayout if that helps and I'm also using PyQt5.

Behavior of Buttons with .setCheckable(True) is different on mainwindow and dialog window

Hi, I really like this project and use it to build my UI. However, I found that appearance behavior of buttons is different on mainwindow and dialog window. Here is a demo code to show this:

import qdarktheme
from qdarktheme.qtpy.QtWidgets import (QPushButton,
                                       QApplication,  QVBoxLayout, QHBoxLayout, QLabel,  QDialogButtonBox,
                                       QDialog,QWidget,  )
import sys


class Demo_Dialog(QDialog):
    def __init__(self):
        super(Demo_Dialog, self).__init__()
        self.btn_name = ['a', 'b', 'c', 'd']  # demo for debug
        self.btn_ls = []
        # # ===== setup IU items 
        for i in self.btn_name:
            btn = QPushButton()
            btn.setText(i)
            btn.setCheckable(True)
            btn.setChecked(False)
            self.btn_ls.append(btn)
        self.decision_btn = QDialogButtonBox(self)
        self.decision_btn.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok)
        self.decision_btn.accepted.connect(self.on_decision_btn_accepted)
        self.decision_btn.rejected.connect(self.on_buttonBox_rejected)

        # ==== setup UI layout
        self.setup_ui_layout()

    @classmethod
    def _make_h_layout(cls, widget_ls, space=0, margins=(0, 0, 0, 0)):
        temp_hbox = QHBoxLayout()
        temp_container = QWidget()
        temp_hbox.setSpacing(space)
        temp_hbox.setContentsMargins(margins[0], margins[1], margins[2], margins[3])
        for i_widget in widget_ls:
            temp_hbox.addWidget(i_widget)
        temp_container.setLayout(temp_hbox)
        return temp_container

    def setup_ui_layout(self):
        btn_ls_container = self._make_h_layout(self.btn_ls, space=5)

        global_v_layout = QVBoxLayout(self)
        global_v_layout.addWidget(btn_ls_container)
        global_v_layout.addWidget(self.decision_btn)
        self.resize(300, 300)

    def on_decision_btn_accepted(self):
        print('ok')
        self.done(1)

    def on_buttonBox_rejected(self):
        print('cancel')
        self.done(-1)


class Example(QWidget):

    def __init__(self):
        super().__init__()
        self.btn = QPushButton()
        self.btn.setText('get dialog')
        self.btn.clicked.connect(self.button_click)
        #
        self.demo_btn = QPushButton('demo checkable btn')
        self.demo_btn.setCheckable(True)
        self.demo_btn.setChecked(False)

        self.demo_btn2 = QPushButton('demo checkable btn2')
        self.demo_btn2.setCheckable(True)
        self.demo_btn2.setChecked(False)
        self.initUI()

    def initUI(self):
        hbox = QHBoxLayout()
        hbox.setSpacing(5)
        hbox.addWidget(self.btn)
        hbox.addWidget(self.demo_btn)
        hbox.addWidget(self.demo_btn2)
        self.setLayout(hbox)
        self.setGeometry(300, 300, 600, 600)
        self.setWindowTitle('demo dialog')
        self.show()

    def button_click(self):
        print('get dialog')
        dialog = Demo_Dialog()
        r = dialog.exec_()
        if r > 0:
            print('')


app = QApplication(sys.argv)
ex = Example()
app.setStyleSheet(qdarktheme.load_stylesheet('dark'))
sys.exit(app.exec_())

Tooltip background color

I'm finding that tooltips are showing up incorrectly. Text color appears to be correct but the background is white making it impossible to see. See attached image
tooltip_color_issue

This is in Windows 11 and PySide6

issue with calendar

when adding calendar is not "add color " to selected date
simple code with only calendar widget

from PyQt5 import QtCore, QtGui, QtWidgets
import qdarktheme
from qdarktheme.qtpy.QtWidgets import QApplication


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName("verticalLayout")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        # add calendar to centralwidget
        self.calendar = QtWidgets.QCalendarWidget(self.centralwidget)
        self.calendar.setObjectName("calendar")
        self.verticalLayout.addWidget(self.calendar)


    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))


if __name__ == "__main__":
    import sys

    qdarktheme.enable_hi_dpi()
    app = QApplication(sys.argv)
    qdarktheme.setup_theme("auto")
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())

Forced font-size under QHeaderView

The line 'font-size:13px' under the QHeaderView section forces a text size that overrides the application or object font size. It's the only place in both the dark & light stylesheet.py files that font-size is set. Does not seem to belong. I had to remove it in both files for my QTableWidget to properly display the header text.
Btw, qdarktheme is great, thanks for sharing !

Segmentation Fault when using example in README

I'm running Raspbian Buster, and I have PySide2 installed.

import sys

from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton

import qdarktheme

app = QApplication(sys.argv)
# Apply the complete dark theme to your Qt App.
qdarktheme.setup_theme()

main_win = QMainWindow()
push_button = QPushButton("PyQtDarkTheme!!")
main_win.setCentralWidget(push_button)

main_win.show()

app.exec()

I executed this code line by line, but I crash with a Segmentation Fault when I get to the qdarktheme.setup_theme() line. Any ideas?

Setting a theme enables mouseTracking in QTabBar

Windows 10, Python 3.11, PySide 6.4.1, pyqtdarktheme 2.1.0

Problem: Enabling a theme with qdarktheme.setup_theme() enables mouseTracking for QTabBars.

Steps to reproduce:

  1. Run the example app below
  2. Hover mouse over the tabs (label1 or label2) and you will see a bunch of prints MoveEvent mouseTracking:True
  3. Close the example app
  4. Comment line `qdarktheme.setup_theme()
  5. Run the example app again
  6. Hover mouse over the tabs and no prints appear
  7. Click on tab label1 or label2 and a print appears PressEvent mouseTracking:False

Expected behaviour:
Mouse tracking in QTabBar should be disabled when a theme is enabled.

Here's the example app.

import sys
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton, QTabWidget, QTabBar, QVBoxLayout, QWidget, QLabel
import qdarktheme


class MainWindow(QMainWindow):

    def __init__(self):
        super().__init__()
        self.setFixedSize(400, 300)
        tab_widget = QTabWidget(self)
        tab_bar = CustomTabBar(self)
        tab_widget.setTabBar(tab_bar)
        push_button = QPushButton("PyQtDarkTheme!!")
        tab1 = QLabel("abc")
        tab2 = QLabel("def")
        tab_widget.addTab(tab1, "label1")
        tab_widget.addTab(tab2, "label2")
        self.layout = QVBoxLayout()
        self.layout.addWidget(tab_widget)
        self.layout.addWidget(push_button)
        self.container = QWidget()
        self.container.setLayout(self.layout)
        self.setCentralWidget(self.container)


class CustomTabBar(QTabBar):
    def __init__(self, parent):
        super().__init__(parent)

    def mousePressEvent(self, event):
        print(f"PressEvent mouseTracking:{self.hasMouseTracking()}")
        super().mousePressEvent(event)

    def mouseMoveEvent(self, event):
        print(f"MoveEvent mouseTracking:{self.hasMouseTracking()}")
        super().mouseMoveEvent(event)


app = QApplication(sys.argv)
window = MainWindow()
window.show()
# Apply dark theme.
qdarktheme.setup_theme()  # Comment this line
app.exec()

setup_theme() causes debugger to not end

I have setup qdarktheme according to the guide. I do use it with pyqt6.
When debugging in pycharm, the debugger process does not terminate if the theme is used. As soon as I comment out the
qdarktheme.setup_theme("auto"), the debugger closes correctly.

Any advice?

Specify Qt version to use

There seems to be an issue where it would prefer PyQt6/PySide6 over PyQt5. This means that if my program uses PyQt5 and PyQt6/PySide6 is installed, then it won't work because it will try using PyQt6/PySide6. This results in it not detecting QApplication being instantiated.

Inconsistent render of menu items with checkable icons

Hi there!
I found these themes are pretty nice.
It almost completely satisfies all my needs.
Thank you!

Unfortunately it seems there are a couple of small but looking weird issues.

There is a too big gap between checkboxes and text.
And the checkboxes itself look a little bit stretched horizontally when used in menu items
(In other places they look properly)

Stretched checkboxes in menu + big gap between them and text
image

Big gap between icons and text
image

Proper (non-menu) checkboxes - everything is ok here:
image

How to reduce the height of QComboBox after applying PyQtDarkTheme

I really like this theme. To make my layout consistent I need to reduce the height of all QComboBoxes.
Before qdarktheme.setup_theme this can be done by setting maximumHeight or stylesheets, but after qdarktheme.setup_theme these no longer work.
Is there a way to change the height or to not apply the style to QComboBoxes so they can be styled individually?

Below is a simple example. After you click on qdarktheme, reduceHeight is ineffective.

import sys
import qdarktheme
from PyQt6.QtWidgets import QApplication,QWidget,QPushButton,QVBoxLayout,QLabel,QComboBox

class Foo(QWidget):

    def __init__(self):
        super().__init__()        
        lay = QVBoxLayout(self)  
        b = QPushButton('qdarktheme')
        b.clicked.connect(self.setupTheme)
        lay.addWidget(b)        
        b = QPushButton('reduceHeight')
        b.clicked.connect(self.reduceHeight)
        lay.addWidget(b)        
        qcb = QComboBox()
        lay.addWidget(QLabel('Test'))
        lay.addWidget(qcb)
        self.qcb = QComboBox()
        lay.addWidget(QLabel('Test'))
        lay.addWidget(self.qcb)
        
    def reduceHeight(self):
        self.qcb.setMaximumHeight(10) # only moves combobox when qdarktheme applied
        # self.qcb.setStyleSheet('QComboBox {padding: 0px;margin: 0px;}') # no effect when qdarktheme applied
    
    def setupTheme(self):
        qdarktheme.setup_theme(theme='light', corner_shape="sharp")

if __name__ == '__main__':
    app = QApplication(sys.argv)    
    app.setStyle('Fusion')       
    
    mainWindow = Foo()
    mainWindow.show()
    sys.exit(app.exec())

Windows title bar not dark in dark theme

On my Win10 system when using the dark theme, the title bar still shows "light". I found that setting the WindowText to pure white will force the titlebar to be dark.

palette.setColor(QPalette.WindowText, Qt.white)

Incomplete lines in QTreeWidget

The parent-child links in a tree view are incomplete:
image
The children are not linked to their parents. Not super-important for most people I guess, but it would be nice if this could be changed/fixed in due course.
Other than that -- thanks for the nice theme.

All the best, Jacob.

Style issues with QTree

I have a style issue with QtWidgets.QTreeWidget and QtWidgets.QTreeWidgetItem
when i hover over the item, it looks good (red H)
but when i don't hover over it it's white.

image

Cannot change multiple colors.

In using the examples provided I am able to change the background color to black "background":"#000000" however I cannot get the input color on a QLineEdit to change no matter what I do. I'm not getting any errors, it's just not changing. How does one change multiple colors at once?

Linux resources support!!

I'm using this theme for my PyQt5 application and I'm trying to build the app using PyInstaller but I get this error message:

Traceback (most recent call last):
  File "qdarktheme/compile.py", line 18, in compile_stylesheet
  File "pathlib.py", line 1242, in open
  File "pathlib.py", line 1110, in _opener
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEIYRoBwg/qdarktheme/template.qss'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 1166, in <module>
  File "main.py", line 1161, in init_app
  File "main.py", line 218, in __init__
  File "main.py", line 230, in init_window
  File "qdarktheme/resource_manager.py", line 39, in load_stylesheet
  File "qdarktheme/compile.py", line 25, in compile_stylesheet
FileNotFoundError: 
=======================================================================
Unable to load the QSS file.
QSS file path: /tmp/_MEIYRoBwg/qdarktheme/template.qss
The qss file may be crushed or not installed properly.
Try reinstalling the module again.[pip install qdarktheme]
Also, this module has only been tested on mac and windows.
Operation on other operating systems, such as Linux, is not guaranteed.
=======================================================================

And I want to know if there is a way you could test it and fix it, or guide me to be able to fix it.
(Maybe should I add qdarktheme/templace.qss as a data in my .spec file?).
Here's my .spec file.


I really like this theme and I don't want to change it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.