先上效果图
代码:
QDateTimeEdit *start_time=new QDateTimeEdit(dataindex_widget);//
start_time->resize(175,34);
start_time->setStyleSheet("QDateTimeEdit{background:transparent;border:1px solid rgb(10, 120, 189);color:rgb(255,255,255);}QDateTimeEdit:hover,QDateTimeEdit:focus{background:transparent;border:1px solid rgb(10, 120, 189);color:rgb(255,255,255);}QDateTimeEdit:drop-down{image:url(:/new/prefix1/picture/pic/data/data_search/dataime.png);width:20px;}");
start_time->setFont(QFont("Microsoft YaHei",14));
QCalendarWidget* cale1=new QCalendarWidget;
cale1->setFixedSize(QSize(300,250));
start_time->setCalendarPopup(1);
start_time->setCalendarWidget(cale1);
cale1->setStyleSheet("#qt_calendar_calendarview {background-color: rgba(10, 95, 189,1);font: 12px;}QCalendarWidget QTableView {alternate-background-color:rgba(10, 95, 189, 1); color: rgba(255,255,255,1);}QCalendarWidget QToolButton {height: 30px;icon-size: 30px, 30px;}QCalendarWidget QWidget#qt_calendar_navigationbar{ background-color: rgba(4, 51, 114,1);}QCalendarWidget QToolButton#qt_calendar_prevmonth {qproperty-icon: url(:/new/prefix1/picture/pic/data/data_search/left.png);}QCalendarWidget QToolButton#qt_calendar_nextmonth {qproperty-icon: url(:/new/prefix1/picture/pic/data/data_search/right.png);}QCalendarWidget QAbstractItemView:enabled {font-size:12px; color: rgb(255, 255, 255); }QCalendarWidget QAbstractItemView:disabled { color: rgb(64, 64, 64); }QCalendarWidget QMenu {width: 100px;left: 20px;color: white;font-size: 12px;background-color: rgb(10, 95, 189);}");
QTextCharFormat format;
format.setForeground(QColor(255,255,255));
format.setBackground(QColor(10, 95, 189));
format.setFontFamily("Microsoft YaHei");
cale1->setWeekdayTextFormat(Qt::Saturday, format);
cale1->setWeekdayTextFormat(Qt::Sunday, format);