Unsolved My custom QML item always have the size of the window
-
My custom C++ QML item is called
OpenGlVideoQtQuick
import QtQuick 2.0 import A 1.0 Item { width: 1280 height: 720 OpenGlVideoQtQuick { width: 640 height: 480 uri: "rtsp://admin:123456@192.168.0.103:10554/tcp/av0_0" } }
Here's its interface:
class OpenGlVideoQtQuick : public QQuickItem { Q_OBJECT Q_PROPERTY(qreal t READ t WRITE setT NOTIFY tChanged) public: OpenGlVideoQtQuick(); QString uri; qreal t() const { return m_t; } void setT(qreal t); signals: void tChanged(); public slots: void sync(); void cleanup(); void update();//Updates the window private slots: void handleWindowChanged(QQuickWindow *win); private: qreal m_t; OpenGlVideoQtQuickRenderer *openGlVideoQtQuickRenderer; };
Even if I explicitly say that it should have the size 640x480, inside an item of size 1280x720, it always gets the size of the entire screen, which is 1280x720.
What am I doing wrong?
-
@lucaszanella HI,
I really don't know that what exactly happening in your code.
Just try parenting approach.
width:parent * 0.75
height:parent * 0.55