Table in QGraphicsscene
-
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,
- Dynamic cell content edit
- Resize entire table
- Resize individual cell by row/column
- Cell to support different content (text, image)
- Cut, copy, paste operation
A small example of how to show table within scene would be helpful
-
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,
- Dynamic cell content edit
- Resize entire table
- Resize individual cell by row/column
- Cell to support different content (text, image)
- Cut, copy, paste operation
A small example of how to show table within scene would be helpful
@Sridharan said in Table in QGraphicsscene:
Is it possible to use QTableWidget or QTableView ?
-
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,
- Dynamic cell content edit
- Resize entire table
- Resize individual cell by row/column
- Cell to support different content (text, image)
- Cut, copy, paste operation
A small example of how to show table within scene would be helpful
@Sridharan
It's possible (as jsulm noted), but don't expect great performance. Hopefully, it's sufficient for your use case. -
@Sridharan said in Table in QGraphicsscene:
Is it possible to use QTableWidget or QTableView ?
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);
-
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);