Changeset 14198
- Timestamp:
- Sep 8, 2013, 7:12:33 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt/make-dialog.cc
r14179 r14198 44 44 **** 45 45 ***/ 46 47 namespace 48 { 49 QString removeTrailingSlash (const QString& path) 50 { 51 // QFileDialog may return path ending with slash if that path refers to 52 // directory. QFileInfo::fileName() applied to such path would then return 53 // an empty string which is not what we want, so we strip the slash here. 54 55 if (!path.endsWith (QDir::separator ())) 56 return path; 57 58 return path.left (path.length () - 1); 59 } 60 } 46 61 47 62 void … … 187 202 MakeDialog :: onFileSelected( const QString& filename ) 188 203 { 189 myFile = filename;204 myFile = removeTrailingSlash (filename); 190 205 myFileButton->setText( QFileInfo(myFile).fileName() ); 191 206 onSourceChanged( ); … … 212 227 MakeDialog :: onFolderSelected( const QString& filename ) 213 228 { 214 myFolder = filename;229 myFolder = removeTrailingSlash (filename); 215 230 myFolderButton->setText( QFileInfo(myFolder).fileName() ); 216 231 onSourceChanged( ); … … 237 252 MakeDialog :: onDestinationSelected( const QString& filename ) 238 253 { 239 myDestination = filename;254 myDestination = removeTrailingSlash (filename); 240 255 myDestinationButton->setText( QFileInfo(myDestination).fileName() ); 241 256 }
Note: See TracChangeset
for help on using the changeset viewer.