Skip to content

[KIconDialog] Revamp UI

Kai Uwe Broulik requested to merge work/kbroulik/new-icondialog into master

This modernizes the UI of KIconDialog that hasn't changed since childhood. The code is overall tidied up and layout moved into a .ui file.

The default size is changed from 4x4 to 6x3 to accommodate more widescreen monitors and the grid allows for three lines of text since many icon names are longer than just one line.

Furthermore, the stark separation between "system" and "user" icons is lifted, and instead the "Browse..." button is always accessible and "Other" is just another item in the "context" combo box.

Also, a "No icons" placeholder is shown when there are no icons in the given category or because of the search term input.

Finally, the icons are now loaded on demand as the view scrolls along rather than loading all thousands of them at once with a slow progress bar.

BUG: 388807 BUG: 401408


@dfaure @cfeck @cullmann @ngraham @teams/vdg

This is pretty much another attempt at the redesign I started in 2013 :) I still loved the UI, so I re-implemented it 1-on-1 but no actual code was taken from that attempt. However, with many more years of Qt experience I realized what previously took me forever in basically two evenings. And this time around I actually managed to achieve what blocked me last time: having multi-line labels underneath the icons.

I tested all use cases I could think of and what kicondialogtest tested, but it's still a massive port.

  • Selecting icons works

  • Using the "Browse" button works

  • Switching categories, both system and "other"/user works

  • Starting with a specific category works

  • Starting in "other" (user) icons works

  • lockUser where it does not allow you to switch categories works

    • when lockUser and system icon (!user) is set, it disables the "Other" item from the combobox, so you can still switch contexts but not to the "Other" one
    • when lockUser and custom icons (user) is set, it disables the ComboBox altogether
  • lockCustomDir hides the "Browse…" button

  • No idea what mGroupOrSize is used for

  • No idea what strictIconSize does

  • Looks like kdialog --geticon is broken for "groups", at least I couldn't figure out how to "get small icons"

There are a few minor TODO comments in the code, please check them out.

Other thoughts (probably for later):

  • Should we allow dropping a file into the dialog? Though that is mostly for custom "Browse…" icons, so probably not that frequent?
  • Would be cool if a custom icon was set in iconbutton it would open the dialog again in the category that the icon belonged to with the icon selected, so you can easily switch between different "place" or "device" icons

Screenshot_20210628_134130

For reference here's what I originally envisioned :)

icondialognice5

Edited by Kai Uwe Broulik

Merge request reports