可以在以下网址阅读:
https://svn.boost.org/trac/boost/ticket/3504
一个deadline_timer定期超时并使用deadline_timer :: expires_at()(如Boost Timer教程中的示例,第3个示例)实现,如果修改系统时间可能会失败(例如,使用date命令,如果您的操作系统是Linux).
现在使用Boost有一种简单而合适的方式来执行此操作吗?我不想使用deadline_timer :: expires_from_now()因为我可以验证它不如"手动"更新到期时间那么准确.
作为一个时间解决方案,我决定在设置新的expires_at值之前,计算now()和expires_at()之间的时间段.如果它超过周期性延迟的两倍,那么我特别使用expires_from_now()来重新同步新的绝对时间.
下面的代码生成一个包含红色矩形和灰色矩形的白色矩形.每个矩形都有一个关联的MouseArea.当鼠标在其中单击时,灰色矩形变为蓝色.红色矩形在鼠标光标进入其中时打印控制台消息,在发出释放信号时打印另一条消息.
我想要:
可能吗?与当前代码,红色矩形的输入信号,如果在进入没有按下mopuse按钮,如果按钮被该矩形内压释放的信号仅发射仅发射.显而易见的问题是,如果在那里按下按钮,灰色/蓝色矩形将控制鼠标事件.
这是我正在开发的应用程序中的类似但简化的场景.
import QtQuick 2.0
Rectangle{
color: "white"
height: 210
width: 500
MouseArea{
id: mainMa
anchors.fill: parent
hoverEnabled: true
onReleased:{console.log("white-released")}
}
Column{
spacing: 10
Rectangle{
color: "red"
height: 100
width: 500
MouseArea{
anchors.fill: parent
hoverEnabled: true
propagateComposedEvents: true
onEntered:{console.log("red-enter")}
onReleased:{console.log("red-released")}
}
}
Rectangle{
color: "#666666"
height: 100
width: 500
MouseArea{
id: ma
anchors.fill: parent
hoverEnabled: true
onPressed: {parent.color = "blue"; console.log("grey pressed")}
onReleased: {parent.color = "#666666"; console.log("grey released")}
}
}
}
Run Code Online (Sandbox Code Playgroud)
}
boost ×1
boost-asio ×1
c++ ×1
clock ×1
mouse ×1
mouseevent ×1
qml ×1
qt ×1
qtquick2 ×1
timer ×1