Results 1 to 7 of 7

Thread: Problem while using QComboBox

  1. #1
    Join Date
    Jan 2007
    Posts
    326
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Problem while using QComboBox

    Hi all

    Working on Qt4.2 .

    Actually I am having problem with the QCombobox

    I am trying to insert list of drives in my system at runtime.

    All the list of drives are inserted in the QComboBox ,but if the item is one ,it displays the space for two items , and if the items are two ,it displays the space for four items ,
    I dont understand why it is so:

    I had done like this:

    Qt Code:
    1. void ShowDrivesinCombo()
    2. {
    3. Combo_SelectDrive->clear();
    4. DriveInfo *m_pDriveInfo = NULL;
    5. m_pDriveInfo = pDriveListStart;
    6.  
    7. while(m_pDriveInfo)
    8. {
    9. m_strDrivesInfoList<< tr((const char *) m_pDriveInfo->DisplayLable);
    10. m_pDriveInfo = m_pDriveInfo->next;
    11. }
    12. Combo_SelectDrive->addItems(m_strDrivesInfoList);
    13. Combo_SelectDrive->setEditable(false);
    14. Combo_SelectDrive->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    15.  
    16. }
    To copy to clipboard, switch view to plain text mode 


    Pls tell me wat to do now?

    Thanx
    Always Believe in Urself
    Merry

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

    Default Re: Problem while using QComboBox

    Maybe m_strDrivesInfoList is not empty?

  3. #3
    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: Problem while using QComboBox

    or maybe for some reason m_pDriveInfo->DisplayLable delivers an empty node after each full one?
    Wait... do you mean the size of the combo box - as in its width? or the size of the drop down list?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  4. #4
    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: Problem while using QComboBox

    Perhaps you should use QDir::drives()?
    J-P Nurmi

  5. #5
    Join Date
    Jan 2007
    Posts
    326
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Problem while using QComboBox

    Hi all

    Again while using QComboBox I got another problem.

    I am working on a dialog Based application

    At run Time , I am adding items in the QComboBox , in one dialog , After selecting item from the QComboBox , I switch over to another dialog and while moving on another dialog , then the process runs according to the item selected from the QComboBox.

    If I select Second item from the QComboBox , and then runs the process in another dialog always runs according to the first item and not the item that is selected by me.

    I dont understand what to do

    Regards
    Last edited by merry; 20th December 2007 at 09:55. Reason: spelling error
    Always Believe in Urself
    Merry

  6. #6
    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: Problem while using QComboBox

    Do you use the current index anyhow?
    J-P Nurmi

  7. #7
    Join Date
    Jan 2007
    Posts
    326
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Problem while using QComboBox

    Yaa , Thanx my Problem is solved.
    Always Believe in Urself
    Merry

Similar Threads

  1. Problem with QComboBox
    By jogeshwarakundi in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 8th December 2007, 13:21
  2. QComboBox drop list button events
    By maird in forum Qt Programming
    Replies: 5
    Last Post: 20th October 2007, 19:25
  3. using QComboBox as an ItemView
    By EricTheFruitbat in forum Qt Programming
    Replies: 3
    Last Post: 24th January 2007, 16:14
  4. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  5. 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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.