-
Notifications
You must be signed in to change notification settings - Fork 301
Description
Description:
When the configuration file is modified and reloaded (either via file watcher or reload_config command), the status bar color (status_bar_color and status_bar_text_color) is not visually updated, even though other UI elements update correctly.
Steps to Reproduce:
- Create two theme config files with different
status_bar_colorvalues:
# theme-light.config
status_bar_color 0.93333 0.90980 0.83529
status_bar_text_color 0.00000 0.16862 0.21176
# theme-dark.config
status_bar_color 0.02745 0.21176 0.25882
status_bar_text_color 0.99215 0.96470 0.89019
- In
prefs_user.config, usesource ./theme-light.config - Open sioyek with a PDF document
- Modify
prefs_user.configtosource ./theme-dark.config - Observe: Document colors update, but status bar color remains unchanged
Expected Behavior:
Status bar should update to the new colors when config is reloaded.
Actual Behavior:
Status bar retains the original colors until sioyek is restarted.
Code Analysis:
Looking at main_widget.cpp, on_config_file_changed does call:
status_label->setStyleSheet(get_status_stylesheet());
And get_status_stylesheet() in utils.cpp correctly reads from STATUS_BAR_COLOR:
return QString("background-color: %1; color: %2; ...").arg(
get_color_qml_string(STATUS_BAR_COLOR[0], STATUS_BAR_COLOR[1], STATUS_BAR_COLOR[2]),
...
);
The issue appears to be that Qt's QLabel::setStyleSheet() isn't triggering a visual repaint of the widget.
Possible Fix:
Add explicit repaint after stylesheet change in MainWidget::on_config_file_changed:
status_label->setStyleSheet(get_status_stylesheet());
status_label->style()->unpolish(status_label);
status_label->style()->polish(status_label);
status_label->update();
Environment:
- sioyek version: 2.0.0
- OS: Arch Linux (BTW)
- Qt version: Qt6