Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. qgraphicsscene

    Log in to post
    • All categories
    • JeKK666

      Solved Undo drawing in QGraphicsScene - rate my solution
      Mobile and Embedded • qgraphicsscene qundocommand • • JeKK666

      3
      0
      Votes
      3
      Posts
      49
      Views

      JeKK666

      @JonB Thanks for your feedback :)

    • Narutoblaze

      Unsolved High memory usage when using multiple QPixmap
      General and Desktop • qgraphicsview pixmap memory leak qgraphicsitem qgraphicsscene • • Narutoblaze

      10
      0
      Votes
      10
      Posts
      258
      Views

      Abderrahmene_Rayene

      Hi,

      See if this provides some explanation (read the comments as well):

      StackOverflow: Qt6 QLabel / QPixmap excessive memory usage

    • W

      Solved QGraphicsView background color different from QGraphicsScene
      General and Desktop • qgraphicsview qgraphicsscene background • • wazzdaman

      6
      0
      Votes
      6
      Posts
      400
      Views

      W

      @JonB I moved my code into QGraphicsView::drawBackground() as you recommended, it works nicely. Thanks a lot!

    • N

      Unsolved Render just a specific area of a QGraphicsScene
      General and Desktop • widgets qgraphicsscene qgraphicsview render to image rubber band • • nitro0

      5
      0
      Votes
      5
      Posts
      144
      Views

      N

      @wrosecrans
      I know that I need them. But don‘t know how to apply them on the scene and keep everything thats on that. I thought that the rect itself has the points in it using the render function of the QGraphicsScene is enough.

      What I do: I set the DragMode of the QGraphicsView to rubberband so the user can select some part pf the scene by simply dragging. The returned rect is now sent to the view to get the underlying image of the scene.

    • J

      Unsolved QGraphicsView resize issue
      General and Desktop • qgraphicsview qgraphicsscene qpixmap • • Josef Lintz

      7
      0
      Votes
      7
      Posts
      190
      Views

      SGaist

      Animation, composition, overlaying and whatever comes to your imagination.

      That said, if you are really only showing one single image and nothing more then, indeed, a QLabel is enough.

    • T

      Solved Apply a transformation to all QGraphicsItem in a QGraphicsScene
      General and Desktop • c++ qtwidgets qgraphicsscene qtransform qgraphicsitemgr • • ThThoma

      5
      0
      Votes
      5
      Posts
      341
      Views

      T

      At the end I've researched again the view's transformations and concluded to support both features and warn for the complexity.

      I did not re-implement the add/remove items of the scene together with a group. Thanks for the hint @Asperamanca .

    • L

      Unsolved rotated qgraphicssceneitem bounding rect
      General and Desktop • qgraphicsscene qgraphicsitem qpolygon qrect rotation • • Loc888

      3
      0
      Votes
      3
      Posts
      311
      Views

      T

      Hey, not sure if you found the solution yet. But you can try this:

      QGraphicsPixmapItem *pixmapItem = new QGraphicsPixmapItem; pixmapItem->setPixmap(QPixmap(":/images/pixmap.png")); _scene->addItem(pixmapItem); pixmapItem->setRotation(pixmapItem->rotation() + 45.0); QGraphicsRectItem *boundingRect = new QGraphicsRectItem(pixmapItem->sceneBoundingRect()); QPen outlinePen; outlinePen.setWidth(2); outlinePen.setColor(Qt::red); boundingRect->setPen(outlinePen); _scene->addItem(boundingRect);

      I believe what you want is the sceneBoundingRect() and not the boundingRect().

    • H

      Unsolved Custom coordinate system using QGraphicsView, QGraphicsScene and QGraphicsRectItem
      General and Desktop • qgraphicsscene qgraphicsview coordinate • • HappyVisualizer

      4
      0
      Votes
      4
      Posts
      315
      Views

      Pl45m4

      @HappyVisualizer

      Since your view is in a layout... have you tried to set the layout margin to 0?

    • C

      Solved Question about QGraphicsScene and QGraphicsPixmapItem
      General and Desktop • qgraphicspixmap qgraphicsscene mousepressevent mousemoveevent • • CAP 33

      10
      0
      Votes
      10
      Posts
      454
      Views

      C

      I solved my problem via event filter of scene.

      ui->graphicsView->scene()->installEventFilter(this); bool MainWindow::eventFilter(QObject* obj, QEvent* event){ if(event->type() == QEvent::GraphicsSceneMousePress){ if(ui->addServerBtn->isChecked()){ QGraphicsSceneMouseEvent* mouseSceneEvent; mouseSceneEvent = static_cast<QGraphicsSceneMouseEvent *>(event); Server *serv = new Server(mouseSceneEvent->scenePos().toPoint()); scene->addItem((QGraphicsPixmapItem*)serv); } } return false; }
    • D

      Solved QGraphicsItem set item pos using Cursor
      General and Desktop • qgraphicsscene qgraphicsview qcursor • • Dariusz

      2
      0
      Votes
      2
      Posts
      193
      Views

      D

      For any1 wondering, its more or less >
      item->setPos(mNodeViewPtr->mapToScene(mNodeViewPtr->mapFromGlobal(QCursor::pos())));
      you can most likely do mNodeViewPtr->viewport()->mapFromGlobal() for more precision I think but I didn't test it.

    • S

      Solved Receive Drag/Drop events for items in QGraphicsScene
      General and Desktop • qgraphicsview drag and drop event handling qgraphicsscene • • sticky thermos

      8
      0
      Votes
      8
      Posts
      419
      Views

      Pl45m4

      @sticky-thermos said in Receive Drag/Drop events for items in QGraphicsScene:

      void ChessBoard::mouseMoveEvent(QMouseEvent *event) {
      std::cout << FUNCTION << std::endl;
      QGraphicsView::mousePressEvent(event);
      QDrag *drag = new QDrag(this);
      QMimeData *mime = new QMimeData; // this is necessary even if nothing is set in the mime data
      drag->setMimeData(mime);
      drag->exec();
      }

      Looks good, but I would add a check to differenciate whether your mouseButton is down. Otherwise you are creating a lot of drags from just moving your mouse around on your chessBoard.

      Also, you are passing the ChessBoard::mouseMoveEvent(QMouseEvent *event) to QGraphicsView::mousePressEvent(event).
      QGraphicsView::mouseMoveEvent would be more fitting :)

    • S

      Solved Add a movable tableview to a qt scene
      General and Desktop • qt desktop qgraphicsscene qtableview qt widget • • sachinrd

      3
      0
      Votes
      3
      Posts
      207
      Views

      S

      Thanks for the reply @SGaist . This helps

    • S

      Unsolved add a textedit widget to a graphics view scene
      General and Desktop • qt desktop textedit graphicsview qgraphicsscene • • sachinrd

      1
      0
      Votes
      1
      Posts
      219
      Views

      No one has replied

    • artwaw

      Solved Animated GIF in QGraphicsScene/QGraphicsView
      General and Desktop • qgraphicsscene qgraphicsview qmovie gif animations • • artwaw

      8
      0
      Votes
      8
      Posts
      3625
      Views

      artwaw

      @Chris-Kawa Noted thank you. Now it compiles without errors. I think I need to read a bit about newer c++...

    • T

      Unsolved Web enabling a desktop app.
      QtWebEngine • web app qpainter qgraphicsscene • • TenG

      4
      0
      Votes
      4
      Posts
      422
      Views

      JonB

      @TenG
      Be aware that not all of Qt modules are supported in WASM. Before anything, check the list at https://doc.qt.io/qt-5/wasm.html#supported-qt-modules against what is in your app. For example, it doesn't do databases, you can't access the local file system, and so on. Also I noticed this time that it requires a Qt static build, but maybe you have to have that for iOS anyway, I don't know.

      If it works for you it's a really simple solution compared to rewriting anything. Just check out the gotchas.

    • D

      Unsolved Pyside6 how to disconnect connection?
      General and Desktop • qgraphicsscene qgraphicsitem qobje signal • • Dariusz

      34
      0
      Votes
      34
      Posts
      5037
      Views

      jeremy_k

      I guess I provided inadequate subtext for that example. It's documentation in a project I work on, explaining that qObject.signal.connect(lambda: anotherQObject.function(arg)) is unsafe in PyQt if anotherQObject might be destroyed before qObject. The same would happen in C++ with QObject::connect(qObject, &MyClass::signal, [&]() { anotherQObject->function(arg); });

      In C++, one possible solution is to use QObject::Connect(sender, signal, context object, functor). To the best of my knowledge In PyQt5, and I suspect in PySide2/Qt for Python, there is no equivalent. You can write one by taking the connection object returned by object.signal.connect() and using it in a slot connected to anotherQObject.destroyed.