Solved QGraphicsSvgItem is not recognizing the files with the svg images
-
Hi,
here is the class that i'm having problems withDiagramItem::DiagramItem(DiagramType diagramType, QMenu *contextMenu, QGraphicsItem *parent) : QGraphicsSvgItem(parent) { myDiagramType = diagramType; myContextMenu = contextMenu; switch (myDiagramType) { case StartEnd:{ item = new QSvgRenderer(QLatin1String("C:/Users/Lukas/Desktop/simulight_v2/images/trafosvg")); //this is the path for the svg image that i want to use break; } case Gerador:{ item = new QSvgRenderer(QLatin1String("C:/Users/Lukas/Desktop/simulight_v2/images/geradorsvg")); break; ... }// here the switch ends setSharedRenderer(item); setFlag(QGraphicsItem::ItemIsMovable, true); setFlag(QGraphicsItem::ItemIsSelectable, true); setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); }
the problem is that qt says it cannot open these files because they were not found, how can i fix it?
-
Hi,
Aren't you missing the file extension ?
Or a dot before the svg at the end of the filename ?