gpt4 book ai didi

c++ - 我想在 qt 中单击(向左或向右)小部件时显示一条消息

转载 作者:塔克拉玛干 更新时间:2023-11-03 08:00:17 25 4
gpt4 key购买 nike

此代码适用于 VLC 媒体播放器。如果我在全屏模式下移动鼠标,则会显示消息和 x,y 坐标。我想在全屏上单击(向左或向右)时显示一条消息。我怎样才能做到这一点?我正在使用 Qt。

void FullscreenControllerWidget::mouseChanged( vout_thread_t *p_vout, int i_mousex, int i_mousey )
{
bool b_toShow;

/* FIXME - multiple vout (ie multiple mouse position ?) and thread safety if multiple vout ? */
qDebug() << "mouse moved"; //ajay

b_toShow = false;
if ((i_mouse_last_move_x == -1 || i_mouse_last_move_y == -1) ||
(abs( i_mouse_last_move_x - i_mousex ) > 2 ||
abs( i_mouse_last_move_y - i_mousey ) > 2 ))
{
i_mouse_last_move_x = i_mousex;
i_mouse_last_move_y = i_mousey;
qDebug() << "mouse move changed x:" << i_mouse_last_move_x; // ajay
qDebug() << "mouse move changed y:" << i_mouse_last_move_y; // ajay
b_toShow = true;
}

if (b_toShow)
{
/* Show event */
IMEvent *eShow = new IMEvent(FullscreenControlShow_Type, 0);
QApplication::postEvent(this, eShow);

/* Plan hide event */
IMEvent *eHide = new IMEvent(FullscreenControlPlanHide_Type, 0);
QApplication::postEvent(this, eHide);
}
}

最佳答案

有一个鼠标点击的特殊事件。

您是否尝试实现这些?顺便提一句。 mouseChanged 是特定于 vlc 的。

关于c++ - 我想在 qt 中单击(向左或向右)小部件时显示一条消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9031679/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com