I'm developing an app with qt4.3 which opens a window with a bunch of icons loaded from .desktop files. It tries to emulate a file browser but without file browsing... I mean, you can double click and open an app or drag the icons to an other position not necessary attached to the grid.

I'm using a qdirmodel and a qlistview in "icon mode".

My problem is that I can't save the position of the icons once I moved them. Every time I restart the app, I get the icons loaded in the default position. I can't find any way to know the position of an item or move an item to a position.

What I should do? Do I have any chance?

Thanks!

有帮助吗?

解决方案 2

After looking at the qlistview code I found that I can also inherit the qlistview class and convert to public a couple of protected functions which return the item position and move the item to a position. Thanks anyway!!

其他提示

I'm sure, you can save item's position. You should read about save session qt. This is official qt doc about Session Management Session Management
And also I'll advice to read qt's possibility save settings QSettings

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top