Disable Icon expanding in the ColumnView

Icons looks blurry as expanding because of GTK_ALIGN_FILL property by dedault.

Can I turn it off? Or how can I get ColumnViewCellWidget from ColumnView object to change it

Do you use GtkImage (good) or GtkPicture (bad) for the icons?

1 Like

I’m using GtkImage, already know that GtkPicture is for another deals, thanks for reminding.

I use expand = true in ColumnViewColumn
and vexpand = true in ScrolledWindow

maybe this property delegated from parents… But have removed and nothing changes… only switch to GTK_ALIGN_START resolves the icons blur issue

Strange… are you using fractional scaling?
What about GTK_ALIGN_CENTER ?

1 Like

Changing property to GTK_ALIGN_CENTER it fixes the issue, but I don’t know how to get access to ColumnViewCellWidget from ColumnViewColumn bind factory and ListItem (where I would change the default valign/halign values)

column_view.append_column(
    &gtk::ColumnViewColumn::builder()
        .title("Icon")
        .factory(&{
            let factory = gtk::SignalListItemFactory::new();
            factory.connect_bind(|_, this| {
                use gtk::gio::FileType;
                let list_item =
                    this.downcast_ref::<gtk::ListItem>().unwrap();
                let image = gtk::Image::from_gicon(
                // ..

Maybe this issue related with partial Adwaita usage in parent widgets…

UPD. inserting the Image into the Box has fixed my issue:

let container = gtk::Box::builder().build(); // prevents image blur
container.append(&image);
list_item.set_child(Some(&container));

To avoid the GtkBox, you can use Gtk.Widget.set_halign

1 Like

For halign for Image? It does not help, I’ve tried. Thanks, fixed above (updated)

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.