summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qcalendarwidget.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Document calendar setting of QCalendarWidget and QDateTimeEditEdward Welbourne3 days1-0/+17
| | | | | | | | | | | | | It seems this was neglected in 5.14, when the methods were added. The calendar setting is also not a Q_PROPERTY; and hadn't been tested until recently. This follows up on commit 2dee00621632ab8acd0b3d59bdba264afe2f32c1 Pick-to: 6.7 6.5 Task-number: QTBUG-115200 Change-Id: I9625bf54d05a55a40867847bd58130be90e78271 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix -Wimplicit-fallthrough for clangTim Blechmann2024-03-011-0/+1
| | | | | | | | | | | | | | | | | | | Clang's `-Wimplicit-fallthrough` warnings are a little stricter than gcc's interpretation: switch (i) { case 0: foo(); case 4: break; } While gcc accepts the implicit fallthrough, if the following statement is a trivial `break`, clang will warn about it. Pick-to: 6.7 Change-Id: I38e0817f1bc034fbb552aeac21de1516edcbcbb0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Widgets: pass widget to QStyle::pixelMetric()Christian Ehrlicher2024-01-161-1/+1
| | | | | | | | | | | | Make sure to pass the widget to QStyle::pixelMetric() as some styles might use this (e.g. the new windows styles) to determine the correct pixel metric. Pick-to: 6.7 6.6 6.5 6.2 Task-number: QTBUG-1857 Change-Id: I5c32f5af8b284749732b610e56b4e3d8c8ed1946 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
* Doc: Mention reset methods for QCalendarWidget::maximumDate, minimumDateKai Köhne2023-09-071-4/+6
| | | | | | Pick-to: 6.6 Change-Id: Ic3bfbcec1ac7d31ab704b52e6560d44f4a2054e7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Fix documented default for QCalendarWidget maximumDate, minimumDateKai Köhne2023-09-071-4/+2
| | | | | | | | | | | | The default minimum date and maximum date for QCalendarWidget are not the 'earliest and last dates' that QDate class can handle. Instead, minimumDate is initialized to November 25, 4714 BCE (first Julian day), and maximumDate to December 31, 9999 CE. Pick-to: 5.15 6.2 6.5 6.6 Change-Id: Ice9289853a7e825ff2b31567efb81cdfb7d678a1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Remove duplicate wordsAndreas Eliasson2023-02-281-1/+1
| | | | | | Change-Id: Ia7a38a1035bd34d00f20351a0adc3927e473b2e7 Pick-to: 6.5 6.4 6.2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QtWidgets: Fix errors about fields from anonymous namespaces ↵Friedemann Kleint2023-02-011-6/+21
| | | | | | | | | | | | | | | | | | (-Werror=subobject-linkage) Move types to QtPrivate, fixing errors like: error: QCalendarWidgetPrivate’ has a field QCalendarWidgetPrivate::m_model whose type uses the anonymous namespace [-Werror=subobject-linkage] The error appears in CMake Unity (Jumbo) builds apparently due to multiple anonymous namespaces per file. Task-number: QTBUG-109394 Pick-to: 6.5 Change-Id: Id678af4db5633b1b2267425c7751f1312935d5d5 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QCalendarWidget: Add reset functions for minimum/maximumDateVolker Hilsheimer2023-01-131-0/+10
| | | | | | | | | | QDateTimeEdit has such reset functions for the minimum/maximum range properties, this makes QCalendarWidget consistent with the simpler editors. Fixes: QTBUG-62448 Change-Id: Iabb89f599e4996f00488a885a5b8a009471838b3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Add static_cast for QKeyEventLu YaNing2022-12-131-1/+1
| | | | | | | | Use static_cast to convert a QEvent to a QKeyEvent, replacing (QKeyEvent*)e Change-Id: I52ac3f46aec42600251cf737db2e71c04f2b45c7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtWidgets: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-05-021-10/+12
| | | | | | Task-number: QTBUG-98434 Change-Id: I310ea8f19d73a79d985ebfb8bfbff7a02c424360 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtWidgets: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-261-5/+5
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: I133b80334b66e0a5ab9546dd8e1ff0631e79601e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* widgets: Fix typos in documentationJonas Kvinge2021-10-121-1/+1
| | | | | | Pick-to: 5.15 6.2 Change-Id: I6b77f0ec043d08da3b7958d780dce9595daf97a6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Consistently test for nullptrVolker Hilsheimer2021-02-251-2/+3
| | | | | | | | | | | m_view might be nullptr, which is checked before setting up the palette, so don't set the QTextCharFormat up without checking first as well. Fixes static analyzer warning 0ef07dd07bebe04b93d1fc802eddb57a Pick-to: 6.1 Change-Id: Ia1c92eb4183c9e368e92875775cff90e2883ddaf Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Restore pass-by-ref to QRect QCalendarWidget::paintCell()Edward Welbourne2020-12-081-1/+1
| | | | | | | | | | | Accidentally changed to pass-by-value while doing that to QDate, in commit af837734b2259201f126b206bd5299497e080f7b Task-number: QTBUG-86400 Change-Id: I8d2db532f537e5f82a5f3b36e72fcf7fefdd2ee5 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 8db0d701e8b1fe00cdd5d71c18afff84de606013) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Get rid of Q_COMPILER_CONSTEXPR checksAllan Sandfeld Jensen2020-11-171-4/+0
| | | | | | | Is required now. Change-Id: I62e95929d1649ea1390392230b619bd56d2a0349 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Adjust code format, add space after 'if'Zhang Sheng2020-11-161-3/+3
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Show the year correctly after it has been editedAndy Shaw2020-10-261-1/+1
| | | | | | | | | | | | When converting the year as an integer via the locale then it can add in group separators which would not be desired here. Therefore it should be converted via the QDate approach to get the right output for the year. Fixes: QTBUG-86307 Fixes: QTBUG-85966 Pick-to: 5.15 Change-Id: I092bd1e5f69e544843fd5f28c96b94c9066490c5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QCalendarDelegate: replace QItemDelegate with QStyledItemDelegateWang Peng2020-09-051-6/+5
| | | | | | | | Resolve remaining Qt6 TODOs Change-Id: I018ef5e3761816dce052a78be3dcd07ede866135 Reviewed-by: JiDe Zhang <zccrs@live.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace Qt CONSTEXPR defines with constexprAllan Sandfeld Jensen2020-08-141-7/+7
| | | | | | | | Both normal and relaxed constexpr are required by our new minimum of C++17. Change-Id: Ic028b88a2e7a6cb7d5925f3133b9d54859a81744 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QCalendarWidget: code tidies for the internal modelGiuseppe D'Angelo2020-07-081-31/+20
| | | | | | | | | | | | | | The table model inside a QCalendarWidget was violating a few QAIM principles: * returning illegal values from row/columnCount by not checking the parent index * not keeping invariants on row/column manipulation. Pick-to: 5.15 Change-Id: I2c51e59ea2d89e73884bad20f3c06fbb808a26c5 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* Add ; to Q_UNUSEDLars Schmertmann2020-07-071-1/+1
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Avoid use of Q_UNUSED by eliminating the parameter namesLars Schmertmann2020-07-031-1/+1
| | | | | | | | | This change only happens to files touched by the commit to add missing ; to Q_UNUSED. Task-number: QTBUG-82978 Change-Id: I10e6993a2bb3952cf9a262708b8573550e0dbe63 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Port QtWidgets from QStringRef to QStringViewLars Knoll2020-06-101-2/+2
| | | | | Change-Id: Ibe348e7aea838ab8c2d628bb43709c867a506637 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace calls to deprecated QEvent accessor functionsShawn Rutledge2020-06-081-2/+2
| | | | | | | Many of these were generated by clazy using the new qevent-accessors check. Change-Id: Ie17af17f50fdc9f47d7859d267c14568cc350fd0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use correct order of arguments when calling QCalendar::daysInMonth()Andy Shaw2020-05-151-5/+5
| | | | | | | Change-Id: Ic4e30d8ffea80c1dc1dc8da1f97f4bb0d21b63e3 Pick-to: 5.15 Fixes: QTBUG-83870 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Pass QDate and QTime as value classesEdward Welbourne2020-02-271-11/+11
| | | | | | | | | It's what they are, so const refs are needless burden. In the process, consolidate two of the affected methods (one of which just adds another argument to the other's signature) into one. Change-Id: I80de35ffe078a652d1999889dede0b10302abaa9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.14' into 5.15Friedemann Kleint2020-02-241-1/+3
|\ | | | | | | Change-Id: Ibe5b4aa249863a54007180f3684dc5ce1b23cb7b
| * Fix wrong DPI used by QStyle::pixelMetric()Friedemann Kleint2020-02-221-1/+3
| | | | | | | | | | | | | | | | | | Pass on the option or the widget in order to ensure usage of the correct DPI for High DPI scaling. Task-number: QTBUG-82356 Change-Id: I5df903a83f88adebd143e514e2fead367d39f015 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-19/+19
| | | | | | | | | | | | | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Deprecate constructing QFlags from a pointerAllan Sandfeld Jensen2019-11-201-3/+3
|/ | | | | | | | | This was used to support QFlags f = 0 initialization, but with 0 used as a pointer literal now considered bad form, it had been changed many places to QFlags f = nullptr, which is meaningless and confusing. Change-Id: I4bc592151c255dc5cab1a232615caecc520f02e8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Specify year in month name lookups for QCalendarWidgetEdward Welbourne2019-10-251-14/+21
| | | | | | | | | | | | | | | | | | The compiler didn't complain at a QLocale::FormatType values being passed for the int year parameters of the month-name functions, which all have a default for their final QLocale::FormatType parameters. So we didn't notice that the year parameter was missing until the bug was reported. Removed some code duplication by giving QCalendarModel a monthName() method. Reworked QCalendarMonthValidator::text() to avoid repeated calendar calculations (and use fewer braces). This commit amends commit 2dee00621632ab8acd0b3d59bdba264afe2f32c1 Fixes: QTBUG-79495 Change-Id: Iad48c3b648a0139ab43511e6fb4e6a8f63a0495f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Rename calendar methods from m{in,ax} to m{in,ax}imumEdward Welbourne2019-09-041-2/+2
| | | | | | | | | Words should not be abbreviated. Split a long line and reflowed some comments in the process. Fixes: QTBUG-78008 Change-Id: I52d75409f02e2cecbed3e94d424617ad594c275b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Pass QDate, QTime as value classes, rather than by const referenceEdward Welbourne2019-08-301-53/+53
| | | | | | | | | This can, of course, only be done in private APIs - but comment on public APIs to do the same at Qt 6. Change-Id: I3c79951572be3c37b0b0c5b1b05bced051a40964 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Adapt QCalendarWidget and QDateTimeEdit to support choice of calendarSoroush Rabiei2019-08-221-135/+198
| | | | | | | | | | | | [ChangeLog][QtWidgets][QCalendarWidget] Allow choice of calendar, with Gregorian remaining the default. [ChangeLog][QtWidgets][QDateTimeEdit] Allow choice of calendar, with Gregorian remaining the default. Change-Id: Ia11dd895032393543aee534b177324e643dcfb20 Done-with: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove dead code from Qt 4 timesTor Arne Vestbø2019-08-201-2/+1
| | | | | | | | | | The benefit of keeping this code around was to inspire or inform changes in the areas to take into account possibly missing features in Qt 5, but at this point that benefit is questionable. We can always use the history to learn about missing pieces if needed. Change-Id: I87a02dc451e9027be9b97554427bf8a1c6b2c025 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Remove usages of deprecated QApplication::keypadNavigationEnabledSona Kurazyan2019-07-231-2/+3
| | | | | | | | | | Added QApplicationPrivate::keypadNavigationEnabled() as a replacement of deprecated QApplication::keypadNavigationEnabled(), for the internal usage. Task-number: QTBUG-76491 Change-Id: I75f4c628b72d86b5e428e7e285a786d23abbf3f2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Finish deprecating obsolete members of QWheelEventShawn Rutledge2019-07-121-1/+1
| | | | | | | | | | | | | | | | | In Qt 5.0, delta() and orientation() were already marked obsolete, but Widgets and tests have kept on depending on them all this time. We now start using alternative API so they can really be deprecated. All constructors except the newest one are also deprecated. The plan is for all events from pointing devices to have QPointF position() and globalPosition(), so we deprecate the other position accessors. [ChangeLog][QtGui] Obsolete constructors and accessors in QWheelEvent now have proper deprecation macros. What is left is intended to be compatible with planned changes in Qt 6. Change-Id: I26250dc90922b60a6ed20d7f65f38019da3e139e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Remove remaining Q_DECL_NOEXCEPT/Q_DECL_NOTHROW usageAllan Sandfeld Jensen2019-04-041-6/+6
| | | | | Change-Id: I91ac9e714a465cab226b211812aa46e8fe5ff2ab Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-02-151-12/+15
|\ | | | | | | Change-Id: I8cad26f17834dbc9f7151edc0f17786f9e32025d
| * Fix crash when using Qt Virtual Keyboard with QCalendarWidgetMitch Curtis2019-02-121-12/+15
| | | | | | | | | | | | | | | | | | | | For some reason, QCalendarWidget gets filtered press events that were intended for Qt Virtual Keyboard's input panel (QQuickView), so we have to make sure that the window is indeed a QWidget - no static_cast. Change-Id: Ibc9dce956918ac50d1fed8231a445b7338aef09c Fixes: QTBUG-72925 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Replace QWidget::margin() with QWidget::contentsMargins()Christian Ehrlicher2019-02-131-3/+3
| | | | | | | | | | | | | | | | Replace deprecated QWidget::margin/setMargin() calls with contentsMargin/setContentsMargins(). Change-Id: I7fe8056196d73d1be97446d40a438cd0b1a13817 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Doc: replace QItemDelegate with QStyledItemDelegateChristian Ehrlicher2019-01-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Since QStyledItemDelegate should be preferred over QItemDelegate the documentation should point to QStyledItemDelegate instead. Also mark some internal classes which derive from QItemDelegate so they will not be forgotten during Qt6 porting. Change-Id: I2dd17feedf8593afac5ca16d2546e1f0bc0250ae Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Fix use of deprecated ItemDataRoles Background/TextColorRoleChristian Ehrlicher2018-11-051-2/+2
|/ | | | | | | | | | Replace BackgroundColorRole/TextColorRole with BackgroundRole/ForegroundRole and explicit deprecate them for 5.13 Change-Id: I6b0d99844a32d2f5fdfd1878317a7b7422b800d3 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QCalendarWidget: update the year label correctly on locale changeEirik Aavitsland2018-07-161-1/+1
| | | | | | | | | | The year label in the header would show an unlocalized year number. Fix by setting it equal to the year editor's correctly localized string. Task-number: QTBUG-69038 Change-Id: I87148c607b8fb498c57bcf59bc175154c9e445d1 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix build for Android with android-clang in r17Liang Qi2018-06-061-1/+1
| | | | | | Task-number: QTBUG-67464 Change-Id: Ib971a5da82b31bce9ac1c9ac623ad7d5302cfaec Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Update usage of QFontMetrics::width() to new APIEskil Abrahamsen Blomfeldt2017-12-081-3/+3
| | | | | | | | | | | | | | QFontMetrics(F)::width() has been deprecated and is replaced by horizontalAdvance(). This updates all usage of it in tests and documentation. It is worth noting that many or most of the usages of QFontMetrics::width() probably intended to use boundingRect().width(), but since it currently works, I have not looked into that, just replaced the function name mechanically. Change-Id: Iec382e5bad0b50f37a6cfff841bfb46ed4d4555f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Raise the upper bound on years to 9999Edward Welbourne2017-11-301-1/+1
| | | | | | | | | | | | | | | | | Test-case taken from bug-report; fits in as an easy row in an existing data-driven test. Add similar tests for date-time and time; and an isValid test on the end of year 9999. The date-time parser was using the end of year 7999 as maximum value for dates and date-times; extend this to year 9999, as I can see no reason not to. [ChangeLog][QtCore][QDateTime] Years up to 9999 can now be parsed without error (previously 8000 and beyond were treated as invalid) in all formats (not only in ISO format). Widgets handling dates now support dates to 9999, likewise. Task-number: QTBUG-64401 Change-Id: I518cfa6c2cb4ecc5a85b896dc9e56b4fdd8a8bb1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-1/+1
| | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>