Results 1 to 2 of 2

Thread: QTableWidget relocate data

  1. #1
    Join Date
    May 2017
    Posts
    11
    Qt products
    Qt5
    Platforms
    Windows

    Default QTableWidget relocate data

    So I have a table widget that's 4x4 which results in 16 data entries(these data entries are qwidgets). Then when i fullscreen I will have 8x2, what is the most efficient way of doing this?

    Currently I'm clearing the table out and then adding the items again from scratch, however when the numbers scale up this is an extremely inefficient method of doing it.

    Note: I tried to thread this process and then run QApplication.processEvents() to avoid the "lag" feeling, however when i did this everything else on the window would get shifted out of place if i resized the window fast in succession.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QTableWidget relocate data

    I don't know of any way to do this except in the way you have described. QTableWidget isn't really intended to be dynamically reconfigured like that - you aren't actually using it as a table with defined columns, your use is more of a linear array of cells that you flow from left to right and top to bottom depending on your window size. Your "table" doesn't really have the concept of a "row" because you slide things from row to row and column to column as the size of the window changes.

    You should take a look at the Flow Layout example, which demonstrates the kind of behavior you are looking for. Substitute QLabel for the QPushButton items in the example, set the margins and sizes appropriately, and I think it will do what you want.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QTableWidget save data
    By marvic_44 in forum Qt Programming
    Replies: 16
    Last Post: 2nd January 2017, 23:39
  2. How to add data into the QTableWidget
    By grsandeep85 in forum Qt Programming
    Replies: 6
    Last Post: 15th November 2013, 03:55
  3. how to populate data in QTableWidget
    By gauravg in forum Qt-based Software
    Replies: 1
    Last Post: 25th March 2011, 12:50
  4. need get data from selected row from QTableWidget?
    By johnibat in forum Qt Programming
    Replies: 15
    Last Post: 16th February 2011, 17:15
  5. QTableWidget - inserting data
    By Tomasz in forum Newbie
    Replies: 1
    Last Post: 29th September 2010, 14:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.