[Development] Differences: QDesktopServices vs QStandardPaths

David Faure faure at kde.org
Thu Jul 11 13:41:45 CEST 2013


Le jeudi 11 juillet 2013 08:06:05 Chris W a écrit :
> On 10/07/13 18:57, David Faure wrote:
> > Le mercredi 10 juillet 2013 09:41:59 Mark a écrit :
> >>> QString paths =
> >>> QDesktopServices::storageLocation(QDesktopServices::DataLocation);
> > 
> > After reading the forum post, I have a more complete answer; posting here
> > for posterity.
> > If your Qt4 code does the above, in Qt5 you can either:
> > * move the data once and for all (from data/org/app to org/app)
> > * keep using the deprecated QDesktopServices::DataLocation
> > * port to this instead:
> > QStandardPaths::writableLocation(GenericDataLocation) + “data/org/app”.
> > 
> > The latter is the future-proof way of accessing that (old) data/org/app
> > directory under local/share, for people who don't want to move it.
> 
> This is more-or-less what to allow my Qt5 version to move the
> pre-existing Qt4 folder to the new location.

Ah, good point.

> > Please confirm that this solution works for you, and I'll add porting
> > documentation to QDesktopServices about this solution.
> 
> This is good.  A note in the docs regarding the extra "data" folder and
> alternatives for getting at it would be excellent.

https://codereview.qt-project.org/60900

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5




More information about the Development mailing list