Page 1 of 2 12 LastLast
Results 1 to 20 of 21

Thread: Custom Combobox

  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 Custom Combobox

    Hi,

    I want to make invisible the combobox down-arrow. I tried to do that from the setStyleSheet by using down-arrow sub-control but I couldn't do it.

    ::down-arrow{image: url(none.jpg);}

    I now trying paintEvent with drawControl thing. I might go wrong but I couldn't find another way upto now.

    Thanks in advance.
    Last edited by zgulser; 16th April 2009 at 09:59.

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

    How do you intend to open the combobox without the arrow?
    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

    I want only the down-arrow to disappear. The little rect just under the down-arrow which appears in the MotifStyle must stay where it is. I guess they are together the down-arrow from your message. Even if it is so, I tried to change the image of the down-arrow (i.e. combobox.png instead none.png) but nothing changes.

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

    What is the complete stylesheet you tried and what did you apply it on?
    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.


  5. #5
    Join Date
    Jan 2007
    Posts
    201
    Thanks
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Custom Combobox

    Why dont you just use QLineEdit and QCompleter::PopupCompletion if you dont need arraws. I will just behave like combo?

  6. #6
    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

    all is the following

    ::down-arrow{image: url(none.jpg);

    and I want to apply it on QCombobox as usual.

  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

    Any ideas?

  8. #8
    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 wonder why the following doesn't work...I tried it from the designer just like that but it did not work.
    Maybe I'm missing something or maybe it's qt's bug. Please help about this situation.

    ::down-arrow {
    subcontrol-origin: content;
    subcontrol-position: center;
    position: relative;
    left: 1px; /* 1 pixel dropdown border */
    }

  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

    Hi again,

    I solve my initial problem by doing

    ::drop-down::down-arrow instead of ::down-arrow only, but this time I lost the frame around my combobox...!

  10. #10
    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?

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

    Which frame? Which widget style are you using?
    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.


  12. #12
    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.

  13. #13
    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: 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.


  14. #14
    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

  15. #15
    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.

  16. #16
    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?

  17. #17
    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: 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.


  18. #18
    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.

  19. #19
    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: 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.


  20. #20
    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!

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.