Browse Source

Remove ambiguity in QFileInfo declaration

When building on Mac with clang, a function interpretation of the
declaration was used instead of the intended constructor argument.


/Users/pieper/ctk/latest/CTK/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMThumbnailListWidgetTest1.cpp:47:27: warning: parentheses were disambiguated as a function
      declarator [-Wvexing-parse]
    QFileInfo databasePath(QString(argv[1]));
                          ^~~~~~~~~~~~~~~~~~
/Users/pieper/ctk/latest/CTK/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMThumbnailListWidgetTest1.cpp:48:42: error: member reference base type
      'QFileInfo (QString (*))' is not a structure or union
    ctkDICOMDatabase myCTK( databasePath.absoluteFilePath() );
                            ~~~~~~~~~~~~ ^
/Users/pieper/ctk/latest/CTK/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMThumbnailListWidgetTest1.cpp:60:46: error: member reference base type
      'QFileInfo (QString (*))' is not a structure or union
    widget.setDatabaseDirectory(databasePath.absolutePath());
                                ~~~~~~~~~~~~ ^
1 warning and 2 errors generated.
Steve Pieper 12 years ago
parent
commit
034d5d20bd

+ 2 - 1
Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMThumbnailListWidgetTest1.cpp

@@ -44,7 +44,8 @@ int ctkDICOMThumbnailListWidgetTest1( int argc, char * argv [] )
 
   try
     {
-    QFileInfo databasePath(QString(argv[1]));
+    QFileInfo databasePath;
+    databasePath.setFile(argv[1]);
     ctkDICOMDatabase myCTK( databasePath.absoluteFilePath() );
 
     if (!myCTK.initializeDatabase(argv[2]))