Results 1 to 2 of 2

Thread: QSpinbox styling help

  1. #1
    Join Date
    Sep 2015
    Qt products

    Default QSpinbox styling help

    Hi all,
    I'm trying to change a QSpinbox style to match the style in the attached image.
    So far I was able to get a very bad result using the code below for the parent's stylesheet.
    There are plenty of problems with the current implementation but the main one I'm trying to deal with right now is how to add the background image to the spinbox value only without affecting the arrows or the suffix.
    any ideas?

    Attached are:
    the target design, the current result and various files used in the stylesheet.

    Qt Code:
    1. setStyleSheet(styleSheet() +"QSpinBox { "
    2. "padding-left: 50px; "
    3. "padding-top: 25px; "
    4. "padding-bottom: 25px; "
    5. "font-size:30px;"
    6. "background: url(:/icons/resources/spinbox_bg.png) no-repeat;"
    7. "background-size: 10px 10px;"
    8. "background-position: top center;"
    9. "background-origin:content;"
    10. "border: 1px solid #385d8a;} "
    11. );
    13. setStyleSheet(styleSheet() + "QSpinBox::down-button {"
    14. "image: url(:/icons/resources/arrowDown.png);"
    15. "subcontrol-position: top left; width: 40px; height: 40px;"
    16. "border: 1px solid black;"
    17. "padding:0px;"
    18. "margin:0px;"
    19. "}");
    21. setStyleSheet(styleSheet() + "QSpinBox::up-button {"
    22. "image: url(:/icons/resources/arrowUp.png);"
    23. "subcontrol-position: bottom left; width: 40px; height: 40px;"
    24. "border: 1px solid black;"
    25. "padding:0px;"
    26. "margin:0px;"
    27. "}");
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

  2. #2
    Join Date
    Oct 2019
    Qt products
    Qt3 Qt4 Qt5
    MacOS X Unix/X11 Windows

    Default Re: QSpinbox styling help

    There is some example of QSpinBox stylesheet here :

Similar Threads

  1. QTabBar styling
    By miso in forum Qt Programming
    Replies: 2
    Last Post: 9th July 2013, 09:20
  2. Styling QComboBox and QSpinBox
    By pafcu in forum Qt Programming
    Replies: 0
    Last Post: 18th December 2010, 14:42
  3. Styling a tab bar without frame
    By longh in forum Qt Programming
    Replies: 2
    Last Post: 15th August 2008, 16:02
  4. Styling a QTabWidget
    By chuckshaw in forum Qt Programming
    Replies: 1
    Last Post: 18th February 2008, 20:17
  5. QComboBox styling
    By Oleg in forum Qt Programming
    Replies: 3
    Last Post: 25th November 2007, 23:48


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.