Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from PyQt5.QtCore import QStandardPaths
def get_qt_enum(cls, enum):
d = {}
for key in dir(cls):
value = getattr(cls, key)
if isinstance(value, enum):
d[key] = value
return sorted(d, key=lambda k:d[k])
print(get_qt_enum(QStandardPaths, QStandardPaths.StandardLocation))
@zas
Copy link
Author

zas commented Sep 13, 2019

Output:

['DesktopLocation', 'DocumentsLocation', 'FontsLocation', 'ApplicationsLocation', 'MusicLocation', 'MoviesLocation', 'PicturesLocation', 'TempLocation', 'HomeLocation', 'AppLocalDataLocation', 'DataLocation', 'CacheLocation', 'GenericDataLocation', 'RuntimeLocation', 'ConfigLocation', 'DownloadLocation', 'GenericCacheLocation', 'GenericConfigLocation', 'AppDataLocation', 'AppConfigLocation']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment