You are not logged in.

Regis

Beginner

  • "Regis" is male
  • "Regis" started this thread

Posts: 4

Location: France

  • Send private message

1

Saturday, May 1st 2004, 6:01pm

QTSetting problem

Hello!

I'm trying to define my app's configuration file, but I can't find what's wrong in my code:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <qsettings.h>
#include <qapplication.h>

int main( int argc, char **argv )
{
	QApplication a( argc, argv );
				
	QSettings settings;
    	settings.setPath( "MyCompany.com", "interface" );
   	
    	int Rouge_Actif = settings.readNumEntry( "interface/Couleurs/Themes/Actif/Rouge", 640 );
	qDebug(QString::number(Rouge_Actif));
[...]


Here is my file ~/.qt/interfacerc

Source code

1
2
3
[interface]
Couleurs/Themes/Actif/Bleu=251
Couleurs/Themes/Actif/Rouge=151



when I execute the program, it always gives me the default value ( 640 ) ...

Thank you very much!

tuxipuxi

Unregistered

2

Saturday, May 1st 2004, 6:04pm

Hi,

I don't know if your rc file has a correct layout. Have you tried to write the value using QSettings?

Michael.

Regis

Beginner

  • "Regis" is male
  • "Regis" started this thread

Posts: 4

Location: France

  • Send private message

3

Saturday, May 1st 2004, 6:12pm

QTSetting problem

yes, I've tried

settings.writeEntry("interface/Couleurs/Themes/Actif/Rouge", 640 );

it doesn't work ;(

Posts: 2,162

Location: Graz, Austria

Occupation: Student

  • Send private message

4

Saturday, May 1st 2004, 6:41pm

Try prepending / to all your paths so they start with it.

There is an example for QSettings usage in the Knowledge Database kdb.qtforum.org

Cheers,
_
Qt/KDE Developer
Debian User