PDA

View Full Version : QSetting and writing REG_BINARY to registry



ramazangirgin
23rd October 2008, 07:36
Hi ,
i want to add value to windows registry binary value. I am using QSettings.setValue()
method. I want to add 0x20000000 value as a REG_BINARY type . I am using like this.

QSettings lReg("HKEY_CURRENT_USER\\Software\\...\\x");
QByteArray lArr=QByteArray::fromHex("0x20000000");
QVariant lVar=QVariant::fromValue(lArr);
lReg.setValue("test",lVar");

but after executing code like this. "test" value type is equal REG_BINARY but value is "@QByteArray(20..)". QSettings writes to registry my value and name QByteArray.

How can i avoid this? I only want to write my value .

Thanks in advance

Ramazan

aamer4yu
23rd October 2008, 07:52
lReg.setValue("test",lVar");

is the extra quote causing prob ?

ramazangirgin
28th October 2008, 07:30
It is my fault. It is correct in code. The problem isn't this. I can compile and run code like this . My problem is writing correct BINARY value to windows registry.

spirit
28th October 2008, 07:51
try to use QSettings::NativeFormat in ctor of QSetting object.

ramazangirgin
30th October 2008, 08:32
I have tried

QSettings lReg("HKEY_CURRENT_USER\\Software\\...\\x",QSetting::NativeFormat);
...

This doesn't correct my problem.

pastor
30th October 2008, 12:07
It seems, it's a bug in Qt. Please see task #100648 on TackTracker:

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

This bug was scheduled for 4.2.0, but it doesn't work for me too on Qt 4.4.3. I think, you should write a bug report about yuor issue

pastor
7th November 2008, 09:25
This is oficial answer form Trolltech:


QSettings does not fully support reading and writing of the registry
type REG_BINARY. There is a suggestion in task tracker regarding this
issue. This task has ID:108395.