QGraphicsItems我试图用直线( )连接两个QGraphicsLineItem;通过在第一个对象上单击鼠标中键,然后将鼠标悬停在第二个对象上,释放它后,它应该在它们之间画线。
这是应该连接这些项目的函数。
void GraphicsBlock::connectBlocks(GraphicsBlock *block)
{
GraphicsConnect *connection = new GraphicsConnect(); //Class with QGraphicsLineItem
connection->line->setLine(QLineF(this->pos(), block->pos()));
}
Run Code Online (Sandbox Code Playgroud)
我正在处理一个场景,但在通过鼠标位置查找第二个块时遇到问题。函数mousePressEvent 应该与此代码一起使用:
if(event->button() == Qt::MiddleButton)
Connecting == true;
Run Code Online (Sandbox Code Playgroud)
在那之后mouseReleaseEvent
if(Connecting)
{
//Get object by mouse position here
//this.connectBlocks(..)
Connecting = false;
}
Run Code Online (Sandbox Code Playgroud)
我尝试scene->itemsAt(mouse.x(), mouse.y(), QTransform())过并且
scene->items(QPointF(mouse.x(),mouse.y())但它总是返回空列表。
编辑:这就是应用程序应该如何工作,蓝色椭圆被单击端口,现在我应该拖动(仍然按下鼠标)到另一个端口并释放鼠标。
我正在尝试将矩形绘制到 QML 中。包含有关这些矩形的信息的数据如下所示:
数据存储在数组中,数组中的每一项代表一个矩形。我正在寻找绘制这些矩形的最佳(或至少是一个好的)方法。
我应该使用 QML 的哪个组件?
h类
class MyClass : public QObject
{
Q_OBJECT
Q_PROPERTY(QList<structure> list READ list NOTIFY listChanged)
public:
QList<structure> list() const { return list_; }
signals:
listChanged();
private:
QList<structure> list_;
}
Run Code Online (Sandbox Code Playgroud)
中继器.qml
Repeater {
model: 2
delegate: Rectangle{
width: model.list.width
height: model.list.height
x: model.list.x
y: model.list.y
color: "red"
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Android 上构建我的应用程序。我有点卡住了
GstElement* pipeline = gst_parse_launch ("rtspsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov ! decodebin ! appsink name=sink", &err);
Run Code Online (Sandbox Code Playgroud)
因为,GError *err写出no element "rtspsrc". 我已经搜索了一些方法来添加缺少的插件/元素,但没有成功。
我找到了这个页面,它显示了如何在代码中安装插件,但是当我尝试时,gst_install_plugins_sync返回GST_INSTALL_PLUGINS_HELPER_MISSING时,从此时起,我不知道如何继续。
我已经完全构建了库,gstreamer-1.0包括libgstrtsp-1.0,但我不明白为什么我的程序找不到它。
如何向 android 添加插件/元素?
感谢您的帮助!
//编辑:
Link,我用它来构建libary,我使用的是Android 4.4.4