Trying to make a dark- lightmode switcher

im trying to make a Button which switches between light and darkmode. Switching to darkmode is pretty easy, but switching to lightmode again is a bit complicated I try to switch to the default Palette but idk how it really works.. This is the function: def modeSwitch(self): if self.dark_mode: self.dark_mode = False QApplication.setPalette("") else: self.dark_mode… Read More Trying to make a dark- lightmode switcher

Cutting Strings Pyhton

i have a simple ui created with pyqt5 it loads a file, let you choose a outputfolder and creats a new txt file with additonals information. the string of the loaded file is written to self.inputs.filename.text() it looks like "C:/User/Folder/File.txt" later in the application i write into a new file in a specific location. new_txt… Read More Cutting Strings Pyhton

Qt5 slot lambda why captured local variable is random for the first time lambda is called

In the following code, I think p2 should print 10. But in fact it prints random value. The I starts to understand why it is not 10, with the following (1)-(3) thougths. { int m = 10; // local var m qDebug() << "m0: " << &m; connect(btn2, &QPushButton::clicked, this, [&]() { qDebug() << "m2:… Read More Qt5 slot lambda why captured local variable is random for the first time lambda is called