combo.h
#ifndef CHART_H
#define CHART_H
#include <QDialog>
namespace Ui {
class Chart;
}
class Chart : public QDialog
{
Q_OBJECT
public:
explicit Chart(QWidget *parent = 0);
~Chart();
private slots:
void on_pushButton_clicked();
private:
Ui::Chart *ui;
};
#endif // CHART_H
combo.cpp
#include "chart.h"
#include "ui_chart.h"
#include <QMessageBox>
Chart::Chart(QWidget *parent) :
QDialog(parent),
ui(new Ui::Chart)
{
ui->setupUi(this);
ui->comboBox->addItem("aaa");
ui->comboBox->addItem("bbb");
}
Chart::~Chart()
{
delete ui;
}
void Chart::on_pushButton_clicked(){ /* QMessageBox msg; msg.setText("are you quit"); //给提示框增加按钮,增加Yes和No按钮 msg.setStandardButtons(QMessageBox::Yes|QMessageBox::No); //让弹出来的提示框暂停 if(msg.exec() == QMessageBox::Yes) { //关闭当前窗口 this->close(); } */ QMessageBox msg; msg.setText(ui->comboBox->currentText()); msg.exec(); /*msg.setStandardButtons(QMessageBox::Yes|QMessageBox::No); if(msg.exec() == QMessageBox::Yes) { QMessageBox::information(this,"title",ui->comboBox->currentData()); }*/}
#include "qactiontest.h"
#include "ui_qactiontest.h"
QActionTest::QActionTest(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::QActionTest)
{
ui->setupUi(this);
statLabel = new QLabel(this);
statProgressBar = new QProgressBar(this);
ui->statusBar->addPermanentWidget(statLabel);
ui->statusBar->addPermanentWidget(statProgressBar,1);
statLabel->setText("hello");
statProgressBar->setValue(50);
}
QActionTest::~QActionTest()
{
delete ui;
}