当前位置:网站首页>Qchart note 2: add rollover display
Qchart note 2: add rollover display
2022-06-27 04:08:00 【gdizcm】
Pick up note 1. After the line is displayed , I want to hover over the line , Displays the... Of the point Y The value of the shaft . Like the following figure .

The implementation is like this . Inherit first QChartView class , Add a slot function to the class , Used to connect LineSeries Hover signal on .
QObject::connect(series, SIGNAL(hovered(const QPointF&,bool)), chartView, SLOT(showPos(const QPointF&, bool)));
class ChartView : public QChartView
{
Q_OBJECT
public:
ChartView(QChart *chart, QWidget *parent = 0);
public slots:
void showPos(const QPointF&, bool);
};
void ChartView::showPos(const QPointF& point, bool state)
{
QPoint tempPoint;
tempPoint.setX(qRound(point.x()));
tempPoint.setY(qRound(point.y()));
if (state && static_cast<QSplineSeries*>(this->chart()->series().at(0))->points().contains(tempPoint)) {
QToolTip::showText(QCursor::pos(), QString("%1").arg(tempPoint.y()), this);
}
}In this slot function , The integer part of the first value , Because the point is the value of an integer , Then judge whether the point is LineSeries On , If you're here , Displayed at the mouse position .
Allied , With a little modification, you can also display x The value of the shaft .
边栏推荐
- fplan-布局
- Pat grade a 1023 have fun with numbers
- 2021:Beyond Question-Based Biases:Assessing Multimodal Shortcut Learning in Visual Question Answeri
- 2020:MUTANT: A Training Paradigm for Out-of-Distribution Generalizationin Visual Question Answering
- Overview of Tsinghua & Huawei | semantic communication: Principles and challenges
- [BJDCTF2020]The mystery of ip
- GAMES101作业7提高-微表面材质的实现过程
- 2021:Graphhopper: Multi-Hop Scene Graph Reasoning for Visual Question Answering
- Pat class a 1024 palindromic number
- 语义化版本 2.0.0
猜你喜欢

ESP8266

Pat grade a 1019 general palindromic number

Products change the world

mysql数据库基础:DQL数据查询语言

WPF open source control library extended WPF toolkit Introduction (Classic)

Anaconda3安裝過程及安裝後缺失大量文件,沒有scripts等目錄
![[BJDCTF2020]The mystery of ip](/img/f8/c3a7334252724635d42c8db3d1bbb0.png)
[BJDCTF2020]The mystery of ip
![[array]bm94 rainwater connection problem - difficult](/img/2b/1934803060d65ea9139ec489a2c5f5.png)
[array]bm94 rainwater connection problem - difficult

如何系统学习LabVIEW?

ESP8266
随机推荐
Promise source code class version [III. promise source code] [detailed code comments / complete test cases]
2022-06-26:以下golang代码输出什么?A:true;B:false;C:编译错误。 package main import “fmt“ func main() { type
与STM32或GD32替换说明
Games101 job 7 improvement - implementation process of micro surface material
ERP需求和销售管理 金蝶
Installing MySQL on Windows
FastDDS的服务器记录-译-
Fastdds server records - Translation-
windows上安装MySQL
MySql的开发环境
Static timing analysis OCV and time derive
Cvpr2021:separating skills and concepts for new visual question answering
MySQL development environment
Nignx configuring single IP current limiting
2016Analyzing the Behavior of Visual Question Answering Models
Fplan powerplan instance
PAT甲级 1018 Public Bike Management
Promise [II. Promise source code] [detailed code comments / complete test cases]
为什么 C# 访问 null 字段会抛异常?
Human soberness: bottom logic and top cognition