当前位置:网站首页>Promote QT default control to custom control
Promote QT default control to custom control
2022-04-23 18:19:00 【Things will turn when they reach the extreme 1024】
take QT The default control is promoted to a custom control
With Weight Control is promoted to a custom parent class of QChartView Of MychartView For example .
1、Weight Base class or QWeight, Therefore, the base class selection during promotion QWeight.
2、 The class name is consistent with its own class .

3、 The most important point , You need your own class to provide an interface , Constructors .
stay UI The document is about weight The code of the control is as follows
widget = new MychartView(centralwidget);
widget->setObjectName(QString::fromUtf8("widget"));
centralwidget It's a new QWidget(MainWindow);, Therefore, you need to provide an interface for your own class , Form the following
// Statement
MychartView(QWidget *parent = 0);
// Constructors
MychartView::MychartView(QWidget *parent) :
QChartView(parent), m_isTouching(false)
{
setRubberBand(QChartView::RectangleRubberBand); // To zoom in and out of the chart with the mouse area, you must use this sentence
}
In this way, I can realize my side will UI In the interface weight Upgrade to Custom to QChartView As a parent MychartView class , because weight Can be placed in many windows , such chart It's much more flexible
Promote default type to custom type , The most important thing I need to pay attention to here is the interface ( Constructors ) Matching problem
版权声明
本文为[Things will turn when they reach the extreme 1024]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210610057577.html
边栏推荐
- Daily CISSP certification common mistakes (April 13, 2022)
- Scikit learn sklearn 0.18 official document Chinese version
- idea中安装YapiUpload 插件将api接口上传到yapi文档上
- Docker 安装 MySQL
- Format problems encountered in word typesetting
- powerdesigner各种字体设置;preview字体设置;sql字体设置
- Function recursion and solving interesting problems
- word frequency count
- MATLAB从入门到精通(二)
- Linux installs MySQL in RPM (super simple)
猜你喜欢

Qt读写XML文件(含源码+注释)

函数递归以及趣味问题的解决

Function recursion and solving interesting problems

Install pyshp Library

A few lines of code teach you to crawl lol skin pictures

Custom prompt box MessageBox in QT

C medium? This form of

mysql自动启动设置用Systemctl start mysqld启动

【ACM】455. 分发饼干(1. 大饼干优先喂给大胃口;2. 遍历两个数组可以只用一个for循环(用下标索引--来遍历另一个数组))

re正則錶達式
随机推荐
NVIDIA Jetson: GStreamer and openmax (GST OMX) plug-ins
In win10 system, all programs run as administrator by default
In shell programming, the shell file with relative path is referenced
QT add external font ttf
硬核解析Promise對象(這七個必會的常用API和七個關鍵問題你都了解嗎?)
14个py小游戏源代码分享第二弹
Jeecg boot microservice architecture
Rust: shared variable in thread pool
Reptile efficiency improvement method
Pyppeter crawler
【ACM】509. Fibonacci number (DP Trilogy)
QT reading and writing XML files (including source code + comments)
MATLAB小技巧(6)七种滤波方法比较
解决允许在postman中写入注释请求接口方法
Stanford machine learning course summary
C language to achieve 2048 small game direction merging logic
Solution to Chinese garbled code after reg file is imported into the registry
Docker 安装 MySQL
idea中安装YapiUpload 插件将api接口上传到yapi文档上
Daily CISSP certification common mistakes (April 13, 2022)