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. Table in QGraphicsscene

Table in QGraphicsscene

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 658 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.
  • S Offline
    S Offline
    Sridharan
    wrote on last edited by Sridharan
    #1

    Hi,

    I need to add table to QGraphicsscene. Is it possible to use QTableWidget or QTableView ?

    Already items added in my scene like rectangle, ellipse, image are resizable. So, i need to resize table also.

    My requirements are,

    1. Dynamic cell content edit
    2. Resize entire table
    3. Resize individual cell by row/column
    4. Cell to support different content (text, image)
    5. Cut, copy, paste operation

    A small example of how to show table within scene would be helpful

    jsulmJ A 2 Replies Last reply
    0
    • S Sridharan

      Hi,

      I need to add table to QGraphicsscene. Is it possible to use QTableWidget or QTableView ?

      Already items added in my scene like rectangle, ellipse, image are resizable. So, i need to resize table also.

      My requirements are,

      1. Dynamic cell content edit
      2. Resize entire table
      3. Resize individual cell by row/column
      4. Cell to support different content (text, image)
      5. Cut, copy, paste operation

      A small example of how to show table within scene would be helpful

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Sridharan said in Table in QGraphicsscene:

      Is it possible to use QTableWidget or QTableView ?

      https://doc.qt.io/qt-6/qgraphicsscene.html#addWidget

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply
      2
      • S Sridharan

        Hi,

        I need to add table to QGraphicsscene. Is it possible to use QTableWidget or QTableView ?

        Already items added in my scene like rectangle, ellipse, image are resizable. So, i need to resize table also.

        My requirements are,

        1. Dynamic cell content edit
        2. Resize entire table
        3. Resize individual cell by row/column
        4. Cell to support different content (text, image)
        5. Cut, copy, paste operation

        A small example of how to show table within scene would be helpful

        A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #3

        @Sridharan
        It's possible (as jsulm noted), but don't expect great performance. Hopefully, it's sufficient for your use case.

        1 Reply Last reply
        0
        • jsulmJ jsulm

          @Sridharan said in Table in QGraphicsscene:

          Is it possible to use QTableWidget or QTableView ?

          https://doc.qt.io/qt-6/qgraphicsscene.html#addWidget

          S Offline
          S Offline
          Sridharan
          wrote on last edited by Sridharan
          #4

          @jsulm @Asperamanca

          Table appears on the scene but item is not movable and not selectable. Any other changes needed ?

          QGraphicsRectItem* proxyParent = new QGraphicsRectItem(QRectF(0, 0, 100, 100));
          proxyParent->setFlag(QGraphicsItem::ItemIsMovable);
          proxyParent->setFlag(QGraphicsItem::ItemIsSelectable);
          proxyParent->setPos(300, 30);
          scene->addItem(proxyParent);
          
          QTableWidget* table = new QTableWidget(3, 3);
          QGraphicsProxyWidget* tableProxy = new QGraphicsProxyWidget;
          tableProxy->setWidget(table);
          tableProxy->setParentItem(proxyParent);
          
          JonBJ 1 Reply Last reply
          0
          • S Sridharan

            @jsulm @Asperamanca

            Table appears on the scene but item is not movable and not selectable. Any other changes needed ?

            QGraphicsRectItem* proxyParent = new QGraphicsRectItem(QRectF(0, 0, 100, 100));
            proxyParent->setFlag(QGraphicsItem::ItemIsMovable);
            proxyParent->setFlag(QGraphicsItem::ItemIsSelectable);
            proxyParent->setPos(300, 30);
            scene->addItem(proxyParent);
            
            QTableWidget* table = new QTableWidget(3, 3);
            QGraphicsProxyWidget* tableProxy = new QGraphicsProxyWidget;
            tableProxy->setWidget(table);
            tableProxy->setParentItem(proxyParent);
            
            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #5

            @Sridharan
            Make QGraphicsProxyWidget movable & selectable ?

            S 1 Reply Last reply
            2
            • JonBJ JonB

              @Sridharan
              Make QGraphicsProxyWidget movable & selectable ?

              S Offline
              S Offline
              Sridharan
              wrote on last edited by
              #6

              @JonB

              Thanks. It's working

              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