<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Changing first day of week in DayOfWeekRow]]></title><description><![CDATA[<p dir="auto">I haven't found <a href="http://doc.qt.io/qt-5/qml-qt-labs-calendar-dayofweekrow.html" target="_blank" rel="noopener noreferrer nofollow ugc">here</a> this option. Yes I know about "locale", but i want name of days stay in local language but change just first day to Sunday.</p>
]]></description><link>https://forum.qt.io/topic/77699/changing-first-day-of-week-in-dayofweekrow</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 20:23:27 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/77699.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 29 Mar 2017 04:47:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Changing first day of week in DayOfWeekRow on Fri, 31 Mar 2017 05:04:49 GMT]]></title><description><![CDATA[<p dir="auto">@Wieland solved just adding</p>
<pre><code>delegate: Text {
            text: {
                if (globalModel.isSundayFirst)
                    Qt.locale().dayName(model.day === 0 ? 6 : model.day - 1, Locale.ShortFormat)
                else {
                    Qt.locale().dayName(model.day, Locale.ShortFormat)
                }
            }

            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
        }

</code></pre>
<p dir="auto">to default DayOfWeekRow like said <a href="https://doc.qt.io/qt-5/qml-qt-labs-calendar-dayofweekrow.html#delegate-prop" target="_blank" rel="noopener noreferrer nofollow ugc">here</a> . But man, thank you so much for Qt.locale() function, i was struggling for hours figuring out why Qt.dayName() doesn't want to work. Nobel Prize for you brother.</p>
]]></description><link>https://forum.qt.io/post/385372</link><guid isPermaLink="true">https://forum.qt.io/post/385372</guid><dc:creator><![CDATA[Amir Afendin]]></dc:creator><pubDate>Fri, 31 Mar 2017 05:04:49 GMT</pubDate></item><item><title><![CDATA[Reply to Changing first day of week in DayOfWeekRow on Wed, 29 Mar 2017 14:55:12 GMT]]></title><description><![CDATA[<p dir="auto">Hi! If you look at the sources of <code>DayOfWeekRow</code> (<a href="http://code.qt.io/cgit/qt/qtquickcontrols2.git/tree/src/imports/calendar" target="_blank" rel="noopener noreferrer nofollow ugc">here</a>) , you'll see that there is no chance to get what you want. But you can build your own item in two minutes:</p>
<p dir="auto"><img src="https://s30.postimg.org/au9ol3gr5/Image_4.png" alt="" class=" img-fluid img-markdown" /></p>
<p dir="auto"><strong>main.qml</strong></p>
<pre><code>import QtQuick 2.7
import QtQml 2.2
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1

ApplicationWindow {
    visible: true
    width: 640
    height: 480

    MyDayOfWeekRow {
        backgroundColor: "skyblue"
    }

}
</code></pre>
<p dir="auto"><strong>MyDayOfWeekRow.qml</strong></p>
<pre><code>import QtQuick 2.7
import QtQml 2.2
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1

Item {
    implicitWidth: row.implicitWidth
    implicitHeight: row.implicitHeight

    property int format: Locale.ShortFormat
    property color backgroundColor: "orange"
    property color textColor: "black"
    property real rightPadding: 6
    property real topPadding: 6
    property real leftPadding: 6
    property real bottomPadding: 6
    property real spacing: 6

    // --- private ---

    id: control

    function getStandaloneDayName(d) {
        return Qt.locale().standaloneDayName(d, control.format) // use default locale
    }

    Component {
        id: itemDelegate
        Text {
            text: getStandaloneDayName(model.index)
            font.bold: true
            color: control.textColor
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
        }
    }

    Rectangle {
        id: background
        anchors.fill: parent
        color: control.backgroundColor
    }

    Row {
        id: row
        rightPadding: control.rightPadding
        topPadding: control.topPadding
        leftPadding:  control.leftPadding
        bottomPadding: control.bottomPadding
        spacing: control.spacing
        Repeater {
            model: 7 // starts with Locale.Sunday = 0
            delegate: itemDelegate
        }
    }

}
</code></pre>
]]></description><link>https://forum.qt.io/post/385013</link><guid isPermaLink="true">https://forum.qt.io/post/385013</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Wed, 29 Mar 2017 14:55:12 GMT</pubDate></item></channel></rss>