Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-115571

A small suggestion for improving Qt

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Won't Do
    • Not Evaluated
    • None
    • 6.6.0 Beta2
    • Core: Object Model
    • None
    • Windows

    Description

      Hello, All!

      I want to suggest a small improvement to Qt. To do this, add two public virtual methods to the QObject class:

      virtual void LoadFromStream( QDataStream &/ST/ ) {};
      virtual void SaveToStream( QDataStream &/ST/ ) {};

      There are numerous examples in my program "Shrila Prabhupada's Dictionary"- https://github.com/Navadvipa-Chandra-das/PrabhupadaDictionaryQt . It's not quite finished yet, but it absolutely does not prevent me from demonstrating the things that I want to offer you to use!

      The point is what? Let's say we have a descendant object of the QObject class. We configured it at will, then saved it either in memory, or on a hard disk file, or in a database - to choose from. Now we can destroy the object. Then we create a new object and read its state very, very simply - with one function call! I know that there is already a QSettings class to save settings in Qt. I suggest a Storage class with similar functionality, but still there are differences between them.

      Disadvantages of QStorage:

      When changing the structure of settings, all previous settings are subject to deletion. This happens when updating versions of the program.
      It is quite difficult to edit the settings using external programs, such as a text editor and a database manager.

      Disadvantages of QSettings :

      Can work only with files
      Stores all data in text format, event binary data.
      Requires to create a unique string key for each portion of settings.
      These disadvantages lead to slower loading and saving of settings. Moreover, as the size of the ini file grows, the speed of key-value search will fall all the time.

      Advantages of QStorage:

      Better performance.
      No need to compose unique string key names for portions of settings.
      The ability to choose the storage location of settings - File, DB, Memory.

      Of course, I would like to see these changes in future versions of Qt, so that QStorage classes and other necessary changes appear there. I haven't implemented this class as a library yet, but only as a local class in my program, but I want to do it, and knowledge of how to create libraries in Qt is not enough yet.

      Thany You!

      With best regards, Navadvipa Chandra das.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            navadvip-chandra-das Navadvipa Chandra das Zolotyh
            Navadvipa Chandra das Zolotyh Navadvipa Chandra das Zolotyh
            Navadvipa Chandra das Zolotyh Navadvipa Chandra das Zolotyh
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes