Details
-
Suggestion
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.4.0
-
None
Description
There should be an easy way of changing the font of the Month and Year ToolButtons in the QCalandarWidget.
At the moment the only way to do this seems to be to use findChildren, and this creates a solution that relies on internal design of the widget and may change with any release of Qt.
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QCalendarWidget qcalendarwidget;
QFont font ("Helvetica [Cronyx]",20);
QTextCharFormat format;
qcalendarwidget.setHeaderTextFormat(format);
QToolButton *button;
QList<QToolButton *> allTButtons = qcalendarwidget.findChildren<QToolButton *>();
if (allTButtons.count() != 0)
{ qDebug() << allTButtons.count() << " buttons found!"; allTButtons[2]->setFont(font); }else
{ qDebug() << "button was null"; }qcalendarwidget.show();
return app.exec();
}