[Interest] QSettings watching for updates.

425 views
Skip to first unread message

pritam....@gmail.com

unread,
Jan 9, 2012, 12:25:56 PM1/9/12
to inte...@qt-project.org
Hi

I am using QSettings for persistent settings in my application. These settings may be modified by some other processes at runtime.
I need some notification when this happens. I looked at QSettings API, couldn't find any such notification mechanism. 

Is there any mechanism for this. I was trying to avoid QFileSystemWatcher.


--
pritam

Jason H

unread,
Jan 9, 2012, 12:28:46 PM1/9/12
to pritam....@gmail.com, inte...@qt-project.org
You should just have an object that manages your settings then. When it writes something, just emit your signal.
It would have a QSettings member, or derive from QSettings.




From: "pritam....@gmail.com" <pritam....@gmail.com>
To: inte...@qt-project.org
Sent: Monday, January 9, 2012 12:25 PM
Subject: [Interest] QSettings watching for updates.
_______________________________________________
Interest mailing list
Inte...@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Alan Ezust

unread,
Jan 21, 2012, 12:32:06 PM1/21/12
to pritam....@gmail.com, inte...@qt-project.org
Qt Mobility has a publish-subscribe module which is basically like QSettings but with IPC in mind.
It already has the ability to notify you of changes.

http://doc.qt.nokia.com/qtmobility/publ-subs.html

Till Oliver Knoll

unread,
Jan 23, 2012, 6:18:02 AM1/23/12
to inte...@qt-project.org

Am 21.01.2012 um 15:32 schrieb Alan Ezust <alan....@gmail.com>:

> Qt Mobility has a publish-subscribe module which is basically like QSettings but with IPC in mind.
> It already has the ability to notify you of changes.

If "immediate notifications" are not a must, then "polling for changes" might also be a possibility: re-loading the QSettings every n minutes (or seconds).

Cheers, Oliver

Jason H

unread,
Jan 23, 2012, 2:54:09 PM1/23/12
to Till Oliver Knoll, inte...@qt-project.org
I'd just suggest the QFileSystem watcher with a file (won't work with Windows registry QSettings)



From: Till Oliver Knoll <till.oli...@gmail.com>
To: "inte...@qt-project.org" <inte...@qt-project.org>
Sent: Monday, January 23, 2012 6:18 AM
Subject: Re: [Interest] QSettings watching for updates.

Scott Aron Bloom

unread,
Jan 23, 2012, 3:01:04 PM1/23/12
to Jason H, Till Oliver Knoll, inte...@qt-project.org

Hoever, it would NOT be hard to extend FileSystemWatcher to handle watching the registry.


Similar Win32 messages are emitted when the portion of the registry changes and you are watching that portion..


Scott

Jason H

unread,
Jan 23, 2012, 3:05:29 PM1/23/12
to Scott Aron Bloom, Till Oliver Knoll, inte...@qt-project.org
Yes, but that would not be portable. However you can force QSettings to use another storage medium. (i.e. a file) which would be portable and transparent.



From: Scott Aron Bloom <Scott...@onshorecs.com>
To: Jason H <scor...@yahoo.com>; Till Oliver Knoll <till.oli...@gmail.com>; inte...@qt-project.org
Sent: Monday, January 23, 2012 3:01 PM
Subject: RE: [Interest] QSettings watching for updates.

Scott Aron Bloom

unread,
Jan 23, 2012, 3:12:44 PM1/23/12
to Jason H, Till Oliver Knoll, inte...@qt-project.org

That’s my point…

 

QSettingsWatcher for windows would have to be a variant but non-portable enhancement to QFileWatcher..

 

However, QSettingsWatcher for Linux could BE QFileWatcher, just pointing to each file/directory.

 

For mac, Im not sure if it uses pfile or not, but again, pretty easy to watch.

 

Scott

Till Oliver Knoll

unread,
Jan 24, 2012, 10:15:48 AM1/24/12
to inte...@qt-project.org


Am 23.01.2012 um 18:12 schrieb "Scott Aron Bloom" <Scott...@onshorecs.com>:

For mac, Im not sure if it uses pfile or not, but again, pretty easy to watch.


If not specified otherwise the format is the "native" plist file format. You can also have INI files.

Both are plain files in any case.


While not against the idea at all to have a cross-platform "settings watcher" I wonder how many applications out there do have their settings changed from another process (well, at least one, that's for sure ;))

Cheers, Oliver
Reply all
Reply to author
Forward
0 new messages