Reputation: 1406
i need some suggestion on how to add graphicsitem according to the menu list im getting from the server.
The server will provide me the list of menu item and sub items and each sub items will have their own list of items. i will receive it using TCP socket programming as a client.
now i have to add the items and sub items received from the server to the QGraphicsScene and view .. right now im using QGraphicsLayout to add the item Horizontal and vertical but i want to know if we have any thin like
modal->view like QTableView and QListView in QGraphicsView . if so or any other method available please help me ..
Upvotes: 1
Views: 131
Reputation: 27611
You can add widgets to a QGraphicsScene with a QGraphicsProxyWidget. Create a QTableView or QListView and add it to the scene:-
QGraphicsScene* pScene = new QGraphicsScene(x, y, width, height);
QTableView* pTableView = new QTableView;
// add the widget to the scene
QGraphicsProxyWidget* pProxyTableView = pScene->addWidget(pTableView);
In adding the widget, a QGraphicsProxyWidget pointer is returned, which can be moved around and placed in the scene at the desired location: -
pProxyTableView->setPos(newXPos, newYPos);
This is explained in more detail in the documentation.
Upvotes: 1