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. How do I create a widget that looks like this
Forum Updated to NodeBB v4.3 + New Features

How do I create a widget that looks like this

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 275 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.
  • additional-pumpkinA Offline
    additional-pumpkinA Offline
    additional-pumpkin
    wrote on last edited by
    #1

    Screenshot_20230703_191531.png

    This is the lichess' analysis board game notation sidebar. I've been trying to replicate this design in qt. Currently I can draw the mainline only ignoring variations
    Screenshot_20230703_192619.png
    Even once I would eventually figure out how to draw the variations I will still need to figure out how to handle clicking and hovering on a move. Each move is associated with a MoveId so I would need to retrieve that.
    I think my approach could be fundemantally wrong as I'm doing everything in a paintEvent() of a custom QWidget. Maybe there is some other Qt Widget class that I can inherit, which is better suited for this. Or maybe there is a way to turn each move into it's own child widget? I dont really know what the proper approach would be for this.

    I can provide any code or further details so please ask if you need any.

    Pl45m4P 1 Reply Last reply
    0
    • M Offline
      M Offline
      MrShawn
      wrote on last edited by
      #2

      I'd personally look into doing this with QML.

      additional-pumpkinA 1 Reply Last reply
      0
      • M MrShawn

        I'd personally look into doing this with QML.

        additional-pumpkinA Offline
        additional-pumpkinA Offline
        additional-pumpkin
        wrote on last edited by
        #3

        @MrShawn How would you suggest doing this with QML? What should I look into?

        1 Reply Last reply
        0
        • additional-pumpkinA additional-pumpkin

          Screenshot_20230703_191531.png

          This is the lichess' analysis board game notation sidebar. I've been trying to replicate this design in qt. Currently I can draw the mainline only ignoring variations
          Screenshot_20230703_192619.png
          Even once I would eventually figure out how to draw the variations I will still need to figure out how to handle clicking and hovering on a move. Each move is associated with a MoveId so I would need to retrieve that.
          I think my approach could be fundemantally wrong as I'm doing everything in a paintEvent() of a custom QWidget. Maybe there is some other Qt Widget class that I can inherit, which is better suited for this. Or maybe there is a way to turn each move into it's own child widget? I dont really know what the proper approach would be for this.

          I can provide any code or further details so please ask if you need any.

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by
          #4

          @additional-pumpkin

          Custom data view (either custom widget as well or some tableView) with your chess data model.
          Esp. if you have database-like structures with identifiers for "moves" or any other action that is going on.

          You could start here:

          • https://doc.qt.io/qt-6/model-view-programming.html

            • https://doc.qt.io/qt-6/model-view-programming.html#model-classes

            • https://doc.qt.io/qt-6/model-view-programming.html#designing-a-model

          To have it displayed neatly, you could make your own delegates to show your data (moves) with the matching icon for every chess figure and more things you might want to add / display.


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          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