当前位置:网站首页>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
边栏推荐
- Which company is good for opening futures accounts? Who can recommend several safe and reliable futures companies?
- Upgrade the functions available for cpolar intranet penetration
- Share two practical shell scripts
- Understanding of fileprovider path configuration strategy
- Canvas详解
- CUMCM 2021-b: preparation of C4 olefins by ethanol coupling (2)
- An interesting interview question
- ConstraintLayout布局
- Excel · VBA array bubble sorting function
- Laravel admin time range selector daterange default value problem
猜你喜欢
Cygwin 中的 rename 用法
Database management software sqlpro for SQLite for Mac 2022.30
qt 64位静态版本显示gif
MIT: label every pixel in the world with unsupervised! Humans: no more 800 hours for an hour of video
探究机器人教育的器材与教学
Get things technology network optimization - CDN resource request Optimization Practice
nacos基础(9):nacos配置管理之从单体架构到微服务
进程间通信 -- 消息队列
Microsoft Access database using PHP PDO ODBC sample
分享两个实用的shell脚本
随机推荐
Using Baidu PaddlePaddle EasyDL to accomplish specified target recognition
Jupyter Lab 十大高生产力插件
Pytorch neural network trainer
活动进行时! 点击链接加入直播间参与“AI真的能节能吗?”的讨论吧!
VM set up static virtual machine
GPU, CUDA,cuDNN三者的關系總結
When the activity is in progress! Click the link to join the live studio to participate in "can AI really save energy?" Let's have a discussion!
Learn go language 0x03: understand the dependency between variables and initialization order
防止web项目中的SQL注入
Promise details
oh-my-lotto
MySQL Router重装后重新连接集群进行引导出现的——此主机中之前已配置过的问题
数据库管理软件SQLPro for SQLite for Mac 2022.30
ConstraintLayout布局
CUMCM 2021-B:乙醇偶合制备C4烯烃(2)
Detailed explanation of MySQL creation stored procedure and function
Solve the problem of "suncertpathbuilderexception: unable to find valid certification path to requested target"
面向全球市场,PlatoFarm今日登录HUOBI等全球四大平台
Learn go language 0x06: Fibonacci closure exercise code in go language journey
汇编语言 运行环境设置等教程链接整理