QComboBox

#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);

    for(int i = 0; i < 8; i++)
    {

        ui->comboBox->addItem(QString::number(i)+"item");
    }
}

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



void Dialog::on_pushButton_clicked()
{
    QMessageBox::information(this,"Title",ui->comboBox->currentText());
}

  

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