Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, January 2008
QSettings: set IniFormat globally ?


Message 1 in thread

Is there any way to set QSettings::IniFormat globally
rather than having to pass it to each QSettings ctor,
as can be done for the application name and so on,
via the QCoreApplication:: methods ?

-- 
 [ signature omitted ] 

Message 2 in thread

On Mon, 2008-01-28 at 10:50 +0000, Stephen Collyer wrote:
> Is there any way to set QSettings::IniFormat globally
> rather than having to pass it to each QSettings ctor,
> as can be done for the application name and so on,
> via the QCoreApplication:: methods ?

Not now, but from Qt 4.4.0 on, this will be possible:

http://trolltech.com/developer/task-tracker/index_html?method=entry&id=182712

\Ralf

--
 [ signature omitted ] 

Message 3 in thread

Ralf Neubersch wrote:
> On Mon, 2008-01-28 at 10:50 +0000, Stephen Collyer wrote:
>> Is there any way to set QSettings::IniFormat globally
>> rather than having to pass it to each QSettings ctor,
>> as can be done for the application name and so on,
>> via the QCoreApplication:: methods ?
> 
> Not now, but from Qt 4.4.0 on, this will be possible:
> 
> http://trolltech.com/developer/task-tracker/index_html?method=entry&id=182712

OK, thanks. I guess I'll have to derive from QSettings
and wrap it up in a new class.

-- 
 [ signature omitted ] 

Message 4 in thread

Rather then derive from it....

What I do, is simply create a global function that returns a
std::auto_ptr< QSettings * >

Since I believe that the copy constructor is private for QSettings and
you cant return a QSetting itself...

std::auto_ptr< QSettings > getSettings( bool user = true ) const
	{
		QSettings::Scope scope = user ? QSettings::UserScope :
QSettings::SystemScope;
		std::auto_ptr< QSettings> retVal( new QSettings(
getSettingsFormat(), 
				scope, 
				QCoreApplication::organizationName(),
				QCoreApplication::applicationName(),
				NULL ) );
		return  retVal;
	}

I actually do it with a custom settings format... but you should be able
to figure this one out :)

Scott

> -----Original Message-----
> From: Stephen Collyer [mailto:scollyer@xxxxxxxxxxxxxxxx]
> Sent: Monday, January 28, 2008 6:00 AM
> To: qt-interest@xxxxxxxxxxxxx
> Cc: qt-interest@xxxxxxxxxxxxx
> Subject: Re: QSettings: set IniFormat globally ?
> 
> Ralf Neubersch wrote:
> > On Mon, 2008-01-28 at 10:50 +0000, Stephen Collyer wrote:
> >> Is there any way to set QSettings::IniFormat globally
> >> rather than having to pass it to each QSettings ctor,
> >> as can be done for the application name and so on,
> >> via the QCoreApplication:: methods ?
> >
> > Not now, but from Qt 4.4.0 on, this will be possible:
> >
> > http://trolltech.com/developer/task-
> tracker/index_html?method=entry&id=182712
> 
> OK, thanks. I guess I'll have to derive from QSettings
> and wrap it up in a new class.
> 
> --
> Regards
> 
> Steve Collyer
> Netspinner Ltd
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ]