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);
}
相关推荐
鹿角片ljp5 小时前
LeetCode 64:最小路径和复盘|二维 DP 与 ACM 模式完整写法
java·数据结构·算法
+VX:Fegn08956 小时前
计算机毕业设计|基于springboot + vue蛋糕店管理系统(源码+数据库+文档)
前端·数据库·vue.js·spring boot·课程设计
泡海椒6 小时前
PDF 表格样式优化:jquick-pdf 边框、圆角、背景色
java·开发语言·pdf
半个落月6 小时前
LangChain.js Agent Memory 实战(下):用 Milvus 构建可检索的长期记忆
javascript·langchain
半个落月6 小时前
LangChain.js Agent Memory 实战(上):从内存对话、文件持久化到截断与摘要
javascript·langchain
Nicander7 小时前
我给 Excalidraw 做了一个本地工作区:DrawSpace
前端·开源
景熙55237 小时前
15.Java 8 Stream 流入门到实战
java·开发语言·数据结构
wno7048 小时前
Spring Security权限控制
java·python·spring
杨运交8 小时前
[071][验证码模块]基于Spring拦截器的验证码认证设计思想
java·后端·spring