QcheckBox

#include "dialog.h"
#include "ui_dialog.h"
#include <QtCore>
#include <QtGui>
#include <QMessageBox>

Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);
    ui->checkBox->setChecked(true);
}

Dialog::~Dialog()
{
    delete ui;
}

void Dialog::on_pushButton_clicked()
{
    //ui->lineEdit->setText("Hello cat");
    //QMessageBox::information(this,"Title",ui->lineEdit->text());
    if(ui->checkBox->isChecked())
    {
        QMessageBox::information(this,"cats","You like cats");
    }
    else
    {
        QMessageBox::information(this,"cats","You don't like cats");
    }
}

  

posted @ 2016-11-29 10:25  mCat  Views(156)  Comments(0Edit  收藏  举报