我mouseMoveEvent
发现我QWebView
重新启动了屏幕保护程序的计时器。问题是现在没有mouseMoveEvent
分配给 HTML 元素,因此不可能例如在页面上移动滑动条。
我使用 connect 绑定mouseMoveEvent
到重启槽:
QObject::connect(_view, SIGNAL(mouseMoveEvent(QMouseEvent*)), _mediaPlayer, SLOT(stop()));
网络视图类:
class WebView : public QWebView
{
Q_OBJECT
public:
WebView(QString menu) : _menuDesc(menu) {};
WebView(){};
void setMenuDesc(QString menu) {_menuDesc = menu;};
QString getMenuDesc() {return _menuDesc;};
void setCurrPage(QString page) {_currPage = page;};
QString getCurrPage() {return _currPage;};
void setCurrCategory(QString page) {_currPage = page;};
QString getCurrCategory() {return _currPage;};
void mouseMoveEvent(QMouseEvent *)
{
emit mouseMoved();
};
signals :
void mouseMoved();
private:
QString _menuDesc = 0;
QString _currPage;
QString _currCategory = 0;
};
是否有解决方案仍然可以捕获信号并将其传递给 HTML 页面?