Basic Shapes: XML export/import added.

Many files were changed, so debugging required.
Minor Bug exists: 
If we export to xml first time, it is OK. But if we then add another shape and then export, then the new shape is not added in XML.
Reason: UndoAction not implemented at present for basi shape addition.


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2888 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
abhishekm71
2014-02-28 14:30:59 +00:00
parent dce76e46c9
commit 092c638868
11 changed files with 195 additions and 31 deletions

View File

@@ -35,6 +35,7 @@ DiagramContent::DiagramContent(const DiagramContent &other) :
elements(other.elements),
textFields(other.textFields),
images(other.images),
shapes(other.shapes),
conductorsToUpdate(other.conductorsToUpdate),
conductorsToMove(other.conductorsToMove),
otherConductors(other.otherConductors)
@@ -71,6 +72,7 @@ void DiagramContent::clear() {
elements.clear();
textFields.clear();
images.clear();
shapes.clear();
conductorsToUpdate.clear();
conductorsToMove.clear();
otherConductors.clear();
@@ -86,6 +88,7 @@ QList<QGraphicsItem *> DiagramContent::items(int filter) const {
if (filter & Elements) foreach(QGraphicsItem *qgi, elements) items_list << qgi;
if (filter & TextFields) foreach(QGraphicsItem *qgi, textFields) items_list << qgi;
if (filter & Images) foreach(QGraphicsItem *qgi, images) items_list << qgi;
if (filter & Shapes) foreach(QGraphicsItem *qgi, shapes) items_list << qgi;
if (filter & SelectedOnly) {
foreach(QGraphicsItem *qgi, items_list) {
if (!qgi -> isSelected()) items_list.removeOne(qgi);
@@ -104,6 +107,7 @@ int DiagramContent::count(int filter) const {
if (filter & Elements) foreach(Element *element, elements) { if (element -> isSelected()) ++ count; }
if (filter & TextFields) foreach(DiagramTextItem *dti, textFields) { if (dti -> isSelected()) ++ count; }
if (filter & Images) foreach(DiagramImageItem *dii, images) { if (dii -> isSelected()) ++ count; }
if (filter & Shapes) foreach(QetShapeItem *dsi, shapes) { if (dsi -> isSelected()) ++ count; }
if (filter & ConductorsToMove) foreach(Conductor *conductor, conductorsToMove) { if (conductor -> isSelected()) ++ count; }
if (filter & ConductorsToUpdate) foreach(Conductor *conductor, conductorsToUpdate) { if (conductor -> isSelected()) ++ count; }
if (filter & OtherConductors) foreach(Conductor *conductor, otherConductors) { if (conductor -> isSelected()) ++ count; }
@@ -112,6 +116,7 @@ int DiagramContent::count(int filter) const {
if (filter & Elements) count += elements.count();
if (filter & TextFields) count += textFields.count();
if (filter & Images) count += images.count();
if (filter & Shapes) count += shapes.count();
if (filter & ConductorsToMove) count += conductorsToMove.count();
if (filter & ConductorsToUpdate) count += conductorsToUpdate.count();
if (filter & OtherConductors) count += otherConductors.count();
@@ -130,13 +135,15 @@ QString DiagramContent::sentence(int filter) const {
int conductors_count = conductors(filter).count();
int textfields_count = (filter & TextFields) ? textFields.count() : 0;
int images_count = (filter & Images) ? images.count() : 0;
int shapes_count = (filter & Shapes) ? shapes.count() : 0;
return(
QET::ElementsAndConductorsSentence(
elements_count,
conductors_count,
textfields_count,
images_count
images_count,
shapes_count
)
);
}