Use custom widgets with Qt Designer: Promotion technique

Qt自定义控件的两种方法 在Qt开发的工程中我们往往要用到自定义一些部件,这些控件是我们需要的,所以我们做了一些特殊的处理。 Qt自定义控件的方法一是重写要自定义的控件:改进法 然后在如图所示加入你定义好的部件的代码: 图二:点击之后再下面的红方块中写入你定义好的类名: 最后如图一一样在QSpinBo控件上右击之后点击Promote to选择图二所增加的Promoted Class既可以了。 如图我定 阅读详情
将自定义的widget放到Qt Designer中 版权声明请尊重原创作品。转载请保持文章完整性,并以超链接形式注明原始作者“tingsking18”和主站点地址,方便其他朋友提问和指正。 将上篇文章写的PushButton放到Qt Designer中:PushButtonplugin.h#include class PushButtonPlugin:public QObject, public QDesignerCusto 阅读详情

相关推荐

Qt系列文章之三十五 (自定义组件)

文章目录前言自定义Widget组件自定义Widget子类MyBattery自定义Widget组件的使用动态效果图 前言   当UI设计器提供的界面组件不满足实际设计需求时,可以从QWidget继承自定义界面组件。 有两种方法使用自定义界面组件,一种 是提升法( promotion),例如前面有一个demo中QGraphicsView 组件提升为自定义的QWGraphicsView类,提升法用于界面可视化设计时不够直观,不能在界面 上即刻显示自定义组件的效果;另一种是为UI设计器设计自定义界面组件的Widge

波风水门 889

qt中的控件类提升的作用、“promote to” “提升” ?(**)

qt中的控件类提升的作用、“promote to” “提升” ?(**)

ken2232的博客 920

单相PWM整流器搭建训练——(一)拓扑原理介绍

单相整流器是一种将交流电转换为直流电的设备,主要由变压器、整流元件和滤波电路组成。变压器将输入的交流电压转换为适合整流的较低电压,整流元件(如二极管)利用其单向导电性将交流电转换为脉动直流电,最后滤波电路去除脉动直流电中的纹波,输出较为平滑的直流电,从而实现交流到直流的转换,广泛应用于各类电源设备中。

DikouNass的博客 1587

Qt Designer中自定义控件的使用(提升法与插件法)

准备乱写一点Qt自定义Widget在Designer中的使用。可是又不想重复提升法(promotion)及插件法基本用法,因为Manual中Using Custom Widgets with Qt Designer已经说的很清楚了。 使用designer Qt用户可能会经历这样的3个阶段: 刚接触Qt,在designer中拖拖拽拽,一个界面就形成了。相当方便(不过...

tomhibolu 899

告别Keil4!手把手教你用Keil C51 V9.61编译51单片机代码(附最新激活方法)

本文详细介绍了Keil C51 V9.61在51单片机开发中的全栈升级指南,包括编译速度提升、调试器性能优化和现代开发支持等核心优势。通过智能安装方案、项目迁移实战和新特性深度应用,帮助开发者告别Keil4,大幅提升开发效率。附有最新激活方法和实用技巧,适用于嵌入式开发工程师。

weixin_26886855的博客 420

AgentScope Java多智能体框架

AgentScope Java 的核心设计理念是“Agent-Oriented Programming” (面向智能体编程)。

zzz19920821的博客 1735

12-1_Qt 5.9 C++开发指南_自定义插件和库-自定义Widget组件(提升法(promotion)创建自定义定制化组件)

Qt的 UI 设计器提供了很多 GUI 设计的界面组件,可以满足常见的界面设计需求。但是某些时候需要设计特殊的界面组件,而在 UI设计器的组件面板里根本没有合适的组件,这时就需要设计自定义的界面组件。所有界面组件的基类是QWidget,要设计自定义的界面组件,可以从QWidget继承一个自定义的类,重定义其painEvent()事件,利用Qt的绘图功能会追组件外观,并实现所需的其他功能。

分享学习成长历程,Winter is coming! 1243

Minitab实战:用Weibull分布预测产品寿命的5个关键参数(附真实案例)

本文通过一个真实的电容器老化测试案例,详细介绍了如何运用Minitab软件进行Weibull分布分析,以预测产品寿命。文章深入解读了形状参数β、尺度参数η等五个关键参数的工程意义与商业价值,指导工程师从失效数据中提取洞察,并将其应用于可靠性评估、保修策略制定及成本预估等实际业务决策。

weixin_29231263的博客 520

pyqt5designer添加QVideoWidget控件

使用QMediaPlayer播放视频文件的时候需要指定播放时的视频输出控件,位于PyQt5.QtMultimediaWidgets下的QVideoWidget就是视频输出控件之一。但是QVideoWidget并不是设计师控件之一,换言之,在pyqt5designer中是找不到这个控件的。 QVideoWidget是双继承了QWidget和QMediaBindableInterface,所以一个QVideoWidget可以视为一个QWidget控件。因此在设计师中可以先添加一个QWidget控件。 然

piglite的专栏 8686

PX4实战指南:通过遥控器通道映射实现多舵机PWM精准控制

本文详细介绍了通过PX4飞控的AUX PWM接口实现遥控器通道映射控制多舵机的实战指南。内容包括硬件选型与连接、软件参数配置、通道映射方法以及常见问题排查,帮助开发者精准实现无人机舵机PWM控制,适用于云台、机械臂等扩展功能开发。

ee345的博客 304

CVE-2025-25249漏洞深度解析:FortiOS认证绕过与实战缓解

远程代码执行(RCE)是网络安全中最危险的漏洞类型之一,其核心往往源于认证机制失效或内存安全缺陷。CVE-2025-25249正属于此类高危漏洞——它不依赖用户凭证,也不需要交互触发,而是通过超长HTTP头(如X-Forwarded-For)引发内存越界写入,直接绕过FortiOS和FortiSwitchManager的完整认证流程。该漏洞影响广泛、CVSS评分高达9.8,凸显了嵌入式设备在HTTP协议栈实现中的深层风险。在企业网络中,FortiGate等设备常作为边界守门人,一旦失陷将导致root级控制权

weixin_33694620的博客 524

QT控件提升之QPushButton提升为QMenu

当一个控件进行提升之后, 就有了新的功能, 在原来的一些特性基础上,发生一些新的改变。 QT控件提升方法: 1.需要写一个需要提升为某种功能的类。 2.打开qt设计师, 在对应需要提升的控件, 单击右键, 选择 “提升的窗口部件” , 在提升的类名和头文件输入框里, 分别填上你所写的类, 单击提升铵纽进行提升。 我这边进行了按钮提升为菜单, 部分源码如下: // popupbu

li235456789的专栏 5410

UCIE Specification详解(八)

Logical Physical Layer(逻辑物理层)

Crazzy_M的博客 1608

【原创】Qt自定义窗口部件

QtDesigner自定义窗口部件有两种方法:改进法(promotion)和插件法(plugin) 改进法 1、改进法之前,要先写好子类化QSpinBox后的HexspinBox.h和HexspinBox.cpp文件。把这两个文件拷贝到想要的项目中。 HexspinBox.h #ifndef HEXSPINBOX_H #define HEXSPINBOX_...

qimo601的专栏 636

内容创作全流程自动化:OpenClaw+大模型搞定选题+写稿+多平台发布

本文介绍了一套基于OpenClaw的全自动化内容创作流水线方案,帮助垂直领域创作者摆脱重复劳动。该方案将内容生产拆解为选题生成、内容撰写、格式适配、多平台发布四个模块,通过工作流引擎串联执行。系统能自动采集热榜生成选题、调用大模型撰写结构化内容、适配不同平台格式要求,并通过API+浏览器自动化实现多平台发布,全程只需人工最终审核。作者分享了各模块的实现细节,包括热榜采集、内容结构化生成、Markdown转换和发布策略,并提供了工作流编排方法。这套方案能为创作者每天节省约3小时,同时保证内容质量和发布效率。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 49

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

qt开发入门1

<br />qt开发入门1<br />Qt中的每个类,都有一个对应的同名头文件,其中包含其类定义。例如要使用QApplication类,则需要在程序中添加" #include <QApplication>"<br />QApplication类用于管理应用程序范围内的资源。其构造函数需要main函数的argc和argv作为参数。<br />widget被创建时都是不可见的(always created hidden)。widget中可容纳其它widget。<br />Qt中的widget在有用户行为或状态改

meiyuli的专栏 1468

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

Qt Creator “Promote to“功能 笔记

Promote to 功能的官方说明:https://doc.qt.io/archives/qt-4.8/designer-using-custom-widgets.html Qt desiner支持了所有的标准widget的可视化操作,但是一些专门的widget不能像标准widget一样进行可视化操作,因为: 在设计用户界面时,自定义widget可能不可用。 自定义widget可能是平台依赖的,设计师可能会在与最终用户不同的平台上开发用户界面。 自定义widget的源代码不可用,或者用户界面设计人员由于

rrrrrr89098087的博客 2481

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

Qt:53---Widget组件的自定义与提升(promoted)

一、什么是自定义Widget组件 Qt的UI设计器提供了很多GUI设计的界面组件,可以满足常见的界面设计需求。但是某些时候需要设计特殊的界面组件,而在UI设计器的组件面板里没有合适的组件,这时就需要设计自定义的界面组件 二、如何设计自定义的Widget组件 所有组件的基类是QWidget,要设置自定义的界面组件,可以从QWidget继承一个自定义的类,重定义其paintEvent()事件,利用...

董哥的黑板报 1万+
上一篇: 一步步学Qt,第五天-Qt学习小结-Qt工作机制
下一篇: How to create a simple 2D graphics program?
Qicz
博客等级 码龄16年 56粉丝 122原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值