nach längerem, möchte ich wieder mich mit pyqt auseinandersetzen.
Ich verwende Kubuntu 20.04 und als Theme 'Breeze Dunkel'.
Durch dies, habe ich das Problem, dass die qt-Widgets nicht erkennbar sind.
Wie ich beim Googeln gelesen habe, unterstützt qt nicht dunkle Themen und man muss über stylesheet, das Layout anpassen.
Dazu habe ich schon ein paar codes ausprobiert, aber es verändert sich so gut wie nichts.
Ich stelle jetzt hier mal ein Beispiel rein und hoffe, Ihr könnt mir anhand dieses Beispiels eine Lösung aufzeigen.
Code: Alles auswählen
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon, QPalette, QColor
from PyQt5.QtWidgets import (QMainWindow, QApplication, QVBoxLayout,
QAction)
class tooldemo(QMainWindow):
def __init__(self, parent = None):
super(tooldemo, self).__init__(parent)
layout = QVBoxLayout()
tb = self.addToolBar("File")
new = QAction(QIcon("new.bmp"),"new",self)
tb.addAction(new)
open = QAction(QIcon("open.bmp"),"open",self)
tb.addAction(open)
save = QAction(QIcon("save.bmp"),"save",self)
tb.addAction(save)
tb.actionTriggered[QAction].connect(self.toolbtnpressed)
self.setLayout(layout)
self.setWindowTitle("toolbar demo")
def toolbtnpressed(self, a):
print("pressed tool button is", a.text())
def main():
app = QApplication(sys.argv)
ex = tooldemo()
ex.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()