Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Problems to adjust QGridLayout to requirements



  • Hi,

    I'm working on a project which uses a QGrid Layout to align some widgets, now I needed to add an additional widget above someother widgets and for some reason, Qt Creator does not give me the option to merge two automatially added columns together - or better, I don't know how to merge two columns. This is what I have:
    b28fe72e-ae36-4e4d-ae39-5f3c04503f1c-image.png
    and I would like to merge the column with the QComboBox with the empty column to the right of it so that the QComboBox has the same width as the QLineEdit underneath it.
    I've tried to set the minimum Size of the QComboBox but it seems to just extend to the right along with the empty column staying the same width (instead of taking up the empty column's space). I must be looking at the wrong setting. How do I modify/remove that "empty" space?



  • @cerr select combo box and expand horizontally in right direction it should occupy the
    empty space right to it
    If not check follow things for the combo box
    1)What is the horizontal policy property set? it should not be fixed. either Preferred / Expanding
    2)Check Maximum size value?



  • the layoutColumnMinimumWidth in the QFGridLayout is set to 0,0,0,0,0


  • Lifetime Qt Champion

    Hi
    Cant you just delete the layout in it ? ( the red box ) to the right of it ?
    and drag the combobox to be the same size as the RFID ?

    This function allows a widget to span multiple cols
    https://doc.qt.io/qt-5/qgridlayout.html#addItem
    but im not sure you need that.



  • @cerr select combo box and expand horizontally in right direction it should occupy the
    empty space right to it
    If not check follow things for the combo box
    1)What is the horizontal policy property set? it should not be fixed. either Preferred / Expanding
    2)Check Maximum size value?



  • @nagesh Haha :boom: I knew it was something along these lines:
    "select combo box and expand horizontally in right direction it should occupy the
    empty space right to it"
    Shame on me and awesome! Thank you very much! lol
    I never asked that question, right? :D