Results 1 to 3 of 3

Thread: QComboBox problem

  1. #1
    Join Date
    Jan 2009
    Location
    Midlands UK
    Posts
    62
    Thanks
    6
    Thanked 9 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question QComboBox problem

    Hi,
    I've a recurring problem with QComboBox's causing a program crash.
    I am using QCreator 0.9.2 RC1 and am building a QMainWindow which then calls a QIODevice class which then calls a QDialog class, the QComboBox's are in the QDialog class. If I use a QComboBox access like say ComboBox->setCurrentIndex(2) anywhere but in the function where the QComboBox is created then the program will crash when it reaches that point.
    I built a minimal test program of the above layout which always worked but as soon as I add lots of elements the program will always crash.
    Does anyone have a handle as to where I'm going wrong ???
    A sample of the program is listed below with virtualy everything stripped out but still able to crash everytime.
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QComboBox problem

    This one assigns to a local variable, leaving the member variable uninitialized:
    Qt Code:
    1. QComboBox *PortSel = new QComboBox() ;
    To copy to clipboard, switch view to plain text mode 
    This one assigns to the member variable:
    Qt Code:
    1. PortSel = new QComboBox() ;
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. #3
    Join Date
    Jan 2009
    Location
    Midlands UK
    Posts
    62
    Thanks
    6
    Thanked 9 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Red face Re: QComboBox problem

    Thanks jpn !

    It's blindingly obvious when you pointed it out (I'll give myself a slap now) and I know exactly where I did it (cut & paste from the header file) but I just couldn't see the wood for the trees !

Similar Threads

  1. QCombobox showPopup problem
    By SailinShoes in forum Qt Programming
    Replies: 2
    Last Post: 21st August 2008, 11:16
  2. QComboBox problem
    By ^NyAw^ in forum Qt Programming
    Replies: 4
    Last Post: 31st March 2008, 11:43
  3. Problem while using QComboBox
    By merry in forum Qt Programming
    Replies: 6
    Last Post: 20th December 2007, 10:22
  4. Problem with QComboBox
    By jogeshwarakundi in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 8th December 2007, 13:21

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.