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. QCamera can't be displayed in QGraphicsVideoItem

QCamera can't be displayed in QGraphicsVideoItem

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 749 Views 1 Watching
  • 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.
  • I Offline
    I Offline
    im-red
    wrote on last edited by
    #1

    In the Qt Doc:Camera Overview, it's said:

    In C++, your choice depends on whether you are using widgets, or QGraphicsView. The QCameraViewfinder class is used in the widgets case, and QGraphicsVideoItem is useful for QGraphicsView.

    I want to display camere image in QGraphicsView, so I write those code:

    ...
    videoItem = new QGraphicsVideoItem;
    camera->setViewfinder(videoItem);
    videoItem->setSize(QSizeF(100, 100));
    videoItem->setPos(0, 0);
    videoItem->setAspectRatioMode(Qt::IgnoreAspectRatio);
    scene->addItem(videoItem);
    camera->setCaptureMode(QCamera::CaptureVideo);
    camera->start();
    ...
    

    but it doesn't work. And if I replace the QGraphicsVideoItem with QCameraViewfinder, it works. (Qt 5.7.0)

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

      Hi and welcome to devnet,

      Got any error printed ?

      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
      0

      • Login

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