How to store a QHash of custom QSetting objects

Hello

I have a custom host class that extends QObjects, I want to keep a bunch of instances of the host in QSetting. However, he got the error "in this context" when I try to compile. Here is my code

//create the server
Host host = new Host();
...some initialization for the host

//load setting
QSettings settings(m_author, m_appName);
QHash *hosts = new QHash();

//put the new host to the hash
hosts.insert(host->name(), QVariant(host)); //this is where i got "within this context"settings.setValue("hosts", hosts); //same error on this line

I do know that if it's a good approach, I don't even know if storable settings on QHash, as far as I'm testing, I can put some like a but I guess because QString Qvariant if it worked.

Hello

Please see if this helps:

http://developer.Nokia.com/community/wiki/Saving_custom_structures_and_classes_to_QSettings

Basically, you need to implement custom type serialization management and save them using qRegisterMetaTypeStreamOperators.

BTW, written QSettings are not atomic, and it may lose data occasionally (this is not resolved even in 5 Qt).

If you need to store the data in a reliable way, consider it serialization to the file manually. Ideally, the data should be saved in a temporary file by renaming the file in the original, so the operation is atomic.

Tags: BlackBerry Developers

Similar Questions

  • How to store the layout when you add objects at the top of the page?

    Hello

    I'm working on my company Web site and my main page uses a model of 'a page '.

    I do changes several changes in the model, save a new version every change & I want to add something in the middle of the page without everything be messed up as all objects below right out their alignment.

    Can what resources I use to get around that?

    Possible by manipulation in CSS.

    First of all, to get the ID of the master DIV containing elements

    1. Preview your page in Google Chrome (or Firefox Developer Edition) (file > Preview in browser Page)
    2. Open the developer tools (view > developer > Developer tools)
    3. Click on the "Magnifying glass lens" tool down.
    4. Click on the item in menu of your page.
    5. Get the 'id' of the
      element
      .

    Later, in Muse, open the property page and apply max-height in the previous div element. More: max-height - CSS | DND

  • How to identify a one time customer Oracle Apps AR

    Hello

    How to identify a one time customer in Oracle APps AR?

    Is it possible to know how many number of transactions a customer made so that, if the number of transactions is 1, then the customer is a customer of time. Otherwise, it is not?

    Thank you
    Bob

    Hi Bob,

    to my knowledge, I can't recall a report seeded by oracle that could meet your requirement. You can try running the Transaction Register report date of your live Go far, so that the system generates a list of all bills and the name of the customer, then you could export to Excel and sort, filter and group by to get the desired result...
    However if you are a person with technical expertise, check table RA_CUSTOMER_TRX_ALL this option stores all the transaction information you can select TRX_NUMBER, BILL_TO_CUSTOMER_ID from this table and perform a count by customer... (I'm not sure about the syntax and use of sql functions) you can get the desired effect...

    Also in the future, while creating a new customer if you know in advance that this customer is going to be a ONE TIME CUSTOMER, you can enter this information in any unused field on the client configuration can allow a FDF and capture this information, so that it becomes very easy to identify these customers or have a report based on this is based...

    I guess there's an objecive behind trying to find a new subscribers or customers with a single transaction history... are you planning disable/end date / idle clients...?

    Kind regards
    Ivruksha

  • How Photos stores libraries?

    I would like to understand how Photos stores photos. I come from a background of Picasa. Picasa, only used tags to build libraries but not to reproduce the photo itself (which I understand). However, it looks like iPhotos and Photos really build a coded library which, in a sense, duplicate photos in their own system of coded library.

    Is this correct?

    So, if this is correct, I guess that if I want to use one of the photos of, say, a document, I first need to export in the pictures folder (or somewhere) and it access?

    And, if this is correct, it raises the question of whether copies of photo outside the library can be deleted safely? What a pity that 'information' about the photos of the library do not point to their original location in the pictures folder.

    Post edited by: wizard_chef to add another question

    It looks like iPhotos and Photos really build a coded library which, in a sense, duplicate photos in their own system of coded library.

    Is this correct?

    Photos, iPhoto, Aperture, etc., are essentially applications of databases keep track of your photos and everything that changes and tags have been added to them.

    If you have iPhoto and photo libraries, they both link to the same files on your drive. the files are not duplicated, even if she looks like this in the Finder. If you remove, say, iPhoto library, you re - win very small storage space.

    Because these applications are databases, you should let them consolidate (as opposed to the use of libraries referenced) all your images and never, ever try to reorganize or rename, the files directly in the library file.

  • How can I install my graphic custom, self-created Persona / theme that I use on my XP on my Win7Firefox?

    How can I install my graphic custom, self-created Persona / theme that I use on my XP computer on my Windows 7 Firefox? (Firefox 17.0.1 Windows 7 64 bit home edition? (There is, as far as I know, no 'little Fox' icon visible below on the left!) I use a downloaded "Persona" or "Theme" ((je vous souhaite vous les gens ne changerait pas les termes importants à la baisse d'un chapeau!)) and it works very well...

    You need to install the Persona more extension to easily install a character via its files instead of via the internet.

  • How to store contacts on my Mac?

    Everything I see is the iCloud account in Contacts. How to store contacts on my Mac?

    If you have the Apple menu > System Preferences > iCloud > power Contacts, the contacts in contacts on your Mac are automatically synchronized with iCloud. A copy is stored on your Mac, as well as in iCloud (and any other device that is synchronized to this account).

    You can reply with more information about what other contacts you want to store on the Mac.

  • When you try to upgrade to photos in app store I get this message "the object you requested is not available in the store US." does anyone else have this problem or can you tell me how to find pictures in the app store

    "When you try to upgrade to photos in app store I get this message"the object you requested is not available in the store US."does anyone else have this problem or can you tell me how to find pictures in the app store" someone else meets this.  Is it me or is it pictures?

    Ever photos first? It should have been included when you first update of Yosemite and now El Capitan. I know that iPhotos updates get a message like that, but I didn't know the Photos app with a message with it.

    Update to iPhoto to Photos for OS X - Apple support

  • How to store the original and to remove some duplicate songs in iTunes on a PC Win7, which took place after iTunes to scan for music during a re - install?

    How to store the original and to remove some duplicate songs in iTunes on a PC Win7, which took place after iTunes to scan for music during a re - install?

    I recently had to format my hard drive and reinstall iTunes 12.3.2.35 on my Win7 PC. As part of the re - install iTunes, I clicked on the button scan for music.  This has created duplicates several of my songs.  I deleted then the duplicate songs from iTunes, but when I went to play a few songs a pop-up said "the song would not be because the original could not be found.  You want to locate? "When I tried to locate the song it is not found, but when I pulled the songs out of the trash they could be found.

    How can I keep the original and remove any duplicate songs in iTunes on PC Win7 which took place after iTunes to scan for music during a re - install?

    iTunes can create duplicates if the same content is added several times from outside the media folder when it is about to make copies of everything that is added to the library, or is added from an external drive that hosts the press kit that was disconnected during the launch of iTunes.

    Official notice of Apple on the duplicates is here: find and remove duplicates in your iTunes library. This is a manual process and article fails to explain some of the potential pitfalls such as the lost coast and membership of playlist, or sometimes the same file can be represented by multiple entries in the library as well as a removal and recycling the file will break all the others.

    Use MAJ > display > show items to reproduce exactly to display the duplicates because it is normally a selection more useful. You must manually select all but one of each group to remove. Sort the list by Date added can make easier select appropriate tracks, but it works better when executed immediately after the dupes were created.  If you have several entries in iTunes connected to a same file on the disk hard then don't not send to trash.

    Use my DeDuper script (Windows only) If you are not sure, do not want to do it by hand, or want to maintain ratings, play counts and playlist membership. See this background thread , this post for detailed instructions and Please take note of the warning to back up your library before deduping.

    (If you don't see the menu bar press ALT to temporarily view or CTRL + B to keep displayed.)

    The latest version of the script can put away the dead links as long as there is at least a double live to merge his stats and membership of the playlist and must deal wisely when the same file has been added through multiple paths.

    TT2

  • How can I get my calendars customized calendar 8.0 now that 10.11.3 updated?

    I have a MacBook Pro. How can I get my calendars customized calendar 8.0 now that 10.11.3 updated? I clicked on view > update and nothing is displayed.

    Synchronize calendars with a network like iCloud or Google service?

  • How to store passwords on my macbook pro so that they are secure

    How to store passwords on my Macbook Pro so that they are secure?  I like to keep my huge list of passwords in a document on my computer but worry they will not be secure.  I have a Macbook Pro with the retina display OSX 10.9.5

    Thank you

    Martha

    The Finder, choose utilities go to menu and use disk utility to create an encrypted drive or image if you wish, turn on FileVault.

    (136891)

  • How to store files in iCloud drive ONLY (do not use the space on my MACBOOK hard drive?

    How to store files in iCloud drive ONLY (do not use the space on my MACBOOK hard drive?)

    I want to save the file in my iCloud account, but free space in the hard drive of my MACBOOK

    I want to save the file in my iCloud account, but free space in the hard drive of my MACBOOK

    There is no practical way to do it.

    If you do not enable iCloud Drive on your Mac, you can upload files to iCloud by car via the web interface at https://www.icloud.com

    But you can access the files from the web interface and won't icloud drive as drive in the Finder.  You cannot use the Finder to access the files. You need to download it to use.

  • How to store characters in result file and display on front panel

    Hello

    currently I am working on the FPGA project.i want data acquired from FPGA board.i want to know on how to store characters to the file and contineous each character display on the façade in the string format.

    I'm full up to characters on the front display, but display characters only when I want all characters in string format.

    I don't see how this question fits in any digital i/o, but it looks like you just need a change of register with the concantanate string function.

  • How to store pictures and other data on my hisense7 SD pro tablets

    How to store pictures and other data on my hisense7 SD pro tablets

    Hi Mark,

    Please contact hisense support from here: http://hisense-usa.com/support/.  If this isn't the case, in the United States, go to the bottom of the page to choose a more suitable location.

    I could point out that http://hisense-usa.com/support/manuals.asp contains a manual that could well answer that questions without the need more help.

    Good luck and best wishes

    Kosh

  • How to store a string of application properties

    Hi all!

    I just want to know how to store a string of properties of the application, so that I can access this channel of my app (just as we do in j2ME)

    Thank you that solves my query

  • BlackBerry smartphone how to move incoming emails to Custom application folder

    Hello

    Please someone give me soloution of the programaticaly application how to move incoming emails to custom. Please its too urgent in my project.

    Hi mohdfarhanakram

    Automatically move e-mail messages to a different folder is available only when you're using BlackBerry® Enterprise Server.  Messages will be filtered on the mail server but would appear in these folders on the BlackBerry® smartphone.

    I hope that answers your question!

    Thank you

Maybe you are looking for

  • Notes disappeared

    I am running OS X El Capitan Version 10.11.5 on my Macbook Pro late 2013. I opened my Notes applications and after a few seconds the notes have literally disappeared. I did a quick search online and found that the files are stored in /Users/lucas/Lib

  • Update button appears when Firefox is updated

    There seems to be a problem with the update of Firefox 5. I am running Windows 7 Home Premium 64 bit SP1. I was running Firefox 5.0 and I noticed that Firefox 5.0.1 was released then went to help - about Firefox. Running under my user account, the bu

  • How to do fdisk for windows when my computer came preloaded

    my computer crashed and it tell me that I need the Setup disk to repair the startup problem, and I don't have the disc

  • How to disable a previous installation of Lightroom 6 on a computer that no longer works?

    I have an iMac with Lightroom installed 6. My old computer, also an iMac, had 6 installed Lightroom. The old computer has hard disk problems and won't open Lightroom 6 so I can't disable this facility. Now, I get a message that I need to disable the

  • Release_mode = reserved safe to use is

    HelloJDeveloper 12.1.3, Glassfish 3.1.2 ADF, JSF Facelets, BC4J.Our application appeals to global temporary tables, which is not safe to use due to the ADF / AM passivation/activation. Until we moved to 12.1.3 and Glassfish worked well however.But no