Hi,
I have code like this:
scene->set_brush(this->get_lp()->get_brush());
scene->set_pen(this->get_lp()->get_pen());
QListIterator<db_rect *> iter_rect(this->rect_list);
while(iter_rect.hasNext()) {
rect = iter_rect.next();
scene->addItem(rect);
}
QListIterator<db_box *> iter_box(this->box_list);
while(iter_box.hasNext()) {
box = (db_box *) iter_box.next();
scene->addItem(box);
}
QListIterator<db_path *> iter_path(this->path_list);
while(iter_path.hasNext()) {
path = iter_path.next();
scene->addItem(path);
}
QListIterator<db_polygon *> iter_polygon(this->polygon_list);
while(iter_polygon.hasNext()) {
polygon = iter_polygon.next();
scene->addItem(polygon);
}
QListIterator<db_text *> iter_text(this->text_list);
while(iter_text.hasNext()) {
text = iter_text.next();
scene->addItem(text);
}
scene->set_brush(this->get_lp()->get_brush());
scene->set_pen(this->get_lp()->get_pen());
QListIterator<db_rect *> iter_rect(this->rect_list);
while(iter_rect.hasNext()) {
rect = iter_rect.next();
scene->addItem(rect);
}
QListIterator<db_box *> iter_box(this->box_list);
while(iter_box.hasNext()) {
box = (db_box *) iter_box.next();
scene->addItem(box);
}
QListIterator<db_path *> iter_path(this->path_list);
while(iter_path.hasNext()) {
path = iter_path.next();
scene->addItem(path);
}
QListIterator<db_polygon *> iter_polygon(this->polygon_list);
while(iter_polygon.hasNext()) {
polygon = iter_polygon.next();
scene->addItem(polygon);
}
QListIterator<db_text *> iter_text(this->text_list);
while(iter_text.hasNext()) {
text = iter_text.next();
scene->addItem(text);
}
To copy to clipboard, switch view to plain text mode
Works great when I have thousands of objects. However, when I add millions, it is awfully slow. I am sure I am missing something. I was trying to figure out how to paint on a pixmap when using addItem but to no avail.
Please help.
Thanks -- RK
Bookmarks