Results 1 to 5 of 5

Thread: Problem with QVector

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Problem with QVector

    You'll need to check the backtrace of the crash.
    Maybe "m_leftItem" is not a valid pointer.

    Btw, no need to prefix member access with "this->", that is always implicit in C++

    Cheers,
    _

  2. #2
    Join Date
    Jul 2015
    Posts
    21
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    10

    Default Re: Problem with QVector

    Hmmm what do you mean with not valid? If I do something like "this->m_LeftItem.text();" its working and I get the text which was saved there.
    thats what I get from the Debugger.
    0 QVector<Connections>::append qvector.h 598 0x409d29
    1 QVector<Connections>:ush_back qvector.h 224 0x409ead
    2 MyQTableWidgetItem::setConnection myqtablewidgetitem.cpp 36 0x403a74
    3 SymbolButton::setCounterOnClick symbolbutton.cpp 68 0x403510
    4 SymbolButton::changeSymbol symbolbutton.cpp 18 0x402aab
    5 SymbolButton::qt_static_metacall moc_symbolbutton.cpp 92 0x4043e6
    6 QMetaObject::activate C:/Qt/5.4/mingw491_32/bin/Qt5Cored.dll 3717 0x6b95a575
    7 QMetaObject::activate C:/Qt/5.4/mingw491_32/bin/Qt5Cored.dll 3582 0x6b959eba
    8 QAbstractButton::clicked C:/Qt/5.4/mingw491_32/bin/Qt5Widgetsd.dll 298 0x9f720c3
    9 QAbstractButtonPrivate::emitClicked C:/Qt/5.4/mingw491_32/bin/Qt5Widgetsd.dll 534 0x9d353a9
    10 QAbstractButtonPrivate::click C:/Qt/5.4/mingw491_32/bin/Qt5Widgetsd.dll 527 0x9d35344
    11 QAbstractButton::mouseReleaseEvent C:/Qt/5.4/mingw491_32/bin/Qt5Widgetsd.dll 1132 0x9d36643
    12 QWidget::event C:/Qt/5.4/mingw491_32/bin/Qt5Widgetsd.dll 8657 0x9c73ecf
    13 QAbstractButton::event C:/Qt/5.4/mingw491_32/bin/Qt5Widgetsd.dll 1089 0x9d364b8
    14 QPushButton::event C:/Qt/5.4/mingw491_32/bin/Qt5Widgetsd.dll 673 0x9dc3942
    15 QApplicationPrivate::notify_helper C:/Qt/5.4/mingw491_32/bin/Qt5Widgetsd.dll 3720 0x9c3f4dd
    16 QApplication::notify C:/Qt/5.4/mingw491_32/bin/Qt5Widgetsd.dll 3280 0x9c3d61c
    17 QCoreApplication::notifyInternal C:/Qt/5.4/mingw491_32/bin/Qt5Cored.dll 935 0x6b92f330
    18 QCoreApplication::sendSpontaneousEvent C:/Qt/5.4/mingw491_32/bin/Qt5Widgetsd.dll 231 0x9f9ee85
    19 QApplicationPrivate::sendMouseEvent C:/Qt/5.4/mingw491_32/bin/Qt5Widgetsd.dll 2751 0x9c3c1a1
    ... <Mehr>
    Always if I want to put my struct in the QVector my program crash.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Problem with QVector

    When something like that crashes it usually means that "this" is not a valid instance.
    For example an uninitialized pointer or an already deleted object.

    In your SymbolButton::setCounterOnClick(), how do you get access to the item on which you then call setConnection?

    Cheers,
    _

  4. The following user says thank you to anda_skoa for this useful post:

    ReasyEasyPeasy (19th October 2015)

  5. #4
    Join Date
    Jul 2015
    Posts
    21
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    10

    Default Re: Problem with QVector

    I got it thanks!

Similar Threads

  1. Replies: 5
    Last Post: 3rd September 2011, 00:11
  2. QVector.push_back problem...
    By luche in forum Newbie
    Replies: 2
    Last Post: 11th January 2009, 03:22
  3. Problem regarding QVector
    By sudheer168 in forum Qt Programming
    Replies: 1
    Last Post: 6th December 2008, 12:56
  4. Problem with qvector
    By zorro68 in forum Qt Programming
    Replies: 1
    Last Post: 23rd February 2008, 02:02
  5. QVector problem
    By kingslee in forum Qt Programming
    Replies: 5
    Last Post: 19th October 2006, 11:42

Tags for this Thread

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.