Skip to content

Status bar color not visually updated on config reload (live reload / reload_config) #1528

@ragu-manjegowda

Description

@ragu-manjegowda

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:

  1. Create two theme config files with different status_bar_color values:
# 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
  1. In prefs_user.config, use source ./theme-light.config
  2. Open sioyek with a PDF document
  3. Modify prefs_user.config to source ./theme-dark.config
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions