I am writing my own implementation of QCalendarWidget. I want dates to be selected, but I don't want to see the default selection rectangle. It looks like this:

And my code is:
in constructor: setSelectionMode(SingleSelection);
void ShiftCalendar::paintCell(QPainter *painter, const QRect &rect, const QDate &date) const
{
if(date == selectedDate()) {
fillCell(painter, rect, CalendarWidget::cellFillColor);
}
drawCellText(painter, rect, QString::number(date.day()), color);
}
void ShiftCalendar::fillCell(QPainter *painter, const QRect &rect, const QColor &color) const
{
painter->save();
painter->setRenderHint(QPainter::Antialiasing);
painter->setPen(QPen(color));
painter->setBrush(QBrush(color));
painter->drawEllipse(fRect.center(), rect.width() / 2, rect.height() / 2);
painter->restore();
}
What can I do?
The second problem, as can be seen in the figure, is the small button icons and list icons. It looks great on the desktop, but on Android it is small all the time. Resizing the icon has no effect.
EDIT:
The first problem was solved by adding selection-background-color: rgba(0, 0, 0, 0);a widget to the stylesheet. The second has not yet been resolved.
source
share