当前位置:网站首页>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
- Gson fastjason Jackson of object to JSON difference modifies the field name
- 串口调试工具cutecom和minicom
- Flash - Middleware
- Multi thread safe reference arc of rust
- Serial port debugging tools cutecom and minicom
- GDAL + ogr learning
- Analysez l'objet promise avec le noyau dur (Connaissez - vous les sept API communes obligatoires et les sept questions clés?)
- 解决允许在postman中写入注释请求接口方法
- QT tablewidget insert qcombobox drop-down box
猜你喜欢
Install the yapiupload plug-in in idea and upload the API interface to the Yapi document
Stm32mp157 wm8960 audio driver debugging notes
Docker 安裝 Redis
Docker installation MySQL
【ACM】70. climb stairs
【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))
Gobang game based on pyGame Library
From source code to executable file
Dynamically add default fusing rules to feign client based on sentinel + Nacos
WiFi ap6212 driver transplantation and debugging analysis technical notes
随机推荐
Imx6 debugging LVDS screen technical notes
Box pointer of rust
Qt读写XML文件(含源码+注释)
Stanford machine learning course summary
Daily network security certification test questions (April 13, 2022)
Cygwin64 right click to add menu, and open cygwin64 here
Refcell in rust
QT notes on qmap container freeing memory
Queue solving Joseph problem
Docker 安装 MySQL
Robocode tutorial 5 - enemy class
软件测试总结
由tcl脚本生成板子对应的vivado工程
Rust: how to match a string?
Error reported when running tensorboard: valueerror: duplicate plugins for name projector, solution
Robocode tutorial 8 - advanced robot
Format problems encountered in word typesetting
Map basemap Library
解决报错max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
Docker installation MySQL