QPoint offset_position_; // 偏移位置
void CTitleWidget::mousePressEvent(QMouseEvent* event)
{
if (event->button() == Qt::LeftButton)
{
is_dragging_ = true;
offset_position_ = event->globalPos() - mapToGlobal(pos());
}
}
void CTitleWidget::mouseMoveEvent(QMouseEvent* event)
{
if (is_dragging_)
{
emit signalCaptionDragging(event->globalPos() - offset_position_);
}
}
// 移动
connect(ui->widget_result_title, &CTitleWidget::signalCaptionDragging, this, static_cast < void(SoundConfig::*)(const QPoint&) > (&SoundConfig::move));