使用QT模式对话框,并使显示框 为背景色;

方法使用了QCheckBox
*native;  
#include <QCheckBox>

初始化函数代码:

//设置默认打开图像位置
native = new QCheckBox(this); this->ui->lineEdit_ImageRoad->setText("./Image/Tulipa.jpg");//设置默认打开图像
//设置 前景色 :白色 ; 背景色:透明
  this->ui->lineEdit_ImageRoad->setStyleSheet(QString("color:rgba(255,255,255,255);background-color:rgba(0,0,0,0)"));

使用模式框获取文件位置:

QString CWishGUI::GetOpenFileName()
{
QFileDialog::Options options;
if (!native->isChecked())
options |= QFileDialog::DontUseNativeDialog;
QString selectedFilter;
QString fileName = QFileDialog::getOpenFileName(this,
tr("QFileDialog::getOpenFileName()"),
this->ui->lineEdit_ImageRoad->text(),
tr("All Files (*);;Text Files (*.txt)"),
&selectedFilter,
options);
return fileName;
}

获取文件名:

std::string
SFilename
= QFilename.toStdString();

QT设计UI:QT模式对话框打开文件的更多相关文章

  1. 如何设置eclipse在默认模式下打开文件

    如何设置eclipse在默认模式下打开文件 打开eclipse.选择例如以下:windows --> preferences --> General --> Editors --&g ...

  2. Qt——设计颜色编辑选取对话框

    Qt中已经有一些封装好的对话框,比如QMessageBox.QColorDialog等,使用起来快捷方便,但缺点是我们无法为它们自定义样式,所以可能难以“融入”我们的项目.既然如此,那就自己做一个把. ...

  3. pyqt5通过文本对话框打开文件

    点击按钮,打开文本对话框,找一人文件,打开并显示内容 QFIleDialog                                                              ...

  4. C#对话框-打开和保存对话框(转)

    //打开文件            OpenFileDialog openFileDialog = new OpenFileDialog();            openFileDialog.In ...

  5. Delphi 实现最近打开文件记录菜单

    unit UntOpenMenu; //download by http://wwww.NewXing.com interface uses Windows, Messages, SysUtils, ...

  6. Python 打开文件(File Open)

    版权所有,未经许可,禁止转载 章节 Python 介绍 Python 开发环境搭建 Python 语法 Python 变量 Python 数值类型 Python 类型转换 Python 字符串(Str ...

  7. QT 打开文件对话框汇总

    Qstring fileName = QFileDialog::getOpenFileName(this, tr("open file"), " ",  tr( ...

  8. Qt之UI文件设计和运行机制

    1.项目文件组成在QtCreator中新建一个WidgetApplocation项目,选中窗口基类中选中QWidget作为窗口基类,并选中"GnerateForm"复选框.创建后项 ...

  9. QT visual stuido 集成插件不能打开ui文件的解决方法(去掉xml的UTF8标记)

    QT visual stuido 集成插件不能打开ui文件的解决方法 visual studio里不能打开这个ui文件,出现warning等解决方法是:于是将<?xml version=&quo ...

随机推荐

  1. PAT 1099. Build A Binary Search Tree (树的中序,层序遍历)

    A Binary Search Tree (BST) is recursively defined as a binary tree which has the following propertie ...

  2. 公钥基本结构(PKI)的概念

    公钥证书 ,通常简称为证书 ,用于在 Internet.Extranet 和 Intranet 上进行身份验证并确保数据交换的安全.证书的颁发者和签署者就是众所周知的 证书颁发机构 (CA),将在下一 ...

  3. ansible common modules

    ##Some common modules[cloud modules] [clustering modules] [command modules]command - executes a comm ...

  4. 洛谷 P1348 Couple number

    题目描述 任何一个整数N都能表示成另外两个整数a和b的平方差吗?如果能,那么这个数N就叫做Couple number.你的工作就是判断一个数N是不是Couple number. 输入输出格式 输入格式 ...

  5. hdu 4171 最短路

    #include<stdio.h> #include<string.h> #include<queue> #include<iostream> usin ...

  6. 233 Matrix 矩阵快速幂

    In our daily life we often use 233 to express our feelings. Actually, we may say 2333, 23333, or 233 ...

  7. Spring Boot使用thymeleaf模板时报异常:template might not exist or might not be accessible by any of the configured Template Resolvers

    错误如下: template might not exist or might not be accessible by any of the configured Template Resolver ...

  8. java.net.MalformedURLException: unknown protocol: c 这个错一般有两种原因导致: 1、URL协议、格式或者路径错误,

    java.net.MalformedURLException: unknown protocol: c这个错一般有两种原因导致:1.URL协议.格式或者路径错误, 好好检查下你程序中的代码如果是路径问 ...

  9. 《从零開始学Swift》学习笔记(Day60)——Core Foundation框架

    创文章,欢迎转载.转载请注明:关东升的博客   Core Foundation框架是苹果公司提供一套概念来源于Foundation框架,编程接口面向C语言风格的API.尽管在Swift中调用这样的C语 ...

  10. qml

    用qt非常久了.可是一直没有注意到一个叫做qml的东西.今天google了一下,总结一下我的理解. 从表面上看qml就是用css javascript那一套来做软件的GUI,和原来的C++的widge ...