当前位置:网站首页>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
边栏推荐
- STM32 learning record 0008 - GPIO things 1
- 多功能工具箱微信小程序源码
- 【ACM】70. 爬楼梯
- QT notes on qmap container freeing memory
- Closure type of rust (difference between FN, fnmut and fnone)
- Svn simple operation command
- How to restore MySQL database after win10 system is reinstalled (mysql-8.0.26-winx64. Zip)
- Notepad + + replaces tabs with spaces
- Rust: a simple example of TCP server and client
- Robocode tutorial 3 - Robo machine analysis
猜你喜欢

Use of regular expressions in QT

PowerDesigner various font settings; Preview font setting; SQL font settings

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

re正則錶達式

GDAL + ogr learning

Map basemap Library

7-21 wrong questions involve knowledge points.

Analysez l'objet promise avec le noyau dur (Connaissez - vous les sept API communes obligatoires et les sept questions clés?)

Vulnérabilité d'exécution de la commande de fond du panneau de commande JD - freefuck

【ACM】70. 爬楼梯
随机推荐
Crawler for querying nicknames and avatars based on qqwebapi
解决允许在postman中写入注释请求接口方法
Implement a simple function to calculate the sum of all integers between M ~ n (m < n)
Dynamically add default fusing rules to feign client based on sentinel + Nacos
Connection mode of QT signal and slot connect() and the return value of emit
How to install jsonpath package
14 py games source code share the second bullet
【ACM】509. 斐波那契数(dp五部曲)
Dock installation redis
Visualization of residential house prices
Permission management with binary
7-21 wrong questions involve knowledge points.
Differences between SSD hard disk SATA interface and m.2 interface (detailed summary)
Quantexa CDI(场景决策智能)Syneo平台介绍
JD-FreeFuck 京东薅羊毛控制面板 后台命令执行漏洞
Cutting permission of logrotate file
WiFi ap6212 driver transplantation and debugging analysis technical notes
How to restore MySQL database after win10 system is reinstalled (mysql-8.0.26-winx64. Zip)
Docker installation MySQL
Gson fastjason Jackson of object to JSON difference modifies the field name