Results 1 to 10 of 10

Thread: QStandardItemModel save/load Problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2008
    Posts
    17
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QStandardItemModel save/load Problem

    looks like i nearly got it
    But I think I have to use const_cast.

    With a const_cast to Project it seems to work, but I realised that I made a big mistake.
    My Projectclass inherits QStandardItem AND QObject.
    So I can't make an QStandardItem from a Project. Or am I wrong?

    So I now face the descision, to implement a &operator<< with the relevant Attributes of the QStandarditem on my own or to get rid of the QObject inheritance what would make necessary massive changes to my information flux.
    Is it bad Style to Make QStandardItems to QObjects?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QStandardItemModel save/load Problem

    Quote Originally Posted by sun View Post
    looks like i nearly got it
    But I think I have to use const_cast.
    No you don't. Simply add "const" at the begginning of the second line of the snippet I posted.

    My Projectclass inherits QStandardItem AND QObject.
    So I can't make an QStandardItem from a Project. Or am I wrong?
    You are wrong. You are wrong again to make your item inherit QObject. I really wouldn't advise it.

    So I now face the descision, to implement a &operator<< with the relevant Attributes of the QStandarditem on my own or to get rid of the QObject inheritance what would make necessary massive changes to my information flux.
    Get rid of QObject heritage.
    Is it bad Style to Make QStandardItems to QObjects?
    I'd say it's worse than Bad

Similar Threads

  1. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  2. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 08:47
  3. Replies: 16
    Last Post: 7th March 2006, 15:57

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.