Results 1 to 20 of 20

Thread: dynamic matrix of QStrings

Hybrid View

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

    Default Re: dynamic matrix of QStrings

    I think the problem is not QObject (where is it anyway? I don't see any QObjects here), but instead this:
    Qt Code:
    1. this[r].resize(columns);
    To copy to clipboard, switch view to plain text mode 
    As "this" is a pointer, you're trying to use an index operator on a pointer, which doesn't make any sense. Either use at() or dereference "this" first:
    Qt Code:
    1. (*this)[r].resize(columns);
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to wysota for this useful post:

    QiT (4th April 2007)

  3. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: dynamic matrix of QStrings

    I think the problem is not QObject (where is it anyway? I don't see any QObjects here),
    Oops... you are right...
    Now I see that QVector is not a QObjet...
    But I thought (obviously was wrong) that in Qt4 all cllases derived QObject.
    Hmm, I better read the docs again...
    Sorry about that. (wrong info).

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

    Default Re: dynamic matrix of QStrings

    Quote Originally Posted by high_flyer View Post
    Oops... you are right...
    Now I see that QVector is not a QObjet...
    QVector is a template class itself, so it couldn't be a QObject.

    But I thought (obviously was wrong) that in Qt4 all cllases derived QObject.
    Naaa... QObject is quite heavy, so it's better to avoid it if you don't need it. Besides, you could do multiple inheritance then ("Remember, multiple inheritance is a beautiful thing!" )

  5. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: dynamic matrix of QStrings

    QVector is a template class itself, so it couldn't be a QObject.
    You are right of course, didn't really think it through...

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.