更新代码
parent
6806857a82
commit
8d3216dc12
|
@ -1,6 +1,7 @@
|
||||||
#pragma execution_character_set("utf-8")
|
#pragma execution_character_set("utf-8")
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "ui_widget.h"
|
#include "ui_widget.h"
|
||||||
|
#include "qfiledialog.h"
|
||||||
|
|
||||||
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
|
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
|
||||||
{
|
{
|
||||||
|
@ -20,6 +21,18 @@ Widget::~Widget()
|
||||||
delete ui;
|
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()
|
void Widget::on_btnOpen_clicked()
|
||||||
{
|
{
|
||||||
if (ui->btnOpen->text() == "打开") {
|
if (ui->btnOpen->text() == "打开") {
|
||||||
|
|
|
@ -16,6 +16,7 @@ public:
|
||||||
~Widget();
|
~Widget();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void on_btnSelect_clicked();
|
||||||
void on_btnOpen_clicked();
|
void on_btnOpen_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>700</width>
|
<width>800</width>
|
||||||
<height>600</height>
|
<height>600</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -39,6 +39,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnSelect">
|
||||||
|
<property name="text">
|
||||||
|
<string>选择</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="btnOpen">
|
<widget class="QPushButton" name="btnOpen">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma execution_character_set("utf-8")
|
#pragma execution_character_set("utf-8")
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "ui_widget.h"
|
#include "ui_widget.h"
|
||||||
|
#include "qfiledialog.h"
|
||||||
|
|
||||||
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
|
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
|
||||||
{
|
{
|
||||||
|
@ -19,6 +20,18 @@ Widget::~Widget()
|
||||||
delete ui;
|
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()
|
void Widget::on_btnOpen_clicked()
|
||||||
{
|
{
|
||||||
if (ui->btnOpen->text() == "打开") {
|
if (ui->btnOpen->text() == "打开") {
|
||||||
|
|
|
@ -16,6 +16,7 @@ public:
|
||||||
~Widget();
|
~Widget();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void on_btnSelect_clicked();
|
||||||
void on_btnOpen_clicked();
|
void on_btnOpen_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>700</width>
|
<width>800</width>
|
||||||
<height>600</height>
|
<height>600</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -39,6 +39,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnSelect">
|
||||||
|
<property name="text">
|
||||||
|
<string>选择</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="btnOpen">
|
<widget class="QPushButton" name="btnOpen">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
@ -19,6 +19,18 @@ Widget::~Widget()
|
||||||
delete ui;
|
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()
|
void Widget::on_btnOpen_clicked()
|
||||||
{
|
{
|
||||||
if (ui->btnOpen->text() == "打开") {
|
if (ui->btnOpen->text() == "打开") {
|
||||||
|
|
|
@ -16,6 +16,7 @@ public:
|
||||||
~Widget();
|
~Widget();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void on_btnSelect_clicked();
|
||||||
void on_btnOpen_clicked();
|
void on_btnOpen_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>700</width>
|
<width>800</width>
|
||||||
<height>600</height>
|
<height>600</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -39,6 +39,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnSelect">
|
||||||
|
<property name="text">
|
||||||
|
<string>选择</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="btnOpen">
|
<widget class="QPushButton" name="btnOpen">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
Loading…
Reference in New Issue