Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsSvgItem is not recognizing the files with the svg images

QGraphicsSvgItem is not recognizing the files with the svg images

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 214 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    frnklu20
    wrote on last edited by frnklu20
    #1

    Hi,
    here is the class that i'm having problems with

    DiagramItem::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?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Aren't you missing the file extension ?
      Or a dot before the svg at the end of the filename ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved