qt checbox设置不可用,快捷方式,选中,取消事件

复制代码
    QGridLayout *layout = new QGridLayout;

    box =new QCheckBox();
    box->setText("复选框");

    box1 =new QCheckBox();
    box1->setText("&C复选框1");
    box1->setDisabled(true);

    layout->addWidget(box,0,0);
    layout->addWidget(box1,0,1);

    connect(box,SIGNAL(stateChanged(int)),this,SLOT(ShowLog(int)));
    connect(box1,SIGNAL(stateChanged(int)),this,SLOT(ShowLog(int)));
    ui->centralWidget->setLayout(layout);

void MainWindow::ShowLog(int state)
{
    qDebug()<<state<<" "<<box->isChecked()<<" "<<box->isTristate();
    if(state)
        box1->setEnabled(true);
    else
        box1->setEnabled(false);
}
相关推荐
果果软件3 小时前
2026 后台管理系统选型:若依、JeecgBoot、芋道、NocoBase 和 GewuMind Boot 怎么选?
java·人工智能·后端·ai·开源
金色熊族5 小时前
qt5.15.9编译qt-creator7.0.2源码
linux·qt
码云社区7 小时前
Java家政服务系统源码:人员技能、服务范围与多商家业务落地
java·开发语言·家政服务·家政小程序·家政系统
FRing037 小时前
vue3干货总结3(defineOptions(Vue3.3)、defineModel(Vue3.4)、Pinia)
开发语言·前端·vue.js·vue3
Bczheng17 小时前
组件化服务端渲染模式SSR
前端
摇滚侠8 小时前
《On Java 中文版 基础卷》阅读笔记 接口 18
java·笔记·python
CoderYanger8 小时前
Java EE 进阶:9.MyBatis 操作数据库(进阶)(第八弹):MyBatis Generator
java·数据库·spring boot·spring·java-ee·tomcat·mybatis
whitelbwwww9 小时前
CUDA C++实战--中级
开发语言·前端·c++
张紫娃9 小时前
Chrome插件-Stylus(屏蔽博客广告)
前端·chrome·stylus
Yannik9 小时前
在 Apple Silicon Mac 上用 Jenkins + Fastlane 搭建 iOS CI:从自动打包到 MR 检查流水线的完整实践
前端