请问下使用QQuickWidget窗口时、绑定的信号想传string出来怎么办
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
Item {
id: item
anchors.fill: parent
signal sendControlCmdToCamera(string cmd)
signal test(string str)
Rectangle
{
//行布局
Grid
{
columns: 2
spacing: 6
Button{
text: '聚焦+'
onClicked:
{
//sendControlCmdToCamera("http://192.168.1.88/cgi-bin/hi3510/param.cgi?cmd=ptzctrl&-step=0&-act=zoomin&-speed=45&-usr=admin&-pwd=1234qwer")
test("clicked");
console.log("clicked")
}
}
Button{
text: '聚焦-'
onClicked: model.submit()
}
Button{
text: '拉进'
onClicked: model.submit()
}
Button{
text: '拉远'
onClicked: model.submit()
}
}
}
}
信号链接:
QQuickItem *item = ui.quickWidget->rootObject();
// QObject * obj = (QObject*)item;
connect(item, SIGNAL(test(string)), this, SLOT(aaa(string)));
如果信号和槽函数都使用string槽函数不会响应。