Skip to content
  • 0 Votes
    5 Posts
    588 Views
    NarutoblazeN

    @mpergand

    Did not worked :

    setSectionResizeMode(QHeaderView::Fixed); setDefaultSectionSize(10);
  • 0 Votes
    5 Posts
    1k Views
    C

    @Pythonic-person said in Widgets with SizePolicy there is no effects:

    Do you mean taking the main window size and then change the widget size with the code?

    You either use one of the provided layout mechanisms, develop you your only layout implementation, or you do all the resizing of contained widgets yourself 1990's style.

    If you wish to do it yourself then you need to override the resizeEvent() of the container widget and resize the contained widgets yourself using whatever logic you see fit.

  • 0 Votes
    8 Posts
    2k Views
    mrjjM

    @Dariusz
    Hi
    im not sure that is possible as the ScrollArea widget is the one affected by layout options
    and not the actual ScollArea.

    Maybe you get lucky and someone else knows a trick to this.

    I have seen QLabels with images scale the dialog they are in but not sure it also works from within a scrollarea since
    its size will never be affected by the layouts.

  • 0 Votes
    5 Posts
    812 Views
    D

    @SGaist I ended up hocking up to resize event of parent widget to find out when size changed & resize my other widget acordingly.

    I ended up using "invisible" QLabel that retains size as my "spacer". I had to change its spacing role on the go depending of one or more widget are visible or not as I needed to retain correct order. So far works great.

    TIA

  • 0 Votes
    2 Posts
    422 Views
    Chris KawaC

    It's probably because of the alignment you set to Qt::AlignLeft. This alignment is for cases when you don't want an item to fill grid's cell or it has a maximum size smaller than the cell. It then says which border do you want your item to stick to.

    If you want it to fill the cell leave it at default i.e. remove alignment="Qt::AlignLeft" from item definition.

  • 0 Votes
    6 Posts
    1k Views
    A

    @6thC cool story, thanks for the detailed reply! I've realized that QLegend isn't the best solution for me, so I ended up doing something similar to what you did. I'm using labels with a monospaced font and splitting the whole and fractional parts, so it's a lot nicer now

  • How QSizePolicy work?

    Unsolved General and Desktop
    8
    0 Votes
    8 Posts
    7k Views
    V

    @Chris-Kawa Oh, you are really guru of Qt. Thank for all.