QObject::connect 回傳 true 并且當我手動發出信號時,斷點在插槽中被擊中,但是當我將滑鼠懸停在 QCandlestickSet 上時,不會發出信號。
我從圖表中洗掉了所有其他自定義繪圖,以確保沒有任何東西覆寫燭臺,但信號仍然沒有觸發。
“chartView”是從“QChartView”派生的“ChartView”型別。
“系列”是“QCandlestickSeries”型別。
聯系:
QObject::connect(this->series, SIGNAL(hovered(bool, QCandlestickSet *)), this->chartView, SLOT(displayCandleValues(bool, QCandlestickSet *)));
投幣口:
void ChartView::displayCandleValues(bool status, QCandlestickSet *candle)
{
qint32 x = 0; // A breakpoint is set on this line and is triggered when calling 'emit this->series->hovered(false, Q_NULLPTR);'
}

先感謝您。
編輯:
當我單擊蠟燭上的信號時不會發出信號,但是當我雙擊蠟燭時會發出信號并觸發斷點。
uj5u.com熱心網友回復:
所以我發現了這個問題。我已經覆寫了 mouseMoveEvent 來繪制我的十字準線,但我忘記呼叫父類的 mouseMoveEvent。
舊定義:
void ChartView::mouseMoveEvent(QMouseEvent *event)
{
this->drawCrosshair(event->pos());
}
新定義:
void ChartView::mouseMoveEvent(QMouseEvent *event)
{
this->drawCrosshair(event->pos());
QChartView::mouseMoveEvent(event);
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/378509.html
