Results 1 to 2 of 2

Thread: Reading rows from qtableview and using them to draw in new window

  1. #1
    Join Date
    Nov 2019
    Qt products

    Default Reading rows from qtableview and using them to draw in new window

    Hello, I need little bit of help. I'm trying to draw a simple map of a grid based maze, but I got stuck at the start of my project. I loaded the data about the maze (coordinates of individual squares, position of the obstacles and orientation of a robot moving through the maze) from database to QTableView. From this tableview I would like to read values from individual rows and then by clicking on button draw in new window lines accordingly to the obstacles.
    : would appreciate your help.

  2. #2
    Join Date
    Jan 2008
    Alameda, CA, USA
    Thanked 864 Times in 851 Posts
    Qt products

    Default Re: Reading rows from qtableview and using them to draw in new window

    This sounds a lot like a homework problem to me. Aren't you supposed to be doing this on your own instead of asking for help here every time you run into a problem?

    First, QTableView is simply a way to display and interact with your internal data structure. This data structure is usually wrapped by a QAbstractTableModel that the view uses for display. When you click on something in the table view, the view's QItemSelectionModel is filled in with the information about the selection. The QModelIndex items in this selection model tell you which entries were selected, and these indices point to your original table model's items.

    It would be a very good idea for you to study the Qt Model / View tutorial and some of the many Qt model / view examples.
    <=== 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. QTableView with icons in rows
    By kasper360 in forum Newbie
    Replies: 6
    Last Post: 5th April 2011, 07:24
  2. Disable row/rows in QTableView
    By scott_hollen in forum Qt Programming
    Replies: 6
    Last Post: 28th March 2011, 19:16
  3. pyqt4 reading values from rows of QTableWidget
    By stephen76 in forum Newbie
    Replies: 2
    Last Post: 10th January 2011, 10:55
  4. Color the rows in QTableView
    By grub87 in forum Qt Programming
    Replies: 11
    Last Post: 17th June 2009, 21:41
  5. QTableView 2 rows inside every row
    By skuda in forum Qt Programming
    Replies: 3
    Last Post: 22nd April 2009, 10:23

Tags for this Thread


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.