Results 1 to 1 of 1

Thread: QGraphics scene use lagre memory count

  1. #1
    Join Date
    Oct 2013
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default QGraphics scene use lagre memory count

    Good day. It was necessary for me write application which draw graph. For base code I used examles 40000 chips. Nodes and eges work correctly, but I have large problem. In some cases qt begin use lagre amount memory (gigabates). But it is not memory leak. I think that at use memory for intersection. So if reimplement function "shape" in class lines - qt don't demant memory. But in this case drawing will be wrong. How I can solve this problem with memory (if it is possible)?

    Here is function where I create graph. It is im file GraphWidget.cpp
    Qt Code:
    1. void GraphWidget::DoTestGraph()
    2. {
    3. QSharedPointer<GraphStruct> testGraph;
    4. testGraph = QSharedPointer<GraphStruct>(new GraphStruct);
    5. for (size_t ind = 0; ind < 100; ++ind) // Create nodes (Horizontal node count)
    6. {
    7. for (size_t jnd = 0; jnd < 100; ++jnd) // Vertical node count
    8. {
    9. GraphStruct::GraphVertex testvertex(QPoint(50*ind, 50*jnd), "node", "node_descr");
    10. testGraph->vertexList.push_back(testvertex);
    11. }
    12. }
    13. for (size_t ind = 0; ind < testGraph->vertexList.size() - 3; ++ind) // Create edges (links)
    14. {
    15. GraphStruct::GraphEdge testedge("link", "link_desc", 0/*to node*/, ind + 1/*from node*/); // Do all links to one node
    16. testGraph->edgeList.push_back(testedge);
    17. }
    18. graphView->CreateGraph(testGraph);
    19. }
    To copy to clipboard, switch view to plain text mode 

    At this place begin large memory allocation
    Qt Code:
    1. #include "..\..\QueryClient\NewGUI\QT_graph\GraphWidget.h"
    2. #include <QtWidgets/QApplication>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7.  
    8. ST::User::GraphWidget gw;
    9. gw.show();
    10.  
    11. return a.exec(); // At this place begin large memory allocation
    12. }
    To copy to clipboard, switch view to plain text mode 

    I attach files which necessary to compile project. If necessary change pos nodes or links when graph creates, so change function DoTestGraph
    Attached Files Attached Files

Similar Threads

  1. QGraphics scene position
    By junix in forum Newbie
    Replies: 6
    Last Post: 17th April 2012, 03:41
  2. Saving QGraphics Scene items
    By chaltier in forum Qt Programming
    Replies: 1
    Last Post: 3rd April 2012, 06:35
  3. Infinite (circular) QGraphics Scene
    By maitai in forum Qt Programming
    Replies: 10
    Last Post: 27th March 2011, 15:23
  4. QGraphics View Scene performance with polylines
    By iampowerslave in forum Qt Programming
    Replies: 0
    Last Post: 15th November 2010, 17:03
  5. MouseEvent in QGraphics Scene?
    By fanatos in forum Newbie
    Replies: 1
    Last Post: 9th September 2010, 17:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.