Results 1 to 3 of 3

Thread: Moving whole rows between 3 different QTableWidgets after pressing buttons

  1. #1
    Join Date
    Apr 2010
    Posts
    9
    Thanks
    1

    Lightbulb Moving whole rows between 3 different QTableWidgets after pressing buttons

    Hi,
    I want to ask you about the best way to implement moving whole rows between 3 different QTableWidgets after pressing buttons or when I get such a datagram from server.
    This is how it looks like now:
    tableWidgets..jpg
    I have QMap<int, Player *> to store id and pointers of Player class where there are fields like: QString nick, quint8 team_id,...
    When I press one of these join buttons I need to change team_id field of player who clicked it to 0 (Spectators), 1 (Home Team) or 2 (Away Team) and move the whole row with his id to proper QTableWidget. The same with information about other players changing their teams.

    What do you think will be the best solution for this problem?
    Last edited by And_re; 11th May 2010 at 14:57.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Moving whole rows between 3 different QTableWidgets after pressing buttons

    Have you considered:

    Changing the underlying data model should then automatically update your view tables.

  3. The following user says thank you to ChrisW67 for this useful post:

    And_re (12th May 2010)

  4. #3
    Join Date
    Apr 2010
    Posts
    9
    Thanks
    1

    Default Re: Moving whole rows between 3 different QTableWidgets after pressing buttons

    I was thinking about creating some Model but have never tried it. I would also like to use it for many items on the scene. Automatic update of all views is what I'm looking for.

Similar Threads

  1. Replies: 4
    Last Post: 26th October 2009, 22:25
  2. Switching/moving rows in a model
    By gri in forum Qt Programming
    Replies: 4
    Last Post: 17th December 2008, 11:21
  3. Dialog closes on pressing Esc key?
    By vishal.chauhan in forum Qt Programming
    Replies: 6
    Last Post: 3rd July 2008, 08:53
  4. closing of window on pressing ESC key
    By raghvendramisra in forum Newbie
    Replies: 2
    Last Post: 7th January 2008, 02:36
  5. QTableWidgets problems with columns
    By 3nc31 in forum Qt Programming
    Replies: 1
    Last Post: 24th October 2007, 08:47

Tags for this Thread

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.