当前位置:网站首页>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
边栏推荐
- Imx6 debugging LVDS screen technical notes
- word frequency count
- Win1远程出现“这可能是由于credssp加密oracle修正”解决办法
- The vivado project corresponding to the board is generated by TCL script
- Robocode tutorial 3 - Robo machine analysis
- Introduction to quantexa CDI syneo platform
- Crawl the product data of Xiaomi Youpin app
- 14个py小游戏源代码分享第二弹
- Stm32mp157 wm8960 audio driver debugging notes
- Install the yapiupload plug-in in idea and upload the API interface to the Yapi document
猜你喜欢
MySQL auto start settings start with systemctl start mysqld
多功能工具箱微信小程序源码
ArcGIS license error -15 solution
GDAL + ogr learning
C medium? This form of
QT reading and writing XML files (including source code + comments)
Qt读写XML文件(含源码+注释)
A few lines of code teach you to crawl lol skin pictures
Hard core parsing promise object (do you know these seven common APIs and seven key questions?)
由tcl脚本生成板子对应的vivado工程
随机推荐
Visualization of residential house prices
ArcGIS table to excel exceeds the upper limit, conversion failed
线上怎么确定期货账户安全的?
Climbing watermelon video URL
Nodejs installation
Re regular expression
Correct opening method of option
Daily network security certification test questions (April 14, 2022)
深度学习经典网络解析目标检测篇(一):R-CNN
Ionic 从创建到打包指令集顺序
Multi thread crawling Marco Polo network supplier data
Rewrite four functions such as StrCmp in C language
ArcGIS license error -15 solution
Batch export ArcGIS attribute table
Rust: how to match a string?
Arcpy adds fields and loop assignments to vector data
Mysqldump backup database
Crawling mobile game website game details and comments (MQ + multithreading)
Jeecg boot microservice architecture
What are the relationships and differences between threads and processes