Results 1 to 12 of 12

Thread: QSharedDate - possible misunderstanding

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2010
    Location
    Poland
    Posts
    112
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo
    Thanks
    8
    Thanked 3 Times in 3 Posts

    Default QSharedDate - possible misunderstanding

    I need to solve the problem with sharing some data between my classes
    I thought it would be good idea to check out how QSharedData works, so I cut out the data which used to be encapsulated and shared via static object and made my class public of QSharedData

    but I think I misunderstood something because real sharing is not what I received...
    what I need to have are classes with mutual access to the list of columns, list of tables (both lists contains cols,tabs from db as strings) which are not modified and there are three variables which can be modified in runtime...

    I read the documentation and I think that it is achievable, therefore there must be something I've done wrong

    class with data looks like below

    Qt Code:
    1. class QueryHandlerData : public QSharedData{
    2. public:
    3. QueryHandlerData(){
    4. codec = QTextCodec::codecForName("Windows-1250");
    5. //appending columns and tables here
    6. }
    7. QString connectionName;
    8. QString cStatus;
    9. int lastInsertedId; //can be redundant,QSqlDatabase has the feature which allows to obtain it anywhere
    10. QStringList columns;
    11. QStringList tables;
    12. QTextCodec *codec;
    13. };
    To copy to clipboard, switch view to plain text mode 

    but I saw on forum, that it should implement detach() method, is it a problem here ?
    Another problem can be that I can not fully understand the meaning of Implicit and Explicit sharing
    Does the implicit means that shared data is like-hidden, because I that's what I found in the dictionary
    Last edited by kornicameister; 2nd February 2011 at 17:53.
    My schedule makes my cry
    My works makes my laugh
    My life makes... oh...no....

Similar Threads

  1. Misunderstanding QTestLib's TestCase term
    By lyuts in forum Qt Programming
    Replies: 4
    Last Post: 13th July 2010, 12:34
  2. QSortFilterProxyModel.invalidateFilter() misunderstanding
    By aspidites in forum Qt Programming
    Replies: 2
    Last Post: 23rd April 2009, 14:17
  3. parent() heirarchy misunderstanding?
    By KShots in forum Qt Programming
    Replies: 2
    Last Post: 16th October 2007, 19:18

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.