constraints and size hints

Ignat Semenov ragnarokk91 at gmail.com
Tue Feb 14 07:45:50 UTC 2012


Well, yes, my bad. My apologies.

OK, so here are the issues:

1)I'd like to understand the relation between constraintsEvent() and sizeHint(). In order to achieve the correct effect for the FolderView (always $icon_size wide, whatever tall, centered vertically when in a horizontal panel, and vice versa in a vertical one), I did

a)in constraintsEvent() - setMinimumSize(Global iconSize for Panel) and then setAspectRation(constrainedSquare)
b)in sizeHint() - for PreferredSize, return Global iconSize for Panel.

I looked it up in the Trash widget, which behaves like I've described above, and indeed, the FW icon in the panel started to behave identically.

Now

a)Do I need to set the size in constraintsEvent for the FormFactor change?
b)Do I need to set a size in sizeHint if constraintsEvent already has a setMinimumSize?
c)Why Is setMinimumSize required? Is it because the panel is trying to shrink the widget horizontally to the very minimum (if in a horizontal panel)?

Remember - FW is not a PopupApplet, it is represented by a manually managed Plasma::IconWidget when in a panel.

Now for some reason, the same code does not make Kickoff, the Tabbed version (which inherits popupApplet) behave identically, remaining narrow and tall in the panel. What is worse, it does not repaint on panel resize! There even is a bug somewhere complaining about that issue. Maybe there is a call that inhibits repaints somewhere?

Best regards,
Ignat Semenov


More information about the Plasma-devel mailing list