Skip to content
  • 3 Votes
    1 Posts
    370 Views
    No one has replied
  • 0 Votes
    3 Posts
    2k Views
    L

    @JonB Thank you for your feedback.

    Going thorugh the existing children lists and filter the widgets in specific code is surely a bit more efficient with regards to speed, but that's not the kind of optimisation I was looking for. Some frameworks have a dirty flag for instance that triggers an evalution by the graphics system when it is due for evaluation (on 20ms ticks for instance).

    The polish/unpolish functions could benefit from a better documentation. I have a stylesheet only at the QApplication level, I empty all other stylesheets that are set by QtDesigner - I use the only for that.
    I use the same "style()" because it works and it probably is a small performance gain.

    I haven't tried polishing the application itself, and I suppose that is an overkill for just updating a few widgets.

    The default implementation of (un)polish does nothing, but QStylesheetStyle does. It seems to wrap the baseStyle(), which is likely something like QWindowsStyle or QFusionStyle which do nothing.
    But that's doing exactly what is needed then, only the stylesheet impacts the layout and the QStylesheetStyle handles that.

    QWidget::ensurePolished works recursively, but polishes only "unpolished" QWidgets in the end.

    Upon examination of the QStylesheetStyle code, it seems that unpolishing may not be needed. So I am removing that from the "recursive" implementation and I'll see if it's ok. It seems to avoid quite a few unnecessary operations!

    Update: polishing "recursively" is just enough.