当前位置:网站首页>How does QT turn qwigdet into qdialog
How does QT turn qwigdet into qdialog
2022-04-23 11:20:00 【Brother dampness】
Simple record , For your own convenience , The old hand flew past
First turn on the QWidget Change to QDialog, Add two buttons by yourself , Generally, it is to confirm and cancel , Browse files and so on , Then add slot, That's all right. , Directly call... When confirming and canceling qt Of
#pragma once
#include <QDialog>
#include <QWidget>
#include "ui_QExportResDlg.h"
class QExportResDlg : public QDialog
{
Q_OBJECT
public:
QExportResDlg(QWidget *parent = Q_NULLPTR,bool bExportAll= false);
~QExportResDlg();
QString m_strFilePath;
private:
Ui::QExportResDlg ui;
public slots:
void OnBrowseClick(bool);
void OnConfigSave();
void OnConfigCancle();
private:
bool m_bExportAllFlag;
};
#include "QExportResDlg.h"
#include <QtGui>
#include <QFileDialog>
QExportResDlg::QExportResDlg(QWidget *parent, bool bExportAll )
: QDialog(parent)
{
ui.setupUi(this);
m_bExportAllFlag = bExportAll;
connect(ui.btnConfigOk, SIGNAL(clicked()), this, SLOT(OnConfigSave()));
connect(ui.btnConfigCancle, SIGNAL(clicked()), this, SLOT(OnConfigCancle()));
connect(ui.btnBrow, SIGNAL(clicked(bool)), this, SLOT(OnBrowseClick(bool)));
m_strFilePath = "";
}
QExportResDlg::~QExportResDlg()
{
}
void QExportResDlg::OnBrowseClick(bool)
{
QFileDialog dlg;
dlg.setFileMode(QFileDialog::Directory);
dlg.setOption(QFileDialog::ShowDirsOnly, true);
if (dlg.exec())
{
QString resRoot = dlg.selectedFiles()[0];
ui.btnBrowserDir->setText(resRoot);
m_strFilePath = resRoot;
//ShowUpdateNotice(resRoot);
}
}
void QExportResDlg::OnConfigSave()
{
accept();
}
void QExportResDlg::OnConfigCancle()
{
reject();
}
Call the following :
QExportResDlg dlg(Q_NULLPTR,true);
int code = dlg.exec();
if (code == QDialog::Accepted)
{
}
版权声明
本文为[Brother dampness]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231115090851.html
边栏推荐
猜你喜欢
随机推荐
解读机器人编程课程的生物认知度
CUMCM 2021-B:乙醇偶合制备C4烯烃(2)
mysql插入datetime类型字段不加单引号插入不成功
Mysql中有关Datetime和Timestamp的使用总结
MySQL8. 0 upgraded stepping on the pit Adventure
分享两个实用的shell脚本
Microsoft Access database using PHP PDO ODBC sample
Understanding of fileprovider path configuration strategy
Pytorch neural network trainer
Learn go language 0x05: the exercise code of map in go language journey
学习 Go 语言 0x03:理解变量之间的依赖以及初始化顺序
Jupyter lab top ten high productivity plug-ins
Mysql8. 0 installation guide
Interprocess communication -- message queue
My creation anniversary
学习 Go 语言 0x08:《Go 语言之旅》中 练习使用 error
AcWing 1874. 哞加密(枚举,哈希)
C#的学习笔记【八】SQL【一】
语雀文档编辑器将开源:始于但不止于Markdown
MySQL面试题讲解之如何设置Hash索引









