Python Forum
[PyQt] Qtableview adapte size to
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] Qtableview adapte size to
#4
Sorry about the error. I don't have pandas and I was winging it. I also don't use QMainWindow all that much. Your were correct to create a widget and assign it as the central widget.

The layout widgets do their best to adjust widget sizes to fill the available space. The only time widgets get squeezed out is when widgets are crushed down to their minimum size and the window is shrunk even further. Normally that's not even possible because the layout tells the desktop manager what the minimum size is for the window.

The window manager adjusts widget sizes based on size hints set for the widget and by the stretch factors set in the layout. You should start by just adding all your widgets to layout managers and seeing what the results look like. I usually start with a vertical box layout and then add rows. A row can be a single widget, or I can create a horizontal box layout to have multiple widgets oriented horizontally. There is also a grid layout if your layout follows a grid pattern. Start playing with these to learn how they work and then you can start thinking about tweaking things. For example, you can set a minimum and/or maximum size of a widget in a layout and the layouts will adjust. You can set different stretch factors for different widgets, so they don't grow or shrink at the same rate.
Reply


Messages In This Thread
Qtableview adapte size to - by WBPYTHON - Mar-22-2020, 06:51 PM
RE: Qtableview adapte size to - by deanhystad - Mar-22-2020, 08:27 PM
RE: Qtableview adapte size to - by WBPYTHON - Mar-22-2020, 10:03 PM
RE: Qtableview adapte size to - by deanhystad - Mar-23-2020, 01:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] PyQt5 QTableView SQLite : edit cell HeinKurz 2 2,467 Mar-27-2023, 10:41 AM
Last Post: HeinKurz
  [PyQt] QStyledItemDelegate and QTableView malonn 1 1,690 Feb-07-2023, 07:15 PM
Last Post: malonn
  [PyQt] QTableView set header labels HeinKurz 2 6,991 Jan-23-2023, 08:46 AM
Last Post: HeinKurz
  [PyQt] Determine whether text in QTableView cell is fully visible or not random_nick 0 1,015 Oct-27-2022, 09:29 PM
Last Post: random_nick
  [PyQt] QTableView: scroll to top cell of the screen random_nick 2 2,905 Oct-08-2022, 12:29 AM
Last Post: random_nick
  [PyQt] [Solved]Add a Blank Row To QTableView Extra 3 5,648 Oct-02-2022, 04:53 PM
Last Post: Extra
  How to update the list of a combo box in a QTableView panoss 10 6,326 Feb-05-2022, 03:24 PM
Last Post: panoss
  [PyQt] How to Copy-Paste a table from Office apps to QTableView? Vittorio 5 7,333 Aug-05-2021, 11:14 AM
Last Post: Axel_Erfurt
  [Tkinter] Trying to change font size w/o changing button size python63 3 9,927 Aug-05-2020, 01:04 AM
Last Post: Larz60+
  [PyGUI] Showing text in QTableView sequence 0 3,098 Jan-20-2019, 05:00 PM
Last Post: sequence

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020