使用QT中的QRadioButton类

C/C++ 专栏收录该内容
¥29.90 ¥99.00
118篇文章

使用QT中的QRadioButton类

QT是一个跨平台GUI应用程序开发框架,其中的QRadioButton类可以很方便地实现单选按钮的功能。本篇文章将为大家详细介绍QRadioButton类的使用,包括创建QRadioButton控件、设置文本、设置选中状态以及获取选中状态等。

一、创建QRadioButton控件

在QT中,可以通过直接拖动QRadioButton控件到窗口中的方式来创建QRadioButton对象,也可以使用代码创建控件。下面是代码创建QRadioButton控件的示例:

QRadioButton *radioButton = new QRadioButton("RadioButton", this);

以上代码创建了一个名为“RadioButton”的QRadioButton控件,并将其添加到当前窗口中。

二、设置文本

可以使用setText()函数来设置QRadioButton控件上显示的文本,如下所示:

radioButton->setText("This is a RadioButton");

三、设置选中状态

可以使用setChecked()函数来设置QRadioButton控件的选中状态,如下所示:

radioButton->setChecked(true);

四、获

QT 单选框 QRadioButton 获取值 QbuttonGroup Qt 写 单选框 QRadioButton 时,想获取选中: .h private slots: void on_radioButton_2_toggled(bool checked); void on_radioButton_toggled(bool checked); .cpp //播放声音 是 void TimelineAttr::on_radioButton_2_toggled(bool checked) { isPlaySound =... 阅读详情

相关推荐

「QT」QSS样式表 之 QRadioButton 单选按钮样式表

由于QRadioButton的指示器通常受到操作系统主题的限制,因此某些样式属性(如大小和形状)可能无法直接通过QSS进行调整。然而,需要注意的是,QRadioButton的背景通常被其指示器(即圆形或方形的小点)和文本所覆盖,因此设置背景颜色可能不会有明显效果,除非同时调整指示器的透明度和大小。需要注意的是,QRadioButton的指示器在Qt中通常是一个固定的图形(圆形或方形),其大小可能受到操作系统主题的限制。属性可能不会有预期的效果,特别是在不同的操作系统和Qt主题下。

何曾参静谧的博客 1057

小尾羊的qt学习之路,01课,按钮

Qt7:QPushButton Class (按钮) Qt8:QLineEdit Class (文本输入框) Qt9:QCheckBox Class (复选框) Qt 10:QRadioButton Class (单选按钮) Qt 11: QComboBox Class (组合框)

小尾羊的博客 780

Qt-QRadioButton单选按钮控件使用总结:

Qt是一套跨平台的C++图形用户界面应用程序开发框架,提供了各种常见的控件供开发者使用,其中QRadioButton单选按钮控件是一种常用的控件之一。设置QRadioButton控件的状态有两种方法,一种是使用setChecked()函数,另一种是使用toggle()函数。在实际项目中,QRadioButton控件通常会与其他控件配合使用,比如QGroupBox、QButtonGroup等。其中,第一个参数是控件的文本内容,第二个参数是父控件(可省略)。2.设置QRadioButton控件状态。

2301_79366106的博客 952

QT的QRadioButton类的使用

详细说明 QRadioButton小部件提供带有文本标签的单选按钮。 QRadioButton是一个选项按钮,可以打开(选中)或关闭(取消选中)。单选按钮通常向用户显示“多个”选项。在一组单选按钮中,一次只能检查一个单选按钮。如果用户选择另一个按钮,则先前选择的按钮将关闭。 默认情况下,单选按钮是autoExclusive。如果启用了自动独占,则属于同一父窗口小部件的单选按钮的行为就好像它们属于同一独占按钮组的一部分一样。如果需要属于同一父窗口小部件的单选按钮的多个排他按钮组,请将它们放入QButtonG

希望我的博客,能帮上你解决学习中工作中所遇到的问题 3527

从零实现高精度手势检测:OpenCV+MediaPipe模型移植实战(2)(附c++完整代码)

上篇已经介绍了手掌检测的方法。本章将在手掌检测的基础上,完成手指关节的检测。

qq_37160641的博客 2667

基于CANoe的车载以太网测试

以太网测试 CANoe

Yafet 4554

GROMACS自由能景观图绘制全流程:从PCA分析到Origin 3D可视化(附避坑指南)

本文详细解析了使用GROMACS绘制自由能景观图的全流程,涵盖从PCA分析、数据预处理、自由能计算到最终在Origin中进行3D可视化的完整步骤。文章重点分享了数据处理与格式转换中的常见“避坑”指南,帮助研究者从分子动力学轨迹中有效提取并解读构象自由能信息,深化对生物大分子动力学过程的理解。

oauth7security的博客 309

具身智能端到端大模型VLA (Vision Language Action)

在语言为条件的机器人任务中,策略必须具备理解语言指令、视觉感知环境并生成适当动作的能力,这就需要VLA的。例如,在自动驾驶领域,传统的做法是将感知、预测、规划等步骤分开处理,而VLA则试图用一个统一的框架来替代这种分立的方法。另外,VLA的模型对于算力的需求很大,单片AI算力1000Tops的Thor大概率会延期发布,加上英伟达芯片的量产时间与成本挑战,以及在国内的应用情况,对车企而言是个大问题。以谷歌DeepMind推出的RT-2为例,该模型可以在新的物体、背景和环境中表现出显著改善的性能。

具身智能机器人 1万+

用5毫欧采样电阻实现高精度电流检测?数字可调电源控制板的硬件设计陷阱

本文深入探讨了在数字可调电源控制板设计中,如何利用5毫欧采样电阻实现高精度电流检测。从微小信号放大电路设计、采样电阻布局与热管理,到电源切换与电池管理电路优化,提供了全面的硬件设计解决方案和实用技巧,帮助工程师规避常见设计陷阱,提升系统性能。

wdx0123456的博客 1031

智慧工地算法视频分析服务器区域入侵检测AI视频分析技术在煤矿的实战应用

通过实时分析和处理井下视频资料,智慧矿山算法视频分析服务器不仅能够及时发现并预警人员违规行为和设备异常状况,还能够通过智能分析预防潜在的安全风险,从而显著提高煤矿的安全管理水平和生产效率。

EasyDarwin开源社区技术博客 562

李宏毅机器学习笔记第17周_概述领域自适应(Domain Adaptation)

Domain Adaptation

peaunt1的博客 1105

【用ArcGIS制作一张好看的中国月度气温图

要最后选中那个事先调整好的那个数据框,这样其他两个数据框才能和其大小一致。

J_Giser的博客 1018

深度学习工具包 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")

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

上一篇: C++ 实现摩尔斯电码算法
下一篇: 使用Boost Fusion库中的make_fused_procedure函数实现可变参数模板的递归调用,是提高C++代码的性能和可移植性的一种有效方法
普通网友
博客等级 码龄3年 454粉丝 863原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值