Hi everyone.
I developed the following main function:
#include <QtGui/QApplication>
#include <QPushButton>
#include <QCalendarWidget>
#include <QGraphicsDropShadowEffect>
int main(int argc, char *argv[])
{
w.resize(300, 300);
button
->setGeometry
(QRect(100,
30,
100,
40));
button->setStyleSheet("QPushButton { background-color: red; } QPushButton:hover { background-color: blue; }");
QGraphicsDropShadowEffect *effet = new QGraphicsDropShadowEffect(&w);
effet
->setColor
(QColor(0,
0,
0,
255));
effet->setBlurRadius(20);
button->setGraphicsEffect(effet);
//QCalendarWidget *calendrier = new QCalendarWidget(&w);
//calendrier->setGeometry(QRect(0, 100, 300, 200));
w.show();
return a.exec();
}
#include <QtGui/QApplication>
#include <QPushButton>
#include <QCalendarWidget>
#include <QGraphicsDropShadowEffect>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget w;
w.resize(300, 300);
QApplication::setStyle("Plastic");
QPushButton *button = new QPushButton("OK", &w);
button->setGeometry(QRect(100, 30, 100, 40));
button->setStyleSheet("QPushButton { background-color: red; } QPushButton:hover { background-color: blue; }");
QGraphicsDropShadowEffect *effet = new QGraphicsDropShadowEffect(&w);
effet->setColor(QColor(0, 0, 0, 255));
effet->setBlurRadius(20);
button->setGraphicsEffect(effet);
//QCalendarWidget *calendrier = new QCalendarWidget(&w);
//calendrier->setGeometry(QRect(0, 100, 300, 200));
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
It will give as result (normal = red & hover = blue), like this

QPushButton { background-color: red; } QPushButton:hover { background-color: blue; }
Now if we un comment the following two lines
QCalendarWidget * calendar = new QCalendarWidget (& w);
calendar-> addWidget (QRect (0, 100, 300, 200));
The code would be:
#include <QtGui/QApplication>
#include <QPushButton>
#include <QCalendarWidget>
#include <QGraphicsDropShadowEffect>
int main(int argc, char *argv[])
{
w.resize(300, 300);
button
->setGeometry
(QRect(100,
30,
100,
40));
button->setStyleSheet("QPushButton { background-color: red; } QPushButton:hover { background-color: blue; }");
QGraphicsDropShadowEffect *effet = new QGraphicsDropShadowEffect(&w);
effet
->setColor
(QColor(0,
0,
0,
255));
effet->setBlurRadius(20);
button->setGraphicsEffect(effet);
calendrier
->setGeometry
(QRect(0,
100,
300,
200));
w.show();
return a.exec();
}
#include <QtGui/QApplication>
#include <QPushButton>
#include <QCalendarWidget>
#include <QGraphicsDropShadowEffect>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget w;
w.resize(300, 300);
QApplication::setStyle("Plastic");
QPushButton *button = new QPushButton("OK", &w);
button->setGeometry(QRect(100, 30, 100, 40));
button->setStyleSheet("QPushButton { background-color: red; } QPushButton:hover { background-color: blue; }");
QGraphicsDropShadowEffect *effet = new QGraphicsDropShadowEffect(&w);
effet->setColor(QColor(0, 0, 0, 255));
effet->setBlurRadius(20);
button->setGraphicsEffect(effet);
QCalendarWidget *calendrier = new QCalendarWidget(&w);
calendrier->setGeometry(QRect(0, 100, 300, 200));
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
In running we'll find this:

So integrating the component QCalendarWidget (even QComboBox editable, table view, and others) the stylesheet of the button OK with effect would be inactive.
Now remove the effect of the OK button by commenting this line
button-> setGraphicsEffect (effect);
The code would be:
#include <QtGui/QApplication>
#include <QPushButton>
#include <QCalendarWidget>
#include <QGraphicsDropShadowEffect>
int main(int argc, char *argv[])
{
w.resize(300, 300);
button
->setGeometry
(QRect(100,
30,
100,
40));
button->setStyleSheet("QPushButton { background-color: red; } QPushButton:hover { background-color: blue; }");
QGraphicsDropShadowEffect *effet = new QGraphicsDropShadowEffect(&w);
effet
->setColor
(QColor(0,
0,
0,
255));
effet->setBlurRadius(20);
//button->setGraphicsEffect(effet);
calendrier
->setGeometry
(QRect(0,
100,
300,
200));
w.show();
return a.exec();
}
#include <QtGui/QApplication>
#include <QPushButton>
#include <QCalendarWidget>
#include <QGraphicsDropShadowEffect>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget w;
w.resize(300, 300);
QApplication::setStyle("Plastic");
QPushButton *button = new QPushButton("OK", &w);
button->setGeometry(QRect(100, 30, 100, 40));
button->setStyleSheet("QPushButton { background-color: red; } QPushButton:hover { background-color: blue; }");
QGraphicsDropShadowEffect *effet = new QGraphicsDropShadowEffect(&w);
effet->setColor(QColor(0, 0, 0, 255));
effet->setBlurRadius(20);
//button->setGraphicsEffect(effet);
QCalendarWidget *calendrier = new QCalendarWidget(&w);
calendrier->setGeometry(QRect(0, 100, 300, 200));
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
In running we'll find that the stylesheet function
So stylesheet "hover" + effect + Components "Qclaendar and other" = problem
The question is, how to resolve this problem?
thank you in advance
Bookmarks