Ok I have a dialog with a QGraphicsView inside.
In my header i have QGraphicsScene *SampleScene;
query.exec( "SELECT x,y FROM samples;" );
while( query.next() )
{
( minX - query.value(0).toDouble() ) * -scaleX, ( maxY - query.value(1).toDouble() ) * scaleY, 5, 5 );
SampleScene->addItem(item);
}
ui.
graphicsView->setRenderHints
( QPainter::Antialiasing );
ui.graphicsView->setScene(SampleScene);
SampleScene = new QGraphicsScene;
query.exec( "SELECT x,y FROM samples;" );
while( query.next() )
{
QGraphicsItem *item = new QGraphicsRectItem (
( minX - query.value(0).toDouble() ) * -scaleX, ( maxY - query.value(1).toDouble() ) * scaleY, 5, 5 );
SampleScene->addItem(item);
}
ui.graphicsView->setRenderHints( QPainter::Antialiasing );
ui.graphicsView->setScene(SampleScene);
To copy to clipboard, switch view to plain text mode
I would prefer dots rather than squares and should be easier to draw. I have tried ui.graphicsView->setUpdatesEnabled(false) which helped slightly but still is very slow. I have also tried QGraphicItemsGroup which I have yet to get working for some reason. I would put the items into a QList of QGraphicItems and then
SampleGroup = SampleScene->createItemGroup ( list );
SampleGroup->show();
SampleGroup = SampleScene->createItemGroup ( list );
SampleGroup->show();
To copy to clipboard, switch view to plain text mode
But I could never see the points. I have studied the 40000 chips example and have also implemented a custom QGraphicsItem which helped slightly in speed. Everything else looks similar to the chips example but much slower.
Bookmarks