Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. TableWidgets
Forum Update on Monday, May 27th 2025

TableWidgets

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 267 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • DriftwoodD Offline
    DriftwoodD Offline
    Driftwood
    wrote on last edited by Driftwood
    #1

    I've been using Pascal, almost exclusively, since 1986. Thirty-three years later, I'm 99% sure that I'd like to try my hand at C++. I've tried a few of the other IDEs and really like the look and feel of Qt.

    But my deal is this: I'm use to data-aware components on a form and am not so sure that I can get the same functionality from a Tablewidget as I wld get from a DBGrid. Youtube has a few tutorials that demonstrate tablewidgets holding data, but all of them get that data from line edits and the like that won't make it to the grid until, say, the user presses a save button. Everything has to be done on the grid...the tablewidget. This is a must. And that includes some kind of mechanism for adding new rows, such as arrowing down past the last record on the grid for a new row to be added.

    If someone can tell me this is possible, then I'll be at 100%.

    Thank you, Forum.

    1 Reply Last reply
    0
    • Chris KawaC Online
      Chris KawaC Online
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      In Qt data is handled by a model derived from QAbstractItemModel. This class has a general data() and setData() methods that do most of the heavy lifting.

      The view is a separate thing and there are several classes for different models. For tables there's the QTableWidget, which is a basic, generic, entry level view and a QTableView, which is a lower level but allows for greater control and is easier to tweak performance wise.

      Both of these are customizable to great extent. I'm not sure what you mean by "everything must be done on the grid", but the example you gave with adding a row via arrow key should be as easy as handling key press event in the view and calling insertRows() on the model.

      1 Reply Last reply
      2
      • M Offline
        M Offline
        MajidKamali
        wrote on last edited by
        #3

        I've been using Pascal, almost exclusively, since 1986. Thirty-three years later, I'm 99% sure that I'd like to try my hand at C++.

        Off topic, but why?

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved