C++ structs equal operator: invalid operands to binary expression

Advertisements Qt 5.15.5 msvc2019 compiler clang version 12.0.0 Target: x86_64-pc-windows-msvc struct FrameStyle { QColor color; // has both == and != operators Qt::PenStyle penStyle; // enum Distance padding; // has == operator bool operator==(const FrameStyle& other) { return other.color == color && other.penStyle == penStyle && other.padding == padding; } }; FrameStyle style; FrameStyle m_prevStyle;… Read More C++ structs equal operator: invalid operands to binary expression

Cutting Strings Pyhton

Advertisements 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.… Read More Cutting Strings Pyhton

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

Advertisements 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() <<… Read More Qt5 slot lambda why captured local variable is random for the first time lambda is called