Results 1 to 6 of 6

Thread: QCalendar Widget styling

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Jul 2008
    Posts
    139
    Thanks
    9
    Thanked 18 Times in 15 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QCalendar Widget styling

    As requested here is my stylesheet. It was customized for color and icons, mainly I needed larger selectors (arrows, and tool menu) since I am using a touchscreen and not a mouse. When I touch the month, the pop menu appears.
    I had a difficult time getting the next/previous months icons working so qt supported suggested this.
    Qt Code:
    1. QToolButton *btn = calendar->findChild<QToolButton *>("qt_calendar_prevmonth");
    2. QIcon icon;
    3. icon.addPixmap(QPixmap(QString::fromUtf8(PREVMONTHBUTTON_N)), QIcon::Normal, QIcon::On);
    4. icon.addPixmap(QPixmap(QString::fromUtf8(PREVMONTHBUTTON_S)), QIcon::Active, QIcon::On);
    5. icon.addPixmap(QPixmap(QString::fromUtf8(PREVMONTHBUTTON_S)), QIcon::Selected, QIcon::On);
    6. btn->setIcon(icon);
    7. btn = calendar->findChild<QToolButton *>("qt_calendar_nextmonth");
    8. ....
    To copy to clipboard, switch view to plain text mode 
    StyleSheet, there are some style widgets that are blank, just ignore them.
    Qt Code:
    1. calendar->setStyleSheet("QMenu { font-size:16px; width: 150px; left: 20px; background-
    2. color:qlineargradient(x1:0, y1:0, x2:0, y2:1, stop: 0 #cccccc, stop: 1 #333333);}
    3. QToolButton {icon-size: 48px, 48px;background-color: qlineargradient(x1:0, y1:0, x2:0,
    4. y2:1, stop: 0 #cccccc, stop: 1 #333333);
    5. height: 100px; width: 200px;}
    6. QAbstractItemView {selection-background-color: rgb(255, 174, 0);}
    7. QToolButton::menu-arrow {}
    8. QToolButton::menu-button {}
    9. QToolButton::menu-indicator{width: 50px;}
    10. QToolButton::menu-indicator:pressed,
    11. QToolButton::menu-indicator:open{top:10px; left: 10px;}
    12. QListView {background-color:white;}
    13. QSpinBox {width:200px; border-width: 2px;}
    14. QSpinBox::up-button { subcontrol-origin: border;
    15. subcontrol-position: top right; width:50px; border-image: url(icons:arrow_up_n.png);}
    16. QSpinBox::down-button {subcontrol-origin: border; subcontrol-position: bottom right;
    17. border-width: 1px; width:50px;}
    18. QSpinBox::down-arrow { width:26px; height:17px;
    19. image: url(icons:arrow_down_n.png); } ")
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

  2. The following 4 users say thank you to QbelcorT for this useful post:

    Alex Snet (16th April 2009), Serenity (10th December 2010), succorguy (18th April 2009), Tomasz (7th December 2010)

Similar Threads

  1. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 07:06
  2. Widget Focus
    By navi1084 in forum Qt Programming
    Replies: 6
    Last Post: 29th September 2008, 10:22
  3. Playbutton functionality
    By uchennaanyanwu in forum Qt Programming
    Replies: 5
    Last Post: 31st July 2008, 22:29
  4. How to Open & Close a Widget ?!!
    By Fatla in forum Qt Programming
    Replies: 6
    Last Post: 13th June 2008, 20:39
  5. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35

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.