Results 1 to 5 of 5

Thread: How to make Custom Combobox ?

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

    Default How to make Custom Combobox ?

    Hi,

    I am trying to create a combo box using QLineEdit, QGraphicsWidget for pop down list and arrow image for drop-down/up arrow and some how got success in simulating combobox partially. But I am not able to insert text in the list view. It is also required that, if list is empty,
    combo box should not show, drop down arrow. Please suggest How can I do that.

    Regards,
    mani

  2. #2
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: How to make Custom Combobox ?

    It is also required that, if list is empty,
    combo box should not show, drop down arrow
    To do this, you need to play with style sheets. You have to do something like;

    if list is empty

    QComboBox::drop-down::down-arrow {

    image: url{/*nothing or empty image file*/}
    }

    else

    QComboBox::drop-down::down-arrow {

    image: url{/*default image*/}
    }

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

    Default Re: How to make Custom Combobox ?

    Thanx zgulser for prompt reply.

    I will try to implement it, but what should I use for inserting items in combobox.

    mani

  4. #4
    Join Date
    Feb 2010
    Posts
    96
    Thanks
    4
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to make Custom Combobox ?

    Just curious .. do you really need to go that way around or is this something that you want to accomplish?

    With a QComboBox you can use setEditable(True) and the ComboBox will be editable. If you want the drop down arrow not visible when their are no items, then you can turn the QComboBox into a QLineEdit until more items are available.

    That's my two cents.

  5. #5
    Join Date
    Dec 2011
    Posts
    13
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to make Custom Combobox ?

    Hi zgulser,

    this is working fine..

    but this code has problem that another style sheet colour change property is not use in runtime so you have any option for that both the property i will use in the combo box

    kinjal.


    Added after 28 minutes:


    Hi zgulser,

    I want to also ask that how to remove side bar that shown after hide down arrow in the combo box. as shown in figure how off centre the combo box item.Screenshot-1.png


    Added after 5 minutes:


    Hi zgulser ,

    I want to also ask how to remove side bar and make item of combo box in centre ... I have problem of off centre the item in combo box as shown in figure...
    please help me out in this...

    Screenshot-1.png
    Last edited by kinjalp; 15th February 2012 at 05:01.

Similar Threads

  1. Custom Combobox
    By zgulser in forum Qt Programming
    Replies: 20
    Last Post: 4th April 2012, 10:13
  2. How to make table headers with custom background?
    By kremuwa in forum Qt Programming
    Replies: 1
    Last Post: 14th March 2010, 16:51
  3. Custom Model? Custom View? Custom Delegate?
    By Doug Broadwell in forum Newbie
    Replies: 4
    Last Post: 11th February 2010, 20:23
  4. Replies: 2
    Last Post: 4th December 2009, 09:38
  5. Custom action added to make by qmake
    By NTwoO in forum Qt Programming
    Replies: 2
    Last Post: 2nd March 2007, 10:17

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.