1
0
mirror of https://github.com/ElvishArtisan/rivendell.git synced 2025-05-16 17:02:58 +02:00

Fixed regression in Qt::Background

This commit is contained in:
Patrick Linstruth 2018-10-27 10:51:39 -07:00
parent 4f8a5278fd
commit dd54495c4e

@ -82,12 +82,12 @@ RDDatePicker::RDDatePicker(int low_year,int high_year,QWidget *parent)
// Date Labels // Date Labels
// //
QPalette weekend_palette=palette(); QPalette weekend_palette=palette();
weekend_palette.setColor(QPalette::Active,QColorGroup::Background, weekend_palette.setColor(QPalette::Active,QPalette::Background,
palette().color(QPalette::Active, palette().color(QPalette::Active,
QColorGroup::Mid)); QPalette::Mid));
weekend_palette.setColor(QPalette::Inactive,QColorGroup::Background, weekend_palette.setColor(QPalette::Inactive,QPalette::Background,
palette().color(QPalette::Active, palette().color(QPalette::Active,
QColorGroup::Mid)); QPalette::Mid));
QLabel *label=new QLabel(tr("Mo"),this,"monday_label"); QLabel *label=new QLabel(tr("Mo"),this,"monday_label");
label->setGeometry(RDDATEPICKER_X_ORIGIN,30,30,30); label->setGeometry(RDDATEPICKER_X_ORIGIN,30,30,30);
@ -124,6 +124,7 @@ RDDatePicker::RDDatePicker(int low_year,int high_year,QWidget *parent)
label->setFont(header_font); label->setFont(header_font);
label->setAlignment(Qt::AlignCenter); label->setAlignment(Qt::AlignCenter);
label->setPalette(weekend_palette); label->setPalette(weekend_palette);
label->setAutoFillBackground(true);
label=new QLabel(tr("Su"),this,"sunday_label"); label=new QLabel(tr("Su"),this,"sunday_label");
label->setGeometry(RDDATEPICKER_X_ORIGIN+RDDATEPICKER_X_INTERVAL*6, label->setGeometry(RDDATEPICKER_X_ORIGIN+RDDATEPICKER_X_INTERVAL*6,
@ -131,6 +132,7 @@ RDDatePicker::RDDatePicker(int low_year,int high_year,QWidget *parent)
label->setFont(header_font); label->setFont(header_font);
label->setAlignment(Qt::AlignCenter); label->setAlignment(Qt::AlignCenter);
label->setPalette(weekend_palette); label->setPalette(weekend_palette);
label->setAutoFillBackground(true);
for(int i=0;i<6;i++) { for(int i=0;i<6;i++) {
@ -140,6 +142,7 @@ RDDatePicker::RDDatePicker(int low_year,int high_year,QWidget *parent)
setGeometry(RDDATEPICKER_X_ORIGIN+RDDATEPICKER_X_INTERVAL*j, setGeometry(RDDATEPICKER_X_ORIGIN+RDDATEPICKER_X_INTERVAL*j,
RDDATEPICKER_Y_ORIGIN+20+RDDATEPICKER_Y_INTERVAL*i,30,30); RDDATEPICKER_Y_ORIGIN+20+RDDATEPICKER_Y_INTERVAL*i,30,30);
pick_date_label[i][j]->setAlignment(Qt::AlignTop|Qt::AlignHCenter); pick_date_label[i][j]->setAlignment(Qt::AlignTop|Qt::AlignHCenter);
pick_date_label[i][j]->setAutoFillBackground(true);
} }
} }
PrintDays(); PrintDays();
@ -265,12 +268,12 @@ void RDDatePicker::PrintDays()
// Clear Days // Clear Days
// //
QPalette weekend_palette=palette(); QPalette weekend_palette=palette();
weekend_palette.setColor(QPalette::Active,QColorGroup::Background, weekend_palette.setColor(QPalette::Active,QPalette::Background,
palette().color(QPalette::Active, palette().color(QPalette::Active,
QColorGroup::Mid)); QPalette::Mid));
weekend_palette.setColor(QPalette::Inactive,QColorGroup::Background, weekend_palette.setColor(QPalette::Inactive,QPalette::Background,
palette().color(QPalette::Active, palette().color(QPalette::Active,
QColorGroup::Mid)); QPalette::Mid));
for(int i=0;i<6;i++) { for(int i=0;i<6;i++) {
for(int j=0;j<5;j++) { for(int j=0;j<5;j++) {
pick_date_label[i][j]->clear(); pick_date_label[i][j]->clear();
@ -324,26 +327,26 @@ void RDDatePicker::SelectDay(int day,int dow_offset,bool state)
int dow=slot-7*week; int dow=slot-7*week;
QPalette pal=palette(); QPalette pal=palette();
if(state) { if(state) {
pal.setColor(QPalette::Active,QColorGroup::Foreground, pal.setColor(QPalette::Active,QPalette::Foreground,
palette(). palette().
color(QPalette::Active,QColorGroup::HighlightedText)); color(QPalette::Active,QPalette::HighlightedText));
pal.setColor(QPalette::Active,QColorGroup::Background, pal.setColor(QPalette::Active,QPalette::Background,
palette().color(QPalette::Active,QColorGroup::Highlight)); palette().color(QPalette::Active,QPalette::Highlight));
pal.setColor(QPalette::Inactive,QColorGroup::Foreground, pal.setColor(QPalette::Inactive,QPalette::Foreground,
palette(). palette().
color(QPalette::Active,QColorGroup::HighlightedText)); color(QPalette::Active,QPalette::HighlightedText));
pal.setColor(QPalette::Inactive,QColorGroup::Background, pal.setColor(QPalette::Inactive,QPalette::Background,
palette().color(QPalette::Active,QColorGroup::Highlight)); palette().color(QPalette::Active,QPalette::Highlight));
} }
else { else {
pal.setColor(QPalette::Active,QColorGroup::Foreground, pal.setColor(QPalette::Active,QPalette::Foreground,
palette().color(QPalette::Active,QColorGroup::Text)); palette().color(QPalette::Active,QPalette::Text));
pal.setColor(QPalette::Active,QColorGroup::Background, pal.setColor(QPalette::Active,QPalette::Background,
palette().color(QPalette::Active,QColorGroup::Background)); palette().color(QPalette::Active,QPalette::Background));
pal.setColor(QPalette::Inactive,QColorGroup::Foreground, pal.setColor(QPalette::Inactive,QPalette::Foreground,
palette().color(QPalette::Active,QColorGroup::Text)); palette().color(QPalette::Active,QPalette::Text));
pal.setColor(QPalette::Inactive,QColorGroup::Background, pal.setColor(QPalette::Inactive,QPalette::Background,
palette().color(QPalette::Active,QColorGroup::Background)); palette().color(QPalette::Active,QPalette::Background));
} }
pick_date_label[week][dow]->setPalette(pal); pick_date_label[week][dow]->setPalette(pal);
} }