当前位置:网站首页>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
边栏推荐
- Crawl lottery data
- Map basemap Library
- Reptile efficiency improvement method
- Serialization scheme of serde - trust
- CISSP certified daily knowledge points (April 11, 2022)
- Mode of interprocess communication
- Quantexa CDI(场景决策智能)Syneo平台介绍
- Rust: how to match a string?
- Crawl the product data of cicada mother data platform
- ArcGIS table to excel exceeds the upper limit, conversion failed
猜你喜欢

Gobang game based on pyGame Library

Imx6 debugging LVDS screen technical notes

【ACM】70. climb stairs

The vivado project corresponding to the board is generated by TCL script

硬核解析Promise对象(这七个必会的常用API和七个关键问题你都了解吗?)

powerdesigner各种字体设置;preview字体设置;sql字体设置

Docker installation MySQL

Robocode tutorial 8 - advanced robot

WIN1 remote "this may be due to credssp encryption Oracle correction" solution

In win10 system, all programs run as administrator by default
随机推荐
Resolve the error Max virtual memory areas VM max_ map_ count [65530] is too low, increase to at least [262144]
Mode of interprocess communication
Crawl lottery data
Gobang game based on pyGame Library
QT add external font ttf
深度学习经典网络解析目标检测篇(一):R-CNN
QT notes on qmap container freeing memory
Visualization of residential house prices
Jenkspy package installation
powerdesigner各种字体设置;preview字体设置;sql字体设置
Notepad + + replaces tabs with spaces
Daily CISSP certification common mistakes (April 14, 2022)
Deep learning classic network analysis and target detection (I): r-cnn
Log4j2 cross thread print traceid
Docker 安裝 Redis
Svn simple operation command
How to restore MySQL database after win10 system is reinstalled (mysql-8.0.26-winx64. Zip)
Mysqldump backup database
CISSP certified daily knowledge points (April 13, 2022)
Mysql database backup command -- mysqldump