enaml icon indicating copy to clipboard operation
enaml copied to clipboard

IconImage is not the correct size and does not scale

Open jmilloy opened this issue 1 year ago • 3 comments

I am trying to use images in PushButton icons.

PushButton:
    icon = Icon(images=[IconImage(image=load_image('my_image.svg'))])

The image is displayed, but it is neither the size of the image nor does it scale with the PushButton size (as defined in constraints). I tried setting the raw_size and size for the Image but that had no affect. It is displayed very small, like 6x6, but the image in 64x64 and the PushButton is 96x100. I tried with both an svg and a png.

jmilloy avatar Aug 22 '24 17:08 jmilloy

I'm realizing that I can't figure out how to size the PushButton any other way than to add text and style the font_size. It seems to ignore height constraints. What am I missing about this?

jmilloy avatar Aug 26 '24 16:08 jmilloy

Off the top of my head, a PushButton tend to stick to its natural size even if more space is available. Try playing with limit_width and feel free to check the other attributes available on ConstraintsWidget subclasses.

MatthieuDartiailh avatar Aug 26 '24 17:08 MatthieuDartiailh

You might also have to use a style sheet. That will trigger Qt to disregard the platform rendering style, and it will behave more like stylable/clickable box, which sounds like what you are after

On Mon, Aug 26, 2024 at 12:14 PM Matthieu Dartiailh < @.***> wrote:

Off the top of my head, a PushButton tend to stick to its natural size even if more space is available. Try playing with limit_width and feel free to check the other attributes available on ConstraintsWidget subclasses.

— Reply to this email directly, view it on GitHub https://github.com/nucleic/enaml/issues/555#issuecomment-2310682211, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABBQSOVCCNPGE6JECEUWIDZTNO6VAVCNFSM6AAAAABM6UCRZOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJQGY4DEMRRGE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

sccolbert avatar Aug 26 '24 21:08 sccolbert