QPushbutton用于发送toggled(bool)的checkable 属性
2015-07-04 16:07
302 查看
默认状况下checkable是不选中的,Button默认为触发按钮(trigger button),按下去马上弹起来
选中checkable后,Button变成切换按钮(toggle button),可以有两种状态:按下/弹起;此时该按钮可以发射 toggled(bool) 信号,与槽函数setVisible(bool) 结合即可用于控件交替显示;
下面图中两个“more”按钮,上边是弹起状态,下边是按下状态
问题:
I have the follwing code where
a
When I toggle the button, nothing happens.
Shouldn't it show or hide
回答:
Most likely, your pushbutton is not
Try
A non-checkable button never emits the
选中checkable后,Button变成切换按钮(toggle button),可以有两种状态:按下/弹起;此时该按钮可以发射 toggled(bool) 信号,与槽函数setVisible(bool) 结合即可用于控件交替显示;
下面图中两个“more”按钮,上边是弹起状态,下边是按下状态
问题:
I have the follwing code where
moreButtonis
a
QPushButton.
When I toggle the button, nothing happens.
Shouldn't it show or hide
secondaryGroupBoxand
tertiaryGroupBox?
QObject::connect(moreButton, SIGNAL(toggled(bool)), secondaryGroupBox, SLOT(setVisible(bool))); QObject::connect(moreButton, SIGNAL(toggled(bool)), tertiaryGroupBox, SLOT(setVisible(bool)));
回答:
Most likely, your pushbutton is not
checkable().
Try
moreButton->setCheckable(true)
A non-checkable button never emits the
toggled(bool)signal.
相关文章推荐
- web 文件上传组件 Plupload
- 用HTML和javascript(JS)计算触屏手机手指滑动方向的演示
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
- GPU(CUDA)学习日记(十一)------ 深入理解CUDA线程层次以及关于设置线程数的思考
- __new__方法和__init__方法
- saltstack之nginx部署
- oracle表分区详解
- IOS UIViewController相互传递数据
- Cocos2d-x制作跳棋第二步:工程建立与界面编写
- 黑马程序员——关键字,标识符,注释,常量,变量
- ssh 综合
- Swift中定义二维数组的方法及遍历方法示例
- ping主机在线统计脚本
- 查找并输出字符串中最长的单词
- 【BZOJ】1005 明明的烦恼
- 苹果iOS 7四种后台机制 优劣比较详细解析
- Android开发之如何保证Service不被杀掉(broadcast+system/app)
- 使用hadoop命令rcc生成Record 一个简单的方法来实现自己的定义writable对象
- try catch finally 用法
- ThreadPoolExecutor原理和使用