Results 1 to 20 of 21

Thread: Custom Combobox

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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: Custom Combobox

    Hi,

    I said the wrong word I guess. I meant the border around my combobox.

    I'm using motifstyle and once I apply this ;

    ::drop-down::down-arrow{image: url(mycustomicon.PNG)}

    the combobox's down arrow takes my new icon but the combobox itself appears like borderless.

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

    Default Re: Custom Combobox

    If you use stylesheets, the current style gets replaced with a dynamically created one which acts as a proxy between the base style and the widget. Then it might happen you lose more of the default style then what you'd like. In this situation you have to use stylesheets to style the widget more - in your case bring back the frame (using the "border" css property).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    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: Custom Combobox

    Hi,

    I already did what you said about using "border" property.

    I have tried both of the following ways to achieve my goal;

    1- ::drop-down{border-style: outset; border-width:1px}

    2- ::drop-down::down-arrow{image: url(mycustomicon.PNG); border-style: outset; border-width: 1px}

    But both ways only cover around my down-arrow icon not the combobox

  4. #4
    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: Custom Combobox

    Problem solved!

    first way works with some minor changes.

    But now, I couldn't access the combobox items to give them style. What I want to do is when I click the drop-down, the list of items appeared changes it's background color. I looked at the docs but couldn't find a solution.
    Last edited by zgulser; 28th April 2009 at 09:43.

  5. #5
    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: Custom Combobox

    Any ideas?

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

    Default Re: Custom Combobox

    Quote Originally Posted by zgulser View Post
    Any ideas?
    Is there a question here somewhere?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    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: Custom Combobox

    Yes there is,

    I want to access the background of the combobox when the drop-down button is clicked.

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

    Default Re: Custom Combobox

    The component is a listview (by default) so you have to style it as it was a QListView.

    css Code:
    1. QListView { background: red; }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    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: Custom Combobox

    Thanks mate!

  10. #10
    Join Date
    Apr 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Custom Combobox

    Hi all,
    I am new to Qt and i am facing problem regarding drop down list of combo box. By default there is a drop down list in which i can add the items using the form.
    Instead of that default drop down list image i want to have my own image, which popups when i click the combo box.

    Thanks in advance.

Similar Threads

  1. Replies: 2
    Last Post: 16th May 2008, 14:39
  2. Custom widget
    By zorro68 in forum Qt Programming
    Replies: 7
    Last Post: 28th January 2008, 14:06
  3. Custom proxy model issue
    By Khal Drogo in forum Qt Programming
    Replies: 13
    Last Post: 30th November 2007, 12:41
  4. custom plug-in widget in another custom plug-in widget.
    By MrGarbage in forum Qt Programming
    Replies: 6
    Last Post: 27th August 2007, 15:38
  5. Filling combobox from database
    By Philip_Anselmo in forum Qt Programming
    Replies: 3
    Last Post: 11th May 2006, 17:53

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.