Usage Guide

Usage Guide

StyleKit is organized around standard Qt selector usage, object names, and dynamic properties.

Recommended Workflow

  • Load the base QSS once during application startup.
  • Use object names for stable semantic roles such as primaryButton or sidePanel.
  • Use dynamic properties for variants such as type=primary, danger=true, or compact=true.
  • Refresh the style after changing dynamic properties at runtime.
button->setProperty("type", "primary");
button->style()->unpolish(button);
button->style()->polish(button);
button->update();

Common Calls

Method Description Parameters Return
qApp->setStyleSheet(qss) Applies or replaces the global application stylesheet. qss: stylesheet text. void
setProperty(name, value) Sets a dynamic property used by QSS selectors. name: property name; value: property value. bool
style()->unpolish(widget) Clears the current style cache for a widget. widget: target widget. void
style()->polish(widget) Recalculates the widget style. widget: target widget. void
update() Requests repaint after a runtime style change. None. void

Maintenance Notes

Keep product-specific overrides small. If a color or spacing rule is reused by multiple pages, promote it into the theme layer instead of copying it into page code.