bweber
bweber

Reputation: 4082

C++/Qt: Get files in directory ordered according to sorting currently applied in Windows Explorer

I would like to know if there is a way in Qt to obtain the filenames of files in a folder ordered according to the current Windows Explorer Settings for this folder. In Windows Explorer the user can sort files by many different criteria (e.g. name, capture date etc.) and I would like to be able to maintain maintain that order in my application.

UPDATE:

Perfect would be a cross-platform solution which also works in Finder on Macintosh and in Nautilus on Ubuntu.

Upvotes: 0

Views: 973

Answers (1)

CppChris
CppChris

Reputation: 1261

This answer suggests to use the IFolderView interface.

UPDATE:

Sorry, you might be looking for the IFolderView2 interface, especially the GetSortColumns method:

HRESULT GetSortColumns(
    [out] const SORTCOLUMN *rgSortColumns,
    [in]  int cColumns
);

The returned SORTCOLUMN structure seems to have the information you need:

typedef struct SORTCOLUMN {
    PROPERTYKEY   propkey;
    SORTDIRECTION direction;
} SORTCOLUMN;

Upvotes: 1

Related Questions