当前位置:网站首页>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
边栏推荐
- NVIDIA Jetson: GStreamer and openmax (GST OMX) plug-ins
- Install the yapiupload plug-in in idea and upload the API interface to the Yapi document
- Crawl the product data of cicada mother data platform
- Vulnérabilité d'exécution de la commande de fond du panneau de commande JD - freefuck
- 硬核解析Promise對象(這七個必會的常用API和七個關鍵問題你都了解嗎?)
- WIN1 remote "this may be due to credssp encryption Oracle correction" solution
- STM32学习记录0008——GPIO那些事1
- mysql自动启动设置用Systemctl start mysqld启动
- Solution to Chinese garbled code after reg file is imported into the registry
- QT notes on qmap container freeing memory
猜你喜欢
Notepad + + replaces tabs with spaces
Dynamically add default fusing rules to feign client based on sentinel + Nacos
硬核解析Promise對象(這七個必會的常用API和七個關鍵問題你都了解嗎?)
Install pyshp Library
How to install jsonpath package
Differences between SSD hard disk SATA interface and m.2 interface (detailed summary)
Custom prompt box MessageBox in QT
Spark performance optimization guide
【ACM】376. Swing sequence
Re expression régulière
随机推荐
JD freefuck Jingdong HaoMao control panel background Command Execution Vulnerability
Crawler for querying nicknames and avatars based on qqwebapi
Introduction to quantexa CDI syneo platform
powerdesigner各种字体设置;preview字体设置;sql字体设置
Re expression régulière
Reptile efficiency improvement method
How to install jsonpath package
【ACM】455. Distribute Biscuits (1. Give priority to big biscuits to big appetite; 2. Traverse two arrays with only one for loop (use subscript index -- to traverse another array))
Multi thread safe reference arc of rust
Gson fastjason Jackson of object to JSON difference modifies the field name
How to ensure the security of futures accounts online?
Crawl the product data of Xiaomi Youpin app
Multifunctional toolbox wechat applet source code
Quantexa CDI(场景决策智能)Syneo平台介绍
Rust: how to match a string?
14个py小游戏源代码分享第二弹
Log4j2 cross thread print traceid
Jenkspy package installation
Daily network security certification test questions (April 13, 2022)
Rust: how to implement a thread pool?