Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. QTableWidget vs QTableView for game boards? Or something else?
Forum Updated to NodeBB v4.3 + New Features

QTableWidget vs QTableView for game boards? Or something else?

Scheduled Pinned Locked Moved Game Development
5 Posts 5 Posters 5.8k Views 1 Watching
  • 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.
  • R Offline
    R Offline
    Reliance
    wrote on last edited by
    #1

    I'm making a series of game boards for solvers. Think checkers, sudoku, othello, go, chess. These sorts of things aren't really the same as spreadsheets. The backing data, the models or items, are series of gameboards all at different positions, one move ahead, two moves ahead, and so on. There could be hundreds and hundreds of boards in memory to evaluate different game moves. Backtracking and so on.

    But only one screen in front of the user.

    So for compactness and flexibility, which underlying model/view/item classes make sense for game boards?

    Each square on the board has just a few bits of information, but becomes a displayed cell on the screen, at some point. So speed and compactness are of greatest importance.

    1 Reply Last reply
    0
    • ZlatomirZ Offline
      ZlatomirZ Offline
      Zlatomir
      wrote on last edited by
      #2

      "QTableWidget":http://doc.qt.nokia.com/latest/qtablewidget.html an item-based table view with a default model. The items in a QTableWidget are "QTableWidgetItem":http://doc.qt.nokia.com/latest/qtablewidgetitem.html

      And if you want a table that uses your own data model you should use "QTableView":http://doc.qt.nokia.com/latest/qtableview.html rather than QTableWidget.

      https://forum.qt.io/category/41/romanian

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        I think, for a game board, you need a special widget. YOu have fix cell properties (height, size, ...) perhaps you need not squares but triangles etc...

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          I think you'll have to come up with your own models for this. The default item models that come with Qt are simply not suitable for such an application. Also, I think that for visualization you probably need something else than a QTableView (or -Widget, for that matter). A game board is not a table.

          For visualization, you might look into QML.

          1 Reply Last reply
          0
          • I Offline
            I Offline
            Iktwo
            wrote on last edited by
            #5

            you could try using labels (With icons) and a Grid layout, maybe an array of labels that represents each square and another array with icons that represent the player, you cant try that way..

            1 Reply Last reply
            0

            • Login

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