Results 1 to 1 of 1

Thread: Combo box is not showing any text by default

  1. #1
    Join Date
    Mar 2010
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Combo box is not showing any text by default

    Hi Everyone,
    I have designed a TreeView which has 5 columns in it. Out of five, one of them is combo box from where user can select the type of permission. I have used a delegate to display the combo box in the TreeView. TreeView is displaying the combo box with no text in it. I have attached an image which shows the current tree view screen grab.

    Untitled.jpg

    In the above image Accounts column is the combo box column.

    But when you click on one of your combo box then it shows the option that I set up as a default text. Code I have used for this is give below;

    Qt Code:
    1. QStyleOptionComboBox comboBoxOption;
    2. comboBoxOption.rect = Option.rect;
    3. comboBoxOption.currentText = StringToDisplay;
    4. //comboBoxOption.state = QStyle::State_HasFocus;
    5. QApplication::style()->drawComplexControl(QStyle::CC_ComboBox, &comboBoxOption, pPainter);
    To copy to clipboard, switch view to plain text mode 

    Here the StringToDisplay is the string to be displayed by default into the combo box which was retrieved from the Database.

    Any suggestion or thought, how to solve this problem?

    Thanks.
    Last edited by high_flyer; 1st February 2011 at 12:59. Reason: code tags

Similar Threads

  1. Set selected text in combo box
    By kode in forum Newbie
    Replies: 0
    Last Post: 27th December 2010, 11:06
  2. QSS, trying to make the text on the combo box WHITE not black.
    By technoViking in forum Qt Programming
    Replies: 3
    Last Post: 21st June 2010, 23:57
  3. Replies: 1
    Last Post: 18th November 2008, 17:41
  4. QLable::setText(text) is not showing the Text
    By ranna in forum Qt Programming
    Replies: 4
    Last Post: 14th November 2008, 09:39
  5. Qt class showing text area/text edit
    By maverick_pol in forum Qt Programming
    Replies: 4
    Last Post: 21st August 2008, 12:15

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.