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

how to synchronize QTableViews in layouts ?



  • Hello, i am recreating my topic because because the other title was linked to another problem.

    i'm working on a Qt project with an interface and i'm using four QTableViews and for some reason, the last one is not following the others when i stretch the windows. the 4 tableviews have the exact same parameters and layout configuration. they are in layouts, along with other items on the interface. i set the MaximumWidth of my tableview like this : 03df00ec-9958-4d8a-8757-ee40e6f1b5ea-image.png

    and here's what i get when i launch my program and when i stretch the window :f3bf5c65-fe86-4729-8c31-1a7162e442dc-image.png

    as you can see the last qtableview goes way farther and the other ones along with its QPushButton and labels. i dont get why does it behave like this. has anyone dealt with this problem ?

    thank you in advance



  • @aftalib

    How does your layout look like? What is your layoutStretch?



  • @Pl45m4 90d1fa2f-13db-4770-92c6-eddde2b28f37-image.png

    here's my layout for the bottom part of the window. my layout stretch is 1,7,1,3 (the spacer,the layout with the two tableviews in it, the other spacer and the last table view)

    the layout stretch is the same on the upper part and on the bottom part



  • @aftalib said in how to synchronize QTableViews in layouts ?:

    the layout stretch is the same on the upper part and on the bottom part

    That seems weird... If both of your TableViews are in the same layout with the same stretch and resize policy, they should not behave differently (since the spacer pushes the whole layout and its content while resizing the window).

    Are the resize policies of your tableViews and the right widgets in the layout really the same?



  • @aftalib Did you modify the layout behavior through code?



  • Hello, after looking for multiples answers (in vain..) i decided to start my interface from scratch. it resolved my problem. i think that i probably made too many modifications on my tableview and some things that i didnt remember of were getting in the way. thank you anyway for your answers


Log in to reply