Results 1 to 7 of 7

Thread: QSetting and writing REG_BINARY to registry

  1. #1
    Join Date
    Jul 2007
    Posts
    35
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QSetting and writing REG_BINARY to registry

    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

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSetting and writing REG_BINARY to registry

    lReg.setValue("test",lVar");

    is the extra quote causing prob ?

  3. #3
    Join Date
    Jul 2007
    Posts
    35
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSetting and writing REG_BINARY to registry

    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.

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QSetting and writing REG_BINARY to registry

    try to use QSettings::NativeFormat in ctor of QSetting object.

  5. #5
    Join Date
    Jul 2007
    Posts
    35
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSetting and writing REG_BINARY to registry

    I have tried

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

    This doesn't correct my problem.

  6. #6
    Join Date
    Oct 2008
    Posts
    70
    Thanks
    1
    Thanked 9 Times in 9 Posts

    Default Re: QSetting and writing REG_BINARY to registry

    It seems, it's a bug in Qt. Please see task #100648 on TackTracker:

    http://trolltech.com/developer/task-...ntry&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

  7. #7
    Join Date
    Oct 2008
    Posts
    70
    Thanks
    1
    Thanked 9 Times in 9 Posts

    Default Re: QSetting and writing REG_BINARY to registry

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.