Results 1 to 6 of 6

Thread: Using QVideoProbe from QML

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2008
    Posts
    45
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Using QVideoProbe from QML

    Thanks, but why wouldn't these QML element classes be just subclasses of their Q* variants, along with being a subclass of QDeclartiveItem? Where does their magic happen? Are they proxies to a d pointer that does the magic?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Using QVideoProbe from QML

    A class can not be a subclass of to QObject derived classes.
    My guess is that those two are visual QtQuick components, i.e. they appear visually in the QML scene. In which case they need to derive from QDeclarativeItem.

    I don't know any details about their implementation but it is likely that they hold pointers to the non-UI classes, very likely indirectly through a d-pointer.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    Scorp2us (7th February 2014)

  4. #3
    Join Date
    Apr 2008
    Posts
    45
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Using QVideoProbe from QML

    I got it working like this
    Qt Code:
    1. bool VideoProbe::setSource(QObject* sourceObj)
    2. {
    3. m_source = sourceObj;
    4. bool ret =false;
    5. QMediaPlayer *player = qvariant_cast<QMediaPlayer*>(sourceObj->property("mediaObject"));
    6. qDebug() << "VideoProbe::setSource() player"<< player;
    7. ret = QVideoProbe::setSource((QMediaObject*)player);
    8. return ret;
    9. }
    To copy to clipboard, switch view to plain text mode 

  5. The following user says thank you to Scorp2us for this useful post:

    anda_skoa (7th February 2014)

  6. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Using QVideoProbe from QML

    Ah, good to know!

    Btw, you don't have to do another cast in line 7, the variable player is already of type QMediaPlayer

    Cheers,
    _

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.