@@ -39,6 +39,7 @@ admeshController::admeshController(QObject *parent) :
3939 hiddenIcon = QIcon (" ://Resources/hide.svg" );
4040 QSettings settings;
4141 history.setLimitSize (settings.value (" sizeLimit" , HISTORY_LIMIT).toInt ());
42+ openPath = settings.value (" openPath" , QStandardPaths::standardLocations (QStandardPaths::HomeLocation).at (0 )).value <QString>();
4243 setDrawColor (settings.value (" color" ,QColor (Qt::green)).value <QColor>(), settings.value (" badColor" ,QColor (Qt::red)).value <QColor>());
4344}
4445
@@ -434,11 +435,12 @@ QString admeshController::getInfo()
434435
435436void admeshController::openSTL ()
436437{
437- QStringList fileNameList = QFileDialog::getOpenFileNames ((QWidget*)parent (), _ (" Open STL" ), QStandardPaths::standardLocations (QStandardPaths::HomeLocation). at ( 0 ) , _ (" STL (*.stl *.STL)" ));
438+ QStringList fileNameList = QFileDialog::getOpenFileNames ((QWidget*)parent (), _ (" Open STL" ), openPath , _ (" STL (*.stl *.STL)" ));
438439 int opened = 0 ;
439440 renewList ();
441+ QString fileName;
440442 for (QStringList::Iterator it = fileNameList.begin (); it != fileNameList.end (); it++){
441- QString fileName = *it;
443+ fileName = *it;
442444 if (!fileName.isEmpty ()){
443445 MeshObject* tmp = new MeshObject;
444446 if (!tmp->loadGeometry (fileName)){
@@ -454,10 +456,10 @@ void admeshController::openSTL()
454456 }
455457 count++;
456458 }
457- }
459+ }
458460 pushHistory ();
459461 if (opened>0 ){
460-
462+ openPath = QFileInfo (fileName). path (); // save path used
461463 statusBar->setText (QString (ngettext (" Status: %1 file opened" , " Status: %1 files opened" , opened)).arg (opened));
462464 reCalculatePosition ();
463465 reDrawSignal ();
@@ -644,8 +646,10 @@ void admeshController::exportSTL()
644646}
645647
646648void admeshController::writeSettings ()
647- { QSettings settings;
649+ {
650+ QSettings settings;
648651 settings.setValue (" rendermode" , mode);
652+ settings.setValue (" openPath" , openPath);
649653}
650654
651655float admeshController::getMaxDiameter ()
0 commit comments