feat:视频轮询
This commit is contained in:
parent
709b20ef53
commit
5175156b46
|
@ -10,6 +10,7 @@
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
// 相机列表JSON文件名称
|
// 相机列表JSON文件名称
|
||||||
const QString CameraJsonFileName = "camera.json";
|
const QString CameraJsonFileName = "camera.json";
|
||||||
|
@ -63,7 +64,37 @@ CameraLoopPlay::~CameraLoopPlay()
|
||||||
|
|
||||||
bool CameraLoopPlay::eventFilter(QObject* watched, QEvent* event)
|
bool CameraLoopPlay::eventFilter(QObject* watched, QEvent* event)
|
||||||
{
|
{
|
||||||
return false;
|
// 处理鼠标按下、释放和移动事件
|
||||||
|
if (watched == ui->widget_title) {
|
||||||
|
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
|
||||||
|
if (mouseEvent->type() == QEvent::MouseButtonPress) {
|
||||||
|
if (mouseEvent->button() == Qt::LeftButton) {
|
||||||
|
m_mousePressed = true; // 启动拖拽
|
||||||
|
m_mousePoint = mouseEvent->globalPos() - this->pos();
|
||||||
|
|
||||||
|
this->setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint | Qt::Window | Qt::WindowStaysOnTopHint);
|
||||||
|
this->show(); // 确保窗口显示
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (mouseEvent->type() == QEvent::MouseButtonRelease) {
|
||||||
|
m_mousePressed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (mouseEvent->type() == QEvent::MouseMove) {
|
||||||
|
if (m_mousePressed && (mouseEvent->buttons() & Qt::LeftButton)) {
|
||||||
|
this->move(mouseEvent->globalPos() - m_mousePoint);
|
||||||
|
|
||||||
|
// 每次移动时设置为最上方
|
||||||
|
this->setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint | Qt::Window | Qt::WindowStaysOnTopHint);
|
||||||
|
this->show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return QWidget::eventFilter(watched, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraLoopPlay::on_pushButton_min_clicked()
|
void CameraLoopPlay::on_pushButton_min_clicked()
|
||||||
|
|
|
@ -211,6 +211,12 @@ private:
|
||||||
*/
|
*/
|
||||||
QList<Ui::SingleCameraWidget*> m_singleCameraWidgetList;
|
QList<Ui::SingleCameraWidget*> m_singleCameraWidgetList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ´°¿ÚÍÏ×§
|
||||||
|
* @author XuChao (xxu715737@163.com)
|
||||||
|
* @date 2024-10-29
|
||||||
|
*/
|
||||||
|
QPoint m_mousePoint;
|
||||||
|
bool m_mousePressed{ false };
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -294,6 +294,25 @@ QPushButton:hover{
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_refresh">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">#pushButton_refresh{
|
||||||
|
border:0px;
|
||||||
|
border-image: url(:/CameraLoopPlay/Resource/image/refresh.png);
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -72,7 +72,7 @@ bool CameraThread::realPlay(HWND hWnd, int index)
|
||||||
struPlayInfo.lChannel = 0 + iIpcStartChan[index]; //预览通道号
|
struPlayInfo.lChannel = 0 + iIpcStartChan[index]; //预览通道号
|
||||||
|
|
||||||
struPlayInfo.dwStreamType = 1; //码流类型:0-主码流,1-子码流,2-三码流,3-虚拟码流,以此类推
|
struPlayInfo.dwStreamType = 1; //码流类型:0-主码流,1-子码流,2-三码流,3-虚拟码流,以此类推
|
||||||
struPlayInfo.dwLinkMode = 4; //0- TCP 方式,1- UDP 方式,2- 多播方式,3- RTP 方式,4-RTP/RTSP,5-RSTP/HTTP
|
struPlayInfo.dwLinkMode = 0; //0- TCP 方式,1- UDP 方式,2- 多播方式,3- RTP 方式,4-RTP/RTSP,5-RSTP/HTTP
|
||||||
struPlayInfo.bBlocked = 1; //0- 非阻塞取流,1- 阻塞取流
|
struPlayInfo.bBlocked = 1; //0- 非阻塞取流,1- 阻塞取流
|
||||||
iRealPlayHandle = NET_DVR_RealPlay_V40(loginId, &struPlayInfo, NULL, NULL); // 实时预览
|
iRealPlayHandle = NET_DVR_RealPlay_V40(loginId, &struPlayInfo, NULL, NULL); // 实时预览
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue