更新代码
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma execution_character_set("utf-8")
|
||||
#include "widget.h"
|
||||
#include "ui_widget.h"
|
||||
#include "qfiledialog.h"
|
||||
|
||||
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
|
||||
{
|
||||
@@ -20,6 +21,18 @@ Widget::~Widget()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void Widget::on_btnSelect_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName();
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->cboxUrl->addItem(fileName);
|
||||
ui->cboxUrl->lineEdit()->setText(fileName);
|
||||
if (ui->btnOpen->text() == "打开") {
|
||||
on_btnOpen_clicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::on_btnOpen_clicked()
|
||||
{
|
||||
if (ui->btnOpen->text() == "打开") {
|
||||
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
~Widget();
|
||||
|
||||
private slots:
|
||||
void on_btnSelect_clicked();
|
||||
void on_btnOpen_clicked();
|
||||
|
||||
private:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>700</width>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -39,6 +39,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnSelect">
|
||||
<property name="text">
|
||||
<string>选择</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnOpen">
|
||||
<property name="text">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma execution_character_set("utf-8")
|
||||
#include "widget.h"
|
||||
#include "ui_widget.h"
|
||||
#include "qfiledialog.h"
|
||||
|
||||
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
|
||||
{
|
||||
@@ -19,6 +20,18 @@ Widget::~Widget()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void Widget::on_btnSelect_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName();
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->cboxUrl->addItem(fileName);
|
||||
ui->cboxUrl->lineEdit()->setText(fileName);
|
||||
if (ui->btnOpen->text() == "打开") {
|
||||
on_btnOpen_clicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::on_btnOpen_clicked()
|
||||
{
|
||||
if (ui->btnOpen->text() == "打开") {
|
||||
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
~Widget();
|
||||
|
||||
private slots:
|
||||
void on_btnSelect_clicked();
|
||||
void on_btnOpen_clicked();
|
||||
|
||||
private:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>700</width>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -39,6 +39,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnSelect">
|
||||
<property name="text">
|
||||
<string>选择</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnOpen">
|
||||
<property name="text">
|
||||
|
||||
@@ -19,6 +19,18 @@ Widget::~Widget()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void Widget::on_btnSelect_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName();
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->cboxUrl->addItem(fileName);
|
||||
ui->cboxUrl->lineEdit()->setText(fileName);
|
||||
if (ui->btnOpen->text() == "打开") {
|
||||
on_btnOpen_clicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::on_btnOpen_clicked()
|
||||
{
|
||||
if (ui->btnOpen->text() == "打开") {
|
||||
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
~Widget();
|
||||
|
||||
private slots:
|
||||
void on_btnSelect_clicked();
|
||||
void on_btnOpen_clicked();
|
||||
|
||||
private:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>700</width>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -39,6 +39,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnSelect">
|
||||
<property name="text">
|
||||
<string>选择</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnOpen">
|
||||
<property name="text">
|
||||
|
||||
Reference in New Issue
Block a user