Qt World Summit: Submit your Presentation

Saving user data: which of QStandardPaths to use?

  • Hi all,

    I am using Qt to write an image viewer where the user can create notes/annotations about the image and bookmark interesting points of view. I was thinking of saving these notes/bookmarks in QStandardPaths::DataLocation, but it seems like that might be used more for user settings and configurations. Would QStandardPaths::CacheLocation be more appropriate?

    Thank you from a Qt newbie :)

  • Also, what is returned by QStandardPaths::writableLocation(QStandardPaths::DataLocation) under Windows 7? I would like to use AppData/Roaming instead of AppData/Local.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    I would go for DataLocation. If I understand correctly, CacheLocation would be more for something like data created et reused while running your program but cleared at the end. (I might be wrong) And since your "meta data" looks they are going to be kept, it seems to be that it can be associated to persistent data.

  • Yes, writableLocation(DataLocation), for apps.

    Roaming isn't available yet, please comment on https://bugreports.qt-project.org/browse/QTBUG-15158.

Log in to reply