qt - Paste at mousepressEvent -
i want implement paste operation in qt. have implemented past operation want paste items @ current position of mouse. please suggest me way proceed. code above follows: cadgraphicsscene.cpp
void cadgraphicsscene::cut() { foreach (qgraphicsitem *item, itemlist) { if (item->isselected()) { selectitems(); removeitem(item); update(); } } } void cadgraphicsscene::paste() { selectitems(); foreach (qgraphicsitem *item, itemlist) { additem(item); } } void cadgraphicsscene::selectitems() { // refresh record of selected items , starting positions selecteditems.clear(); foreach (qgraphicsitem *item, itemlist) { if (item->isselected()) { if (dynamic_cast<qgraphicsitem *>(item)) { selecteditems.append(qmakepair( dynamic_cast<qgraphicsitem *>(item), item->scenepos())); } } } }
qt qgraphicsview qgraphicsitem
No comments:
Post a Comment