Qt3与Qt4的类QButtonGroup的区别

本文详细介绍了Qt4中QButtonGroup类的全新设计,包括其与Qt3支持库中Q3ButtonGroup类的区别及用法转换指南。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

QButtonGroup

The QButtonGroup class has been completely redesigned in Qt 4. For compatibility, the oldQButtonGroup class has been renamed Q3ButtonGroup and has been moved to Qt3Support. Likewise, the QHButtonGroup and QVButtonGroup convenience subclasses have been renamed Q3HButtonGroupand Q3VButtonGroup and moved to the Qt3Support library.

The old QButtonGroup, as well as Q3ButtonGroup, can be used in two ways:

  1. The button group is the parent widget of a number of buttons, i.e. the button group is the parent argument in the button constructor. The buttons are assigned identifiers 0, 1, 2, etc., in the order they are created. A Q3ButtonGroup can display a frame and a title because it inherits Q3GroupBox.
  2. The button group is an invisible widget and the contained buttons have some other parent widget. In this usage, each button must be manually inserted, usingQ3ButtonGroup::insert(), into the button group and given an ID number.

Unlike Q3ButtonGroup, the new QButtonGroup doesn't inherit QWidget. It is very similar to a "hiddenQ3ButtonGroup".

If you use a Q3ButtonGroupQ3HButtonGroup, or Q3VButtonGroup as a widget and want to port to Qt 4, you can replace it with QGroupBox. In Qt 4, radio buttons with the same parent are automatically part of an exclusive group, so you normally don't need to do anything else. See also the section on QGroupBox below.

See Virtual Functions for a list of QButtonGroup virtual member functions in Qt 3 that are no longer virtual in Qt 4.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值