DataWidget* WidgetArea::loadOneWidget(DataFileParser *file, bool skip) { // type if(!file->seekToNextBlock("widgetType", BLOCK_WIDGET)) return NULL; quint8 type = 0; file->read((char*)&type, sizeof(quint8)); // pos and size if(!file->seekToNextBlock("widgetPosSize", BLOCK_WIDGET)) return NULL; int val[4]; file->read((char*)&val, sizeof(val)); DataWidget *w = addWidget(QPoint(val[0], val[1]), type, !skip); if(!w) return NULL; w->resize(val[2], val[3]); w->loadWidgetInfo(file); if(skip) removeWidget(w->getId()); else updateMarker(w); return w; }
UndoAction *MoveAction::restore(WidgetArea *area) { DataWidget *w = area->getWidget(m_id); if(!w) return NULL; UndoAction *opposite = new MoveAction(w); w->setScaledUp(m_scaledUp); w->move(m_pos); w->resize(m_size); return opposite; }