Results 1 to 4 of 4

Thread: SOLVED: QVector<QWidget*> problem

  1. #1
    Join Date
    Jul 2009
    Posts
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default SOLVED: QVector<QWidget*> problem

    Hi All!

    This sounds pretty basic stuff but I'm having problem with QVector.

    I'm using Qt 4.5.2
    The code is below.

    in header:
    Qt Code:
    1. QVector<QWidget*> *m_activeWidgets;
    To copy to clipboard, switch view to plain text mode 


    in cpp:
    Qt Code:
    1. QWidget* widget = new QWidget();
    2. this->m_activeWidgets->append( widget );
    To copy to clipboard, switch view to plain text mode 

    result:
    It crashes on append method.
    in qvector.h

    paste:
    Qt Code:
    1. void QVector<T>::append(const T &t)
    2. {
    3. if (d->ref != 1 || d->size + 1 > d->alloc) { <--- at here *******************
    4. const T copy(t);
    5. realloc(d->size, QVectorData::grow(sizeOfTypedData(), d->size + 1, sizeof(T),
    6. QTypeInfo<T>::isStatic));
    7. if (QTypeInfo<T>::isComplex)
    8. new (d->array + d->size) T(copy);
    9. else
    10. d->array[d->size] = copy;
    11. } else {
    12. if (QTypeInfo<T>::isComplex)
    13. new (d->array + d->size) T(t);
    14. else
    15. d->array[d->size] = t;
    16. }
    17. ++d->size;
    18. }
    To copy to clipboard, switch view to plain text mode 
    paste:qbasicatomic.h

    Qt Code:
    1. inline bool operator!=(int value) const
    2. {
    3. return _q_value != value; <-- crash *******************
    4. }
    To copy to clipboard, switch view to plain text mode 

    I don't know is it any help but it seems like _q_value doesn't have any value in debugger.
    Any ideas?

    - Vectori
    Last edited by vectori; 7th July 2009 at 12:19. Reason: solved

  2. #2
    Join Date
    Jun 2008
    Location
    Germany/Belarus/Sweden
    Posts
    53
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QVector<QWidget*> problem

    have you forget to create your vector?
    Qt Code:
    1. m_activeWidgets = new QVector<QWidget*>();
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jul 2009
    Posts
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default SOLVED: QVector<QWidget*> problem

    Hi,

    Thanks for help!
    You were absolutely right! I hadn't create that QVector at all..
    Too much coding in busy gets thoughts messed up.

    Amazingly I used few hours solving this problem
    And I hadn't any clue at all.

    - Vectori

  4. #4
    Join Date
    Jun 2008
    Location
    Germany/Belarus/Sweden
    Posts
    53
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: SOLVED: QVector<QWidget*> problem

    Too much coding in busy gets thoughts messed up.
    that's for sure....

Similar Threads

  1. Replies: 1
    Last Post: 23rd April 2009, 09:05
  2. Replies: 19
    Last Post: 3rd April 2009, 23:17
  3. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  4. Problem with receiving events from QDateEdit
    By gunhelstr in forum Qt Programming
    Replies: 4
    Last Post: 20th April 2006, 11:21
  5. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.