fix filedialog path error
This commit is contained in:
parent
33be23b581
commit
b7b83e53bf
|
@ -245,7 +245,7 @@ void CursorThemeWidget::initRightWidget()
|
||||||
// 如果获取的对象是合法的CursorEditWidget对象
|
// 如果获取的对象是合法的CursorEditWidget对象
|
||||||
if (clickedWidget) {
|
if (clickedWidget) {
|
||||||
// 弹出文件选择对话框,让用户选择一个SVG文件
|
// 弹出文件选择对话框,让用户选择一个SVG文件
|
||||||
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select SVG file"), "", tr("SVG file (*.svg)"));
|
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select SVG file"), QDir::homePath(), tr("SVG file (*.svg)"));
|
||||||
// 如果用户选择了文件,且文件路径不为空
|
// 如果用户选择了文件,且文件路径不为空
|
||||||
if (!newFilePath.isEmpty()) {
|
if (!newFilePath.isEmpty()) {
|
||||||
// 将widgetName和newFilePath插入到m_customiconpathmap中,以便后续可以通过widgetName找到自定义图标路径
|
// 将widgetName和newFilePath插入到m_customiconpathmap中,以便后续可以通过widgetName找到自定义图标路径
|
||||||
|
@ -305,7 +305,7 @@ void CursorThemeWidget::initRightWidget()
|
||||||
// 判断获取的CursorEditWidget对象是否为空,如果不为空,则继续执行下面的代码
|
// 判断获取的CursorEditWidget对象是否为空,如果不为空,则继续执行下面的代码
|
||||||
if (clickedWidget) {
|
if (clickedWidget) {
|
||||||
// 使用QFileDialog::getOpenFileName函数打开一个文件选择对话框,选择一个SVG文件
|
// 使用QFileDialog::getOpenFileName函数打开一个文件选择对话框,选择一个SVG文件
|
||||||
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select SVG file"), "", tr("SVG file (*.svg)"));
|
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select SVG file"), QDir::homePath(), tr("SVG file (*.svg)"));
|
||||||
// 判断选择的文件路径是否为空,如果不为空,则执行下面的代码
|
// 判断选择的文件路径是否为空,如果不为空,则执行下面的代码
|
||||||
if (!newFilePath.isEmpty()) {
|
if (!newFilePath.isEmpty()) {
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ void GlobalThemeWidget::initCoverWidget()
|
||||||
coverlayout->addWidget(tip);
|
coverlayout->addWidget(tip);
|
||||||
cover->setLayout(coverlayout);
|
cover->setLayout(coverlayout);
|
||||||
connect(m_coverbtn, &QPushButton::clicked, this, [=]() {
|
connect(m_coverbtn, &QPushButton::clicked, this, [=]() {
|
||||||
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select picture file"), "", tr("Picture file (*.png *.jpg)"));
|
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select picture file"), QDir::homePath(), tr("Picture file (*.png *.jpg)"));
|
||||||
if (newFilePath.isEmpty()) {
|
if (newFilePath.isEmpty()) {
|
||||||
newFilePath = m_coverpath;
|
newFilePath = m_coverpath;
|
||||||
}else{
|
}else{
|
||||||
|
@ -299,7 +299,7 @@ void GlobalThemeWidget::initWallPaperWidget()
|
||||||
wallpaperbtn->setIconSize(QSize(130,80));
|
wallpaperbtn->setIconSize(QSize(130,80));
|
||||||
|
|
||||||
connect(wallpaperbtn, &QPushButton::clicked, this, [=]() {
|
connect(wallpaperbtn, &QPushButton::clicked, this, [=]() {
|
||||||
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select picture file"), "", tr("Picture file (*.png *.jpg)"));
|
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select picture file"), QDir::homePath(), tr("Picture file (*.png *.jpg)"));
|
||||||
|
|
||||||
if (!newFilePath.isEmpty()) {
|
if (!newFilePath.isEmpty()) {
|
||||||
if(FileCheck::isLegalWallPaperFile(newFilePath,"wallpaper")){
|
if(FileCheck::isLegalWallPaperFile(newFilePath,"wallpaper")){
|
||||||
|
|
|
@ -97,7 +97,7 @@ void GrubThemeWidget::initEditWidget()
|
||||||
|
|
||||||
connect(m_showBtn, &QPushButton::clicked, this, [=]() {
|
connect(m_showBtn, &QPushButton::clicked, this, [=]() {
|
||||||
// 弹出文件选择对话框,选择图片文件
|
// 弹出文件选择对话框,选择图片文件
|
||||||
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select picture file"), "", tr("Picture file (*.png)"));
|
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select picture file"), QDir::homePath(), tr("Picture file (*.png)"));
|
||||||
|
|
||||||
// 如果选择的文件路径不为空
|
// 如果选择的文件路径不为空
|
||||||
if (!newFilePath.isEmpty()) {
|
if (!newFilePath.isEmpty()) {
|
||||||
|
|
|
@ -110,7 +110,7 @@ void IconThemeWidget::initEditWidget()
|
||||||
clickedWidget = qobject_cast<IconEditWidget*>(widget);
|
clickedWidget = qobject_cast<IconEditWidget*>(widget);
|
||||||
|
|
||||||
if (clickedWidget) {
|
if (clickedWidget) {
|
||||||
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select SVG file"), "", tr("SVG file (*.svg)"));
|
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select SVG file"), QDir::homePath(), tr("SVG file (*.svg)"));
|
||||||
|
|
||||||
if (!newFilePath.isEmpty()) {
|
if (!newFilePath.isEmpty()) {
|
||||||
m_customiconpathmap->insert(widgetName, newFilePath);
|
m_customiconpathmap->insert(widgetName, newFilePath);
|
||||||
|
@ -282,7 +282,7 @@ void IconThemeWidget::initSystemEditWidget()
|
||||||
if (clickedWidget) {
|
if (clickedWidget) {
|
||||||
|
|
||||||
// 显示一个文件选择对话框,让用户选择一个SVG文件。将文件路径保存到newFilePath变量中。
|
// 显示一个文件选择对话框,让用户选择一个SVG文件。将文件路径保存到newFilePath变量中。
|
||||||
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select SVG file"), "", tr("SVG file (*.svg)"));
|
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select SVG file"), QDir::homePath(), tr("SVG file (*.svg)"));
|
||||||
if (!newFilePath.isEmpty()) {
|
if (!newFilePath.isEmpty()) {
|
||||||
//check
|
//check
|
||||||
if(FileCheck::isLegalIconFile(newFilePath)){
|
if(FileCheck::isLegalIconFile(newFilePath)){
|
||||||
|
|
|
@ -106,7 +106,7 @@ void PlymouthThemeWidget::initEditWidget()
|
||||||
addButton->setFixedSize(36,36);
|
addButton->setFixedSize(36,36);
|
||||||
connect(addButton, &QPushButton::clicked, this, [=]() {
|
connect(addButton, &QPushButton::clicked, this, [=]() {
|
||||||
if(pic->isChecked()){
|
if(pic->isChecked()){
|
||||||
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select Png file"), "", tr("Png file (*.png)"));
|
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select Png file"), QDir::homePath(), tr("Png file (*.png)"));
|
||||||
if (!newFilePath.isEmpty()) {
|
if (!newFilePath.isEmpty()) {
|
||||||
if(FileCheck::isLegalPlymouthPicFile(newFilePath)){
|
if(FileCheck::isLegalPlymouthPicFile(newFilePath)){
|
||||||
QPixmap pixmap(newFilePath);
|
QPixmap pixmap(newFilePath);
|
||||||
|
@ -121,7 +121,7 @@ void PlymouthThemeWidget::initEditWidget()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select MP4 file"), "", tr("MP4 file (*.mp4)"));
|
QString newFilePath = QFileDialog::getOpenFileName(this, tr("Select MP4 file"), QDir::homePath(), tr("MP4 file (*.mp4)"));
|
||||||
if (!newFilePath.isEmpty()) {
|
if (!newFilePath.isEmpty()) {
|
||||||
if(FileCheck::isLegalMP4File(newFilePath)){
|
if(FileCheck::isLegalMP4File(newFilePath)){
|
||||||
QPixmap pixmap(newFilePath);
|
QPixmap pixmap(newFilePath);
|
||||||
|
|
|
@ -51,7 +51,7 @@ QString SavePathDialog::getSavePath()
|
||||||
|
|
||||||
void SavePathDialog::onModifyBtnClicked()
|
void SavePathDialog::onModifyBtnClicked()
|
||||||
{
|
{
|
||||||
QString newFilePath = QFileDialog::getExistingDirectory(this);
|
QString newFilePath = QFileDialog::getExistingDirectory(this, tr("Select Directory"),QDir::homePath());
|
||||||
if(newFilePath != nullptr){
|
if(newFilePath != nullptr){
|
||||||
m_savepath = newFilePath;
|
m_savepath = newFilePath;
|
||||||
emit savePathUpdate(newFilePath);
|
emit savePathUpdate(newFilePath);
|
||||||
|
|
Loading…
Reference in New Issue