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); }
qt checbox设置不可用,快捷方式,选中,取消事件
最新推荐文章于 2024-08-26 16:59:52 发布