ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
CSVMatrixOpenDialog.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include "CSVMatrixOpenDialog.h"
9 
10 #include "ecvFileUtils.h"
11 
12 // Qt
13 #include <QFileDialog>
14 #include <QFileInfo>
15 #include <QSettings>
16 
18  : QDialog(parent), Ui::CSVMatrixOpenDlg() {
19  setupUi(this);
20 
21  connect(browseToolButton, &QAbstractButton::clicked, this,
23 
24  // persistent settings
25  QSettings settings;
26  settings.beginGroup("LoadFile");
27  QString currentPath =
28  settings.value("currentPath", ecvFileUtils::defaultDocPath())
29  .toString();
30 
31  textureFilenameLineEdit->setText(currentPath);
32 }
33 
35  QString inputFilename = QFileDialog::getOpenFileName(
36  this, "Texture file", textureFilenameLineEdit->text(), "*.*");
37  if (inputFilename.isEmpty()) return;
38 
39  textureFilenameLineEdit->setText(inputFilename);
40 
41  // save last loading location
42  QSettings settings;
43  settings.beginGroup("LoadFile");
44  settings.setValue("currentPath", QFileInfo(inputFilename).absolutePath());
45  settings.endGroup();
46 }
void browseTextureFile()
Bowse texture file.
CSVMatrixOpenDialog(QWidget *parent=0)
Default constructor.
QString defaultDocPath()
Shortcut for getting the documents location path.
Definition: ecvFileUtils.h:30