Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37737900
en ru br
Репозитории ALT
S:4.8.7-alt25
5.1: 4.6.3-alt1.M51.1
4.1: 4.4.3-alt1.M41.1
4.0: 4.3.4-alt5.M40.1
3.0: 4.0.1-alt1
+updates:4.0.1-alt2
+backports:4.2.3-alt7.1.M30
www.altlinux.org/Changes

Группа :: Система/Библиотеки
Пакет: qt4

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: qt-4.3.3-alt-qcalendar-show-day-on-navbar.patch
Скачать


--- qt-x11-opensource-src-4.3.3/src/gui/widgets/qcalendarwidget.cpp~	2007-12-04 19:43:04 +0300
+++ qt-x11-opensource-src-4.3.3/src/gui/widgets/qcalendarwidget.cpp	2008-01-11 18:45:05 +0300
@@ -864,7 +864,7 @@ public:
         return true;
     }
 
-    void showMonth(int year, int month);
+    void showMonth(int year, int month, int monthday);
     void setDate(const QDate &d);
 
     void setMinimumDate(const QDate &date);
@@ -899,6 +899,7 @@ public:
     QDate maximumDate;
     int shownYear;
     int shownMonth;
+    int shownMonthDay;
     Qt::DayOfWeek m_firstDay;
     QCalendarWidget::HorizontalHeaderFormat horizontalHeaderFormat;
     bool m_weekNumbersShown;
@@ -949,6 +950,7 @@ QCalendarModel::QCalendarModel(QObject *
     maximumDate = QDate(7999, 12, 31);
     shownYear = date.year();
     shownMonth = date.month();
+    shownMonthDay = date.day();
     m_firstDay = Qt::Sunday;
     horizontalHeaderFormat = QCalendarWidget::ShortDayNames;
     m_weekNumbersShown = true;
@@ -1164,13 +1166,14 @@ void QCalendarModel::setDate(const QDate
         date = maximumDate;
 }
 
-void QCalendarModel::showMonth(int year, int month)
+void QCalendarModel::showMonth(int year, int month, int monthday)
 {
-    if (shownYear == year && shownMonth == month)
+    if (shownYear == year && shownMonth == month && shownMonthDay == monthday)
         return;
 
     shownYear = year;
     shownMonth = month;
+    shownMonthDay = monthday;
 
     internalUpdate();
 }
@@ -1592,7 +1595,7 @@ class QCalendarWidgetPrivate : public QW
 public:
     QCalendarWidgetPrivate();
 
-    void showMonth(int year, int month);
+    void showMonth(int year, int month, int monthday);
     void update();
     void paintCell(QPainter *painter, const QRect &rect, const QDate &date) const;
 
@@ -1619,6 +1622,7 @@ public:
 
     QToolButton *nextMonth;
     QToolButton *prevMonth;
+    QCalToolButton *monthDayButton;
     QCalToolButton *monthButton;
     QMenu *monthMenu;
     QMap<int, QAction *> monthToAction;
@@ -1687,6 +1691,9 @@ void QCalendarWidgetPrivate::createNavig
     prevMonth->setFocusProxy(m_view);
     nextMonth->setFocusProxy(m_view);
 
+    monthDayButton = new QCalToolButton(navBarBackground);
+    monthDayButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
+    monthDayButton->setAutoRaise(true);
 
     monthButton = new QCalToolButton(navBarBackground);
     monthButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
@@ -1707,6 +1714,7 @@ void QCalendarWidgetPrivate::createNavig
 
     QFont font = q->font();
     font.setBold(true);
+    monthDayButton->setFont(font);
     monthButton->setFont(font);
     yearButton->setFont(font);
     yearEdit->setFrame(false);
@@ -1720,6 +1728,7 @@ void QCalendarWidgetPrivate::createNavig
     headerLayout->setSpacing(0);
     headerLayout->addWidget(prevMonth);
     headerLayout->insertStretch(headerLayout->count());
+    headerLayout->addWidget(monthDayButton);
     headerLayout->addWidget(monthButton);
     headerLayout->addItem(spaceHolder);
     headerLayout->addWidget(yearButton);
@@ -1732,16 +1741,18 @@ void QCalendarWidgetPrivate::createNavig
     nextMonth->setFocusPolicy(Qt::NoFocus);
     yearButton->setFocusPolicy(Qt::NoFocus);
     monthButton->setFocusPolicy(Qt::NoFocus);
+    monthDayButton->setFocusPolicy(Qt::NoFocus);
 
     //set names for the header controls.
     prevMonth->setObjectName(QLatin1String("qt_calendar_prevmonth"));
     nextMonth->setObjectName(QLatin1String("qt_calendar_nextmonth"));
+    monthDayButton->setObjectName(QLatin1String("qt_calendar_daybutton"));
     monthButton->setObjectName(QLatin1String("qt_calendar_monthbutton"));
     yearButton->setObjectName(QLatin1String("qt_calendar_yearbutton"));
     yearEdit->setObjectName(QLatin1String("qt_calendar_yearedit"));
 
     updateMonthMenu();
-    showMonth(m_model->date.year(),m_model->date.month());
+    showMonth(m_model->date.year(),m_model->date.month(),m_model->date.day());
 }
 
 void QCalendarWidgetPrivate::updateMonthMenu()
@@ -1789,7 +1800,7 @@ void QCalendarWidgetPrivate::updateCurre
         newDate = minDate;
     if (maxDate.isValid()&& maxDate.daysTo(newDate) > 0)
         newDate = maxDate;
-    showMonth(newDate.year(), newDate.month());
+    showMonth(newDate.year(), newDate.month(), newDate.day());
     int row = -1, col = -1;
     m_model->cellForDate(newDate, &row, &col);
     if (row != -1 && col != -1)
@@ -1848,12 +1859,12 @@ void QCalendarWidgetPrivate::_q_yearClic
     yearEdit->setFocus(Qt::MouseFocusReason);
 }
 
-void QCalendarWidgetPrivate::showMonth(int year, int month)
+void QCalendarWidgetPrivate::showMonth(int year, int month, int monthday)
 {
-    if (m_model->shownYear == year && m_model->shownMonth == month)
+    if (m_model->shownYear == year && m_model->shownMonth == month && m_model->shownMonthDay == monthday)
         return;
     Q_Q(QCalendarWidget);
-    m_model->showMonth(year, month);
+    m_model->showMonth(year, month, monthday);
     updateNavigationBar();
     emit q->currentPageChanged(year, month);
     m_view->internalUpdate();
@@ -1868,6 +1879,7 @@ void QCalendarWidgetPrivate::updateNavig
 
     QString monthName = q->locale().monthName(m_model->shownMonth, QLocale::LongFormat);
 
+    monthDayButton->setText(QString::number(m_model->date.day()));
     monthButton->setText(monthName);
     yearButton->setText(QString::number(m_model->shownYear));
     yearEdit->setValue(m_model->shownYear);
@@ -1897,9 +1909,8 @@ void QCalendarWidgetPrivate::_q_slotChan
     QDate oldDate = m_model->date;
     m_model->setDate(date);
     QDate newDate = m_model->date;
-    if (changeMonth)
-        showMonth(newDate.year(), newDate.month());
     if (oldDate != newDate) {
+        showMonth(newDate.year(), newDate.month(), newDate.day());
         update();
         Q_Q(QCalendarWidget);
         emit q->selectionChanged();
@@ -2155,6 +2166,9 @@ QSize QCalendarWidget::minimumSizeHint()
         const int buttonDecoMargin = d->monthButton->sizeHint().width() - fm.boundingRect(d->monthButton->text()).width();
         headerW += monthW + buttonDecoMargin;
 
+        fm = d->monthDayButton->fontMetrics();
+        headerW += fm.boundingRect(QLatin1String("55")).width() + buttonDecoMargin;
+
         fm = d->yearButton->fontMetrics();
         headerW += fm.boundingRect(QLatin1String("5555")).width() + buttonDecoMargin;
 
@@ -2206,7 +2220,7 @@ void QCalendarWidget::setSelectedDate(co
     d->m_model->setDate(date);
     d->update();
     QDate newDate = d->m_model->date;
-    d->showMonth(newDate.year(), newDate.month());
+    d->showMonth(newDate.year(), newDate.month(), newDate.day());
 }
 
 /*!
@@ -2250,7 +2264,7 @@ int QCalendarWidget::monthShown() const
 void QCalendarWidget::setCurrentPage(int year, int month)
 {
     Q_D(QCalendarWidget);
-    d->showMonth(year, month);
+    d->showMonth(year, month, 15);
 }
 
 /*!
@@ -2396,7 +2410,7 @@ void QCalendarWidget::setMinimumDate(con
     QDate newDate = d->m_model->date;
     if (oldDate != newDate) {
         d->update();
-        d->showMonth(newDate.year(), newDate.month());
+        d->showMonth(newDate.year(), newDate.month(), newDate.day());
         emit selectionChanged();
     }
 }
@@ -2450,7 +2464,7 @@ void QCalendarWidget::setMaximumDate(con
     QDate newDate = d->m_model->date;
     if (oldDate != newDate) {
         d->update();
-        d->showMonth(newDate.year(), newDate.month());
+        d->showMonth(newDate.year(), newDate.month(), newDate.day());
         emit selectionChanged();
     }
 }
@@ -2506,7 +2520,7 @@ void QCalendarWidget::setDateRange(const
     QDate newDate = d->m_model->date;
     if (oldDate != newDate) {
         d->update();
-        d->showMonth(newDate.year(), newDate.month());
+        d->showMonth(newDate.year(), newDate.month(), newDate.day());
         emit selectionChanged();
     }
 }
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin