Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Can not change firstDayOfWeek of calendar in qml
QtWS25 Last Chance

Can not change firstDayOfWeek of calendar in qml

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 519 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tamolo
    wrote on last edited by tamolo
    #1

    In Calendar qml doc http://doc.qt.io/qt-5/qml-qtquick-controls-calendar.html#dayOfWeekFormat-prop i do not see any property to change the firstDayOfWeek. So i look into calendar.qml source code and i saw a property __locale

    /*!
        The locale that this calendar should use to display itself.
    
        Affects how dates and day names are localized, as well as which
        day is considered the first in a week.
    
        To set an Australian locale, for example:
    
        \code
        locale: Qt.locale("en_AU")
        \endcode
    
        The default locale is \c Qt.locale().
    */
    property var __locale: Qt.locale()
    

    An object created by Qt.locale() will have a property firstDayOfWeek
    http://doc.qt.io/qt-5/qml-qtqml-locale.html#firstDayOfWeek-prop

    I want to change the first day of week of a calendar so i set

    Calendar {
        id: cal
        Component.onCompleted: {
            cal.__locale.firstDayOfWeek = Locale.Tuesday;
       }
    }
    

    But the firstDayOfWeek do not change
    Can anyone tell me what did i do wrong ?
    Is there any other ways to change the firstDayOfWeek of calendar in qml ?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved