1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706
|
/* -*- C++ -*-
This file is part of the KDE libraries
Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org)
(C) 1998-2001 Mirko Boehm (mirko@kde.org)
(C) 2007 John Layt <john@layt.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "kdatetable_p.h"
#include <QAction>
#include <QFontDatabase>
#include <QPainter>
#include <QStyle>
#include <QStyleOptionViewItem>
#include <QActionEvent>
#include <QApplication>
#include <QMenu>
#include <cmath>
class KDateTable::KDateTablePrivate
{
public:
KDateTablePrivate(KDateTable *q): q(q)
{
m_popupMenuEnabled = false;
m_useCustomColors = false;
m_hoveredPos = -1;
setDate(QDate::currentDate());
}
~KDateTablePrivate()
{
}
void setDate(const QDate &date);
void nextMonth();
void previousMonth();
void beginningOfMonth();
void endOfMonth();
void beginningOfWeek();
void endOfWeek();
KDateTable *q;
/**
* The currently selected date.
*/
QDate m_date;
/**
* The weekday number of the first day in the month [1..daysInWeek()].
*/
int m_weekDayFirstOfMonth;
/**
* The number of days in the current month.
*/
int m_numDaysThisMonth;
/**
* Save the size of the largest used cell content.
*/
QRectF m_maxCell;
/**
* How many week rows we are to draw.
*/
int m_numWeekRows;
/**
* How many day columns we are to draw, i.e. days in a week.
*/
int m_numDayColumns;
/**
* The font size of the displayed text.
*/
int fontsize;
bool m_popupMenuEnabled;
bool m_useCustomColors;
struct DatePaintingMode {
QColor fgColor;
QColor bgColor;
BackgroundMode bgMode;
};
QHash <int, DatePaintingMode> m_customPaintingModes;
int m_hoveredPos;
};
KDateTable::KDateTable(const QDate &date, QWidget *parent)
: QWidget(parent),
d(new KDateTablePrivate(this))
{
initWidget(date);
}
KDateTable::KDateTable(QWidget *parent)
: QWidget(parent),
d(new KDateTablePrivate(this))
{
initWidget(QDate::currentDate());
}
KDateTable::~KDateTable()
{
delete d;
}
void KDateTable::initWidget(const QDate &date)
{
d->m_numWeekRows = 7;
setFontSize(10);
setFocusPolicy(Qt::StrongFocus);
setBackgroundRole(QPalette::Base);
setAutoFillBackground(true);
initAccels();
setAttribute(Qt::WA_Hover, true);
setDate(date);
}
void KDateTable::initAccels()
{
QAction *next = new QAction(this);
next->setObjectName(QStringLiteral("next"));
next->setShortcuts(QKeySequence::keyBindings(QKeySequence::Forward));
next->setShortcutContext(Qt::WidgetWithChildrenShortcut);
connect(next, SIGNAL(triggered(bool)), SLOT(nextMonth()));
QAction *prior = new QAction(this);
prior->setObjectName(QStringLiteral("prior"));
prior->setShortcuts(QKeySequence::keyBindings(QKeySequence::Back));
prior->setShortcutContext(Qt::WidgetWithChildrenShortcut);
connect(prior, SIGNAL(triggered(bool)), SLOT(previousMonth()));
QAction *beginMonth = new QAction(this);
beginMonth->setObjectName(QStringLiteral("beginMonth"));
beginMonth->setShortcuts(QKeySequence::keyBindings(QKeySequence::MoveToStartOfDocument));
beginMonth->setShortcutContext(Qt::WidgetWithChildrenShortcut);
connect(beginMonth, SIGNAL(triggered(bool)), SLOT(beginningOfMonth()));
QAction *endMonth = new QAction(this);
endMonth->setObjectName(QStringLiteral("endMonth"));
endMonth->setShortcuts(QKeySequence::keyBindings(QKeySequence::MoveToEndOfDocument));
endMonth->setShortcutContext(Qt::WidgetWithChildrenShortcut);
connect(endMonth, SIGNAL(triggered(bool)), SLOT(endOfMonth()));
QAction *beginWeek = new QAction(this);
beginWeek->setObjectName(QStringLiteral("beginWeek"));
beginWeek->setShortcuts(QKeySequence::keyBindings(QKeySequence::MoveToStartOfLine));
beginWeek->setShortcutContext(Qt::WidgetWithChildrenShortcut);
connect(beginWeek, SIGNAL(triggered(bool)), SLOT(beginningOfWeek()));
QAction *endWeek = new QAction(this);
endWeek->setObjectName(QStringLiteral("endWeek"));
endWeek->setShortcuts(QKeySequence::keyBindings(QKeySequence::MoveToEndOfLine));
endWeek->setShortcutContext(Qt::WidgetWithChildrenShortcut);
connect(endWeek, SIGNAL(triggered(bool)), SLOT(endOfWeek()));
}
int KDateTable::posFromDate(const QDate &date)
{
int initialPosition = date.day();
int offset = (d->m_weekDayFirstOfMonth - locale().firstDayOfWeek() + d->m_numDayColumns) % d->m_numDayColumns;
// make sure at least one day of the previous month is visible.
// adjust this < 1 if more days should be forced visible:
if (offset < 1) {
offset += d->m_numDayColumns;
}
return initialPosition + offset;
}
QDate KDateTable::dateFromPos(int position)
{
int offset = (d->m_weekDayFirstOfMonth - locale().firstDayOfWeek() + d->m_numDayColumns) % d->m_numDayColumns;
// make sure at least one day of the previous month is visible.
// adjust this < 1 if more days should be forced visible:
if (offset < 1) {
offset += d->m_numDayColumns;
}
return QDate(d->m_date.year(), d->m_date.month(), 1).addDays(position - offset);
}
void KDateTable::paintEvent(QPaintEvent *e)
{
QPainter p(this);
const QRect &rectToUpdate = e->rect();
double cellWidth = width() / (double) d->m_numDayColumns;
double cellHeight = height() / (double) d->m_numWeekRows;
int leftCol = (int)std::floor(rectToUpdate.left() / cellWidth);
int topRow = (int)std::floor(rectToUpdate.top() / cellHeight);
int rightCol = (int)std::ceil(rectToUpdate.right() / cellWidth);
int bottomRow = (int)std::ceil(rectToUpdate.bottom() / cellHeight);
bottomRow = qMin(bottomRow, d->m_numWeekRows - 1);
rightCol = qMin(rightCol, d->m_numDayColumns - 1);
if (layoutDirection() == Qt::RightToLeft) {
p.translate((d->m_numDayColumns - leftCol - 1) * cellWidth, topRow * cellHeight);
} else {
p.translate(leftCol * cellWidth, topRow * cellHeight);
}
for (int i = leftCol; i <= rightCol; ++i) {
for (int j = topRow; j <= bottomRow; ++j) {
paintCell(&p, j, i);
p.translate(0, cellHeight);
}
if (layoutDirection() == Qt::RightToLeft) {
p.translate(-cellWidth, 0);
} else {
p.translate(cellWidth, 0);
}
p.translate(0, -cellHeight * (bottomRow - topRow + 1));
}
}
void KDateTable::paintCell(QPainter *painter, int row, int col)
{
double w = (width() / (double) d->m_numDayColumns) - 1;
double h = (height() / (double) d->m_numWeekRows) - 1;
QRectF cell = QRectF(0, 0, w, h);
QString cellText;
QPen pen;
QColor cellBackgroundColor, cellTextColor;
QFont cellFont = QFontDatabase::systemFont(QFontDatabase::GeneralFont);
bool workingDay = false;
int cellWeekDay, pos;
//Calculate the position of the cell in the grid
pos = d->m_numDayColumns * (row - 1) + col;
//Calculate what day of the week the cell is
if (col + locale().firstDayOfWeek() <= d->m_numDayColumns) {
cellWeekDay = col + locale().firstDayOfWeek();
} else {
cellWeekDay = col + locale().firstDayOfWeek() - d->m_numDayColumns;
}
//FIXME This is wrong if the widget is not using the global!
//See if cell day is normally a working day
if (locale().weekdays().first() <= locale().weekdays().last()) {
if (cellWeekDay >= locale().weekdays().first() &&
cellWeekDay <= locale().weekdays().last()) {
workingDay = true;
}
} else {
if (cellWeekDay >= locale().weekdays().first() ||
cellWeekDay <= locale().weekdays().last()) {
workingDay = true;
}
}
if (row == 0) {
//We are drawing a header cell
//If not a normal working day, then use "do not work today" color
if (workingDay) {
cellTextColor = palette().color(QPalette::WindowText);
} else {
cellTextColor = Qt::darkRed;
}
cellBackgroundColor = palette().color(QPalette::Window);
//Set the text to the short day name and bold it
cellFont.setBold(true);
cellText = locale().dayName(cellWeekDay, QLocale::ShortFormat);
} else {
//We are drawing a day cell
//Calculate the date the cell represents
QDate cellDate = dateFromPos(pos);
bool validDay = cellDate.isValid();
// Draw the day number in the cell, if the date is not valid then we don't want to show it
if (validDay) {
cellText = QString::number(cellDate.day());
} else {
cellText = QLatin1String("");
}
if (! validDay || cellDate.month() != d->m_date.month()) {
// we are either
// ° painting an invalid day
// ° painting a day of the previous month or
// ° painting a day of the following month or
cellBackgroundColor = palette().color(backgroundRole());
cellTextColor = palette().color(QPalette::Disabled, QPalette::Text);
} else {
//Paint a day of the current month
// Background Colour priorities will be (high-to-low):
// * Selected Day Background Colour
// * Customized Day Background Colour
// * Normal Day Background Colour
// Background Shape priorities will be (high-to-low):
// * Customized Day Shape
// * Normal Day Shape
// Text Colour priorities will be (high-to-low):
// * Customized Day Colour
// * Day of Pray Colour (Red letter)
// * Selected Day Colour
// * Normal Day Colour
//Determine various characteristics of the cell date
bool selectedDay = (cellDate == date());
bool currentDay = (cellDate == QDate::currentDate());
bool dayOfPray = (cellDate.dayOfWeek() == Qt::Sunday);
// TODO: Uncomment if QLocale ever gets the feature...
//bool dayOfPray = ( cellDate.dayOfWeek() == locale().dayOfPray() );
bool customDay = (d->m_useCustomColors && d->m_customPaintingModes.contains(cellDate.toJulianDay()));
//Default values for a normal cell
cellBackgroundColor = palette().color(backgroundRole());
cellTextColor = palette().color(foregroundRole());
// If we are drawing the current date, then draw it bold and active
if (currentDay) {
cellFont.setBold(true);
cellTextColor = palette().color(QPalette::LinkVisited);
}
// if we are drawing the day cell currently selected in the table
if (selectedDay) {
// set the background to highlighted
cellBackgroundColor = palette().color(QPalette::Highlight);
cellTextColor = palette().color(QPalette::HighlightedText);
}
//If custom colors or shape are required for this date
if (customDay) {
KDateTablePrivate::DatePaintingMode mode = d->m_customPaintingModes[cellDate.toJulianDay()];
if (mode.bgMode != NoBgMode) {
if (!selectedDay) {
cellBackgroundColor = mode.bgColor;
}
}
cellTextColor = mode.fgColor;
}
//If the cell day is the day of religious observance, then always color text red unless Custom overrides
if (! customDay && dayOfPray) {
cellTextColor = Qt::darkRed;
}
}
}
//Draw the background
if (row == 0) {
painter->setPen(cellBackgroundColor);
painter->setBrush(cellBackgroundColor);
painter->drawRect(cell);
} else if (cellBackgroundColor != palette().color(backgroundRole()) || pos == d->m_hoveredPos) {
QStyleOptionViewItem opt;
opt.initFrom(this);
opt.rect = cell.toRect();
if (cellBackgroundColor != palette().color(backgroundRole())) {
opt.palette.setBrush(QPalette::Highlight, cellBackgroundColor);
opt.state |= QStyle::State_Selected;
}
if (pos == d->m_hoveredPos && opt.state & QStyle::State_Enabled) {
opt.state |= QStyle::State_MouseOver;
} else {
opt.state &= ~QStyle::State_MouseOver;
}
opt.showDecorationSelected = true;
opt.viewItemPosition = QStyleOptionViewItem::OnlyOne;
style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, this);
}
//Draw the text
painter->setPen(cellTextColor);
painter->setFont(cellFont);
painter->drawText(cell, Qt::AlignCenter, cellText, &cell);
//Draw the base line
if (row == 0) {
painter->setPen(palette().color(foregroundRole()));
painter->drawLine(QPointF(0, h), QPointF(w, h));
}
// If the day cell we just drew is bigger than the current max cell sizes,
// then adjust the max to the current cell
if (cell.width() > d->m_maxCell.width()) {
d->m_maxCell.setWidth(cell.width());
}
if (cell.height() > d->m_maxCell.height()) {
d->m_maxCell.setHeight(cell.height());
}
}
void KDateTable::KDateTablePrivate::nextMonth()
{
// setDate does validity checking for us
q->setDate(m_date.addMonths(1));
}
void KDateTable::KDateTablePrivate::previousMonth()
{
// setDate does validity checking for us
q->setDate(m_date.addMonths(-1));
}
void KDateTable::KDateTablePrivate::beginningOfMonth()
{
// setDate does validity checking for us
q->setDate(QDate(m_date.year(), m_date.month(), 1));
}
void KDateTable::KDateTablePrivate::endOfMonth()
{
// setDate does validity checking for us
q->setDate(QDate(m_date.year(), m_date.month() + 1, 0));
}
// JPL Do these make the assumption that first day of week is weekday 1? As it may not be.
void KDateTable::KDateTablePrivate::beginningOfWeek()
{
// setDate does validity checking for us
q->setDate(m_date.addDays(1 - m_date.dayOfWeek()));
}
// JPL Do these make the assumption that first day of week is weekday 1? As it may not be.
void KDateTable::KDateTablePrivate::endOfWeek()
{
// setDate does validity checking for us
q->setDate(m_date.addDays(7 - m_date.dayOfWeek()));
}
void KDateTable::keyPressEvent(QKeyEvent *e)
{
switch (e->key()) {
case Qt::Key_Up:
// setDate does validity checking for us
setDate(d->m_date.addDays(- d->m_numDayColumns));
break;
case Qt::Key_Down:
// setDate does validity checking for us
setDate(d->m_date.addDays(d->m_numDayColumns));
break;
case Qt::Key_Left:
// setDate does validity checking for us
setDate(d->m_date.addDays(-1));
break;
case Qt::Key_Right:
// setDate does validity checking for us
setDate(d->m_date.addDays(1));
break;
case Qt::Key_Minus:
// setDate does validity checking for us
setDate(d->m_date.addDays(-1));
break;
case Qt::Key_Plus:
// setDate does validity checking for us
setDate(d->m_date.addDays(1));
break;
case Qt::Key_N:
// setDate does validity checking for us
setDate(QDate::currentDate());
break;
case Qt::Key_Return:
case Qt::Key_Enter:
emit tableClicked();
break;
case Qt::Key_Control:
case Qt::Key_Alt:
case Qt::Key_Meta:
case Qt::Key_Shift:
// Don't beep for modifiers
break;
default:
if (!e->modifiers()) { // hm
QApplication::beep();
}
}
}
void KDateTable::setFontSize(int size)
{
QFontMetricsF metrics(fontMetrics());
QRectF rect;
// ----- store rectangles:
d->fontsize = size;
// ----- find largest day name:
d->m_maxCell.setWidth(0);
d->m_maxCell.setHeight(0);
for (int weekday = 1; weekday <= 7; ++weekday) {
rect = metrics.boundingRect(locale().dayName(weekday, QLocale::ShortFormat));
d->m_maxCell.setWidth(qMax(d->m_maxCell.width(), rect.width()));
d->m_maxCell.setHeight(qMax(d->m_maxCell.height(), rect.height()));
}
// ----- compare with a real wide number and add some space:
rect = metrics.boundingRect(QStringLiteral("88"));
d->m_maxCell.setWidth(qMax(d->m_maxCell.width() + 2, rect.width()));
d->m_maxCell.setHeight(qMax(d->m_maxCell.height() + 4, rect.height()));
}
void KDateTable::wheelEvent(QWheelEvent *e)
{
setDate(d->m_date.addMonths(-(int)(e->delta() / 120)));
e->accept();
}
bool KDateTable::event(QEvent *ev)
{
switch (ev->type()) {
case QEvent::HoverMove: {
QHoverEvent *e = static_cast<QHoverEvent *>(ev);
const int row = e->pos().y() * d->m_numWeekRows / height();
int col;
if (layoutDirection() == Qt::RightToLeft) {
col = d->m_numDayColumns - (e->pos().x() * d->m_numDayColumns / width()) - 1;
} else {
col = e->pos().x() * d->m_numDayColumns / width();
}
const int pos = row < 1 ? -1 : (d->m_numDayColumns * (row - 1)) + col;
if (pos != d->m_hoveredPos) {
d->m_hoveredPos = pos;
update();
}
break;
}
case QEvent::HoverLeave:
if (d->m_hoveredPos != -1) {
d->m_hoveredPos = -1;
update();
}
break;
default:
break;
}
return QWidget::event(ev);
}
void KDateTable::mousePressEvent(QMouseEvent *e)
{
if (e->type() != QEvent::MouseButtonPress) { // the KDatePicker only reacts on mouse press events:
return;
}
if (!isEnabled()) {
QApplication::beep();
return;
}
int row, col, pos;
QPoint mouseCoord = e->pos();
row = mouseCoord.y() * d->m_numWeekRows / height();
if (layoutDirection() == Qt::RightToLeft) {
col = d->m_numDayColumns - (mouseCoord.x() * d->m_numDayColumns / width()) - 1;
} else {
col = mouseCoord.x() * d->m_numDayColumns / width();
}
if (row < 1 || col < 0) { // the user clicked on the frame of the table
return;
}
// Rows and columns are zero indexed. The (row - 1) below is to avoid counting
// the row with the days of the week in the calculation.
// new position and date
pos = (d->m_numDayColumns * (row - 1)) + col;
QDate clickedDate = dateFromPos(pos);
// set the new date. If it is in the previous or next month, the month will
// automatically be changed, no need to do that manually...
// validity checking done inside setDate
setDate(clickedDate);
// This could be optimized to only call update over the regions
// of old and new cell, but 99% of times there is also a call to
// setDate that already calls update() so no need to optimize that
// much here
update();
emit tableClicked();
if (e->button() == Qt::RightButton && d->m_popupMenuEnabled) {
QMenu *menu = new QMenu();
menu->addSection(locale().toString(d->m_date));
emit aboutToShowContextMenu(menu, clickedDate);
menu->popup(e->globalPos());
}
}
void KDateTable::KDateTablePrivate::setDate(const QDate &date)
{
m_date = date;
m_weekDayFirstOfMonth = QDate(date.year(), date.month(), 1).dayOfWeek();
m_numDaysThisMonth = m_date.daysInMonth();
m_numDayColumns = 7;
}
bool KDateTable::setDate(const QDate &toDate)
{
if (!toDate.isValid()) {
return false;
}
if (toDate == date()) {
return true;
}
QDate oldDate = date();
d->setDate(toDate);
emit(dateChanged(date(), oldDate));
emit(dateChanged(date()));
update();
return true;
}
const QDate &KDateTable::date() const
{
return d->m_date;
}
void KDateTable::focusInEvent(QFocusEvent *e)
{
QWidget::focusInEvent(e);
}
void KDateTable::focusOutEvent(QFocusEvent *e)
{
QWidget::focusOutEvent(e);
}
QSize KDateTable::sizeHint() const
{
if (d->m_maxCell.height() > 0 && d->m_maxCell.width() > 0) {
return QSize(qRound(d->m_maxCell.width() * d->m_numDayColumns),
(qRound(d->m_maxCell.height() + 2) * d->m_numWeekRows));
} else {
//qDebug() << "KDateTable::sizeHint: obscure failure - " << endl;
return QSize(-1, -1);
}
}
void KDateTable::setPopupMenuEnabled(bool enable)
{
d->m_popupMenuEnabled = enable;
}
bool KDateTable::popupMenuEnabled() const
{
return d->m_popupMenuEnabled;
}
void KDateTable::setCustomDatePainting(const QDate &date, const QColor &fgColor, BackgroundMode bgMode, const QColor &bgColor)
{
if (!fgColor.isValid()) {
unsetCustomDatePainting(date);
return;
}
KDateTablePrivate::DatePaintingMode mode;
mode.bgMode = bgMode;
mode.fgColor = fgColor;
mode.bgColor = bgColor;
d->m_customPaintingModes.insert(date.toJulianDay(), mode);
d->m_useCustomColors = true;
update();
}
void KDateTable::unsetCustomDatePainting(const QDate &date)
{
d->m_customPaintingModes.remove(date.toJulianDay());
if (d->m_customPaintingModes.isEmpty()) {
d->m_useCustomColors = false;
}
update();
}
#include "moc_kdatetable_p.cpp"
|