When changing the "Main/Quick find search highlight" background color in the Options menu, the color is correctly applied to the current window. However, when opening a new window restarting the application, the color reverts to the default gray.
The application correctly saves the chosen color to the configuration file, but fails to load it back into the session settings upon initialization.
|
mainSearchBackColor_ |
|
#if QT_VERSION <= QT_VERSION_CHECK( 6, 4, 0 ) |
|
.setNamedColor( |
|
#else |
|
.fromString( |
|
#endif |
|
settings |
|
.value( "regexpType.mainBackColor", |
|
DefaultConfiguration.mainSearchBackColor_.name( QColor::HexArgb ) ) |
|
.toString() ); |
|
|
|
qfBackColor_ |
|
#if QT_VERSION <= QT_VERSION_CHECK( 6, 4, 0 ) |
|
.setNamedColor( |
|
#else |
|
.fromString( |
|
#endif |
|
settings |
|
.value( "regexpType.quickfindBackColor", |
|
DefaultConfiguration.qfBackColor_.name( QColor::HexArgb ) ) |
|
.toString() ); |
For builds using Qt > 6.4.0,
the code calls QColor::fromString() as an instance method (e.g., mainSearchBackColor_.fromString(...)).
Because QColor::fromString is a static method in modern Qt, it returns a new QColor object and does not modify the existing one.
Since the returned value is not assigned back to the variable, the setting is effectively ignored.
This affects both mainSearchBackColor_ and qfBackColor_.
solution suggestion:
just replace .fromString(...) with = QColor::fromString(...)
When changing the "Main/Quick find search highlight" background color in the Options menu, the color is correctly applied to the current window. However, when opening a new window restarting the application, the color reverts to the default gray.
The application correctly saves the chosen color to the configuration file, but fails to load it back into the session settings upon initialization.
klogg/src/settings/src/configuration.cpp
Lines 144 to 164 in 25c7de6
For builds using Qt > 6.4.0,
the code calls
QColor::fromString()as an instance method (e.g.,mainSearchBackColor_.fromString(...)).Because
QColor::fromStringis a static method in modern Qt, it returns a newQColorobject and does not modify the existing one.Since the returned value is not assigned back to the variable, the setting is effectively ignored.
This affects both
mainSearchBackColor_andqfBackColor_.solution suggestion:
just replace
.fromString(...)with= QColor::fromString(...)