<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Centering GridLayout on Page in ArcGIS AppStudio Questions</title>
    <link>https://community.esri.com/t5/arcgis-appstudio-questions/centering-gridlayout-on-page/m-p/1178981#M4280</link>
    <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;I am new to QML and am trying to create a grid of buttons that stays centered on the bottom third of the page that will also scale depending on screen size and DPI.&lt;/P&gt;&lt;P&gt;I am sure I am missing something with the anchors and bottom margins and how to use scaleFactor but I'm unsure where I am making a mistake.&lt;/P&gt;&lt;P&gt;The images below show how I would like for the app page to look and how they are actually looking with my current code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code has been attached as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Ideal Design&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ideal Design" style="width: 207px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/42525i2FE5D8E122B5A197/image-dimensions/207x410?v=v2" width="207" height="410" role="button" title="LandingPageDesign.PNG" alt="Ideal Design" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Ideal Design&lt;/span&gt;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Actual Code -&amp;nbsp;&lt;/STRONG&gt;&lt;EM&gt;Note the buttons are being cut off at the bottom&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="My Code Design" style="width: 232px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/42526i8189595FA421C183/image-dimensions/232x392?v=v2" width="232" height="392" role="button" title="App.PNG" alt="My Code Design" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;My Code Design&lt;/span&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Actual Code (window size scaled)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Actual Code (scaled)" style="width: 366px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/42527i2A894F1CD75E9C80/image-dimensions/366x430?v=v2" width="366" height="430" role="button" title="App2.PNG" alt="Actual Code (scaled)" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Actual Code (scaled)&lt;/span&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import QtQuick 2.2
import QtQuick 2.3
import QtQuick 2.6
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.12


import "components" as Components

//BACKGROUND COLOR
Rectangle {
    signal signInClicked(string tourId)

    //color: app.headerBackgroundColor
    color: "#242424"

    AnimatedImage {
        anchors.fill: parent
        source: app.landingpageBackground
        fillMode: Image.PreserveAspectCrop
        visible: source &amp;gt; ""
    }

    Rectangle {
        anchors.fill: parent
        gradient: Gradient {
            GradientStop { position: 0.0; color: "#00000000";}
            GradientStop { position: 1.0; color: "#00000000";}
        }
    }
 GridLayout {
        id: grid
        columns: 3
        width: 10
        height: 10
        Layout.margins: 0
        anchors.left: parent.left
        anchors.bottom: parent.bottom
        anchors.leftMargin: 50 * app.scaleFactor
        anchors.bottomMargin: 200 * app.scaleFactor
        columnSpacing: 1
        rowSpacing: 1

            Button {
                id: parks
                Layout.preferredWidth: 120
                Layout.preferredHeight: 120
                style: ButtonStyle {

                    label: Image {
                        source: "images/parks.png"
                        fillMode: Image.PreserveAspectFit  // ensure it fits
                    }

                    background: Rectangle {
                        color: "#00FFFFFF"  // I update background color by this
                    }
                }

                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        signInClicked("");
                    }
                }
            }

//-------------------------------------

            Button {
                id: programs
                Layout.preferredWidth: 120
                Layout.preferredHeight: 120

                style: ButtonStyle {

                    label: Image {
                        source: "images/programslp.png"
                        fillMode: Image.PreserveAspectFit  // ensure it fits
                    }

                        background: Rectangle {
                            implicitWidth: 50
                            implicitHeight: 50
                            opacity: enabled ? 1 : 0.3
                            border.color: "#00FFFFFF"
                            border.width: 1
                            radius: 2
                            color: "#00FFFFFF"  // I update background color by this
                        }
                }

                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        programsPage.open()
                    }
                }
          }
//-------------------------------------

            Button {
                id: news
                Layout.preferredWidth: 120
                Layout.preferredHeight: 120

                style: ButtonStyle {

                    label: Image {
                        source: "images/news.png"
                        fillMode: Image.PreserveAspectFit  // ensure it fits
                    }

                        background: Rectangle {
                            implicitWidth: 50
                            implicitHeight: 50
                            opacity: enabled ? 1 : 0.3
                            border.color: "#00FFFFFF"
                            border.width: 1
                            radius: 2
                            color: "#00FFFFFF"  // I update background color by this
                        }
                }

                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        newsPage.open()
                    }
                }
          }

//--------------------------------------

            Button {
                id: followUs
                Layout.preferredWidth: 120
                Layout.preferredHeight: 120

                style: ButtonStyle {

                    label: Image {
                        source: "images/follow.png"
                        fillMode: Image.PreserveAspectFit  // ensure it fits
                    }

                        background: Rectangle {
                            implicitWidth: 50
                            implicitHeight: 50
                            opacity: enabled ? 1 : 0.3
                            border.color: "#00FFFFFF"
                            border.width: 1
                            radius: 2
                            color: "#00FFFFFF"  // I update background color by this
                        }
                }

                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        aboutPage.open()
                    }
                }
          }

//----------------------------------------

            Button {
                id: feedback
                Layout.preferredWidth: 120
                Layout.preferredHeight: 120

                style: ButtonStyle {

                    label: Image {
                        source: "images/feedback.png"
                        fillMode: Image.PreserveAspectFit  // ensure it fits
                    }

                        background: Rectangle {
                            implicitWidth: 50
                            implicitHeight: 50
                            opacity: enabled ? 1 : 0.3
                            border.color: "#00FFFFFF"
                            border.width: 1
                            radius: 2
                            color: "#00FFFFFF"  // I update background color by this
                        }
                }

                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        aboutPage.open()
                    }
                }
          }

// ----------------------------------------

            Button {
                id: account
                Layout.preferredWidth: 120
                Layout.preferredHeight: 120

                style: ButtonStyle {

                    label: Image {
                        source: "images/account.png"
                        fillMode: Image.PreserveAspectFit  // ensure it fits

                background: Rectangle {
                            implicitWidth: 50
                            implicitHeight: 50
                            opacity: enabled ? 1 : 0.3
                            border.color: "#00FFFFFF"
                            border.width: 1
                            radius: 2
                            color: "#00FFFFFF"
                        }
                }

                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        accountPage.open()
                    }
                }
          }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be beneficial.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jun 2022 14:18:45 GMT</pubDate>
    <dc:creator>JoshBillings</dc:creator>
    <dc:date>2022-06-01T14:18:45Z</dc:date>
    <item>
      <title>Centering GridLayout on Page</title>
      <link>https://community.esri.com/t5/arcgis-appstudio-questions/centering-gridlayout-on-page/m-p/1178981#M4280</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;I am new to QML and am trying to create a grid of buttons that stays centered on the bottom third of the page that will also scale depending on screen size and DPI.&lt;/P&gt;&lt;P&gt;I am sure I am missing something with the anchors and bottom margins and how to use scaleFactor but I'm unsure where I am making a mistake.&lt;/P&gt;&lt;P&gt;The images below show how I would like for the app page to look and how they are actually looking with my current code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code has been attached as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Ideal Design&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ideal Design" style="width: 207px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/42525i2FE5D8E122B5A197/image-dimensions/207x410?v=v2" width="207" height="410" role="button" title="LandingPageDesign.PNG" alt="Ideal Design" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Ideal Design&lt;/span&gt;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Actual Code -&amp;nbsp;&lt;/STRONG&gt;&lt;EM&gt;Note the buttons are being cut off at the bottom&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="My Code Design" style="width: 232px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/42526i8189595FA421C183/image-dimensions/232x392?v=v2" width="232" height="392" role="button" title="App.PNG" alt="My Code Design" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;My Code Design&lt;/span&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Actual Code (window size scaled)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Actual Code (scaled)" style="width: 366px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/42527i2A894F1CD75E9C80/image-dimensions/366x430?v=v2" width="366" height="430" role="button" title="App2.PNG" alt="Actual Code (scaled)" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Actual Code (scaled)&lt;/span&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import QtQuick 2.2
import QtQuick 2.3
import QtQuick 2.6
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.12


import "components" as Components

//BACKGROUND COLOR
Rectangle {
    signal signInClicked(string tourId)

    //color: app.headerBackgroundColor
    color: "#242424"

    AnimatedImage {
        anchors.fill: parent
        source: app.landingpageBackground
        fillMode: Image.PreserveAspectCrop
        visible: source &amp;gt; ""
    }

    Rectangle {
        anchors.fill: parent
        gradient: Gradient {
            GradientStop { position: 0.0; color: "#00000000";}
            GradientStop { position: 1.0; color: "#00000000";}
        }
    }
 GridLayout {
        id: grid
        columns: 3
        width: 10
        height: 10
        Layout.margins: 0
        anchors.left: parent.left
        anchors.bottom: parent.bottom
        anchors.leftMargin: 50 * app.scaleFactor
        anchors.bottomMargin: 200 * app.scaleFactor
        columnSpacing: 1
        rowSpacing: 1

            Button {
                id: parks
                Layout.preferredWidth: 120
                Layout.preferredHeight: 120
                style: ButtonStyle {

                    label: Image {
                        source: "images/parks.png"
                        fillMode: Image.PreserveAspectFit  // ensure it fits
                    }

                    background: Rectangle {
                        color: "#00FFFFFF"  // I update background color by this
                    }
                }

                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        signInClicked("");
                    }
                }
            }

//-------------------------------------

            Button {
                id: programs
                Layout.preferredWidth: 120
                Layout.preferredHeight: 120

                style: ButtonStyle {

                    label: Image {
                        source: "images/programslp.png"
                        fillMode: Image.PreserveAspectFit  // ensure it fits
                    }

                        background: Rectangle {
                            implicitWidth: 50
                            implicitHeight: 50
                            opacity: enabled ? 1 : 0.3
                            border.color: "#00FFFFFF"
                            border.width: 1
                            radius: 2
                            color: "#00FFFFFF"  // I update background color by this
                        }
                }

                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        programsPage.open()
                    }
                }
          }
//-------------------------------------

            Button {
                id: news
                Layout.preferredWidth: 120
                Layout.preferredHeight: 120

                style: ButtonStyle {

                    label: Image {
                        source: "images/news.png"
                        fillMode: Image.PreserveAspectFit  // ensure it fits
                    }

                        background: Rectangle {
                            implicitWidth: 50
                            implicitHeight: 50
                            opacity: enabled ? 1 : 0.3
                            border.color: "#00FFFFFF"
                            border.width: 1
                            radius: 2
                            color: "#00FFFFFF"  // I update background color by this
                        }
                }

                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        newsPage.open()
                    }
                }
          }

//--------------------------------------

            Button {
                id: followUs
                Layout.preferredWidth: 120
                Layout.preferredHeight: 120

                style: ButtonStyle {

                    label: Image {
                        source: "images/follow.png"
                        fillMode: Image.PreserveAspectFit  // ensure it fits
                    }

                        background: Rectangle {
                            implicitWidth: 50
                            implicitHeight: 50
                            opacity: enabled ? 1 : 0.3
                            border.color: "#00FFFFFF"
                            border.width: 1
                            radius: 2
                            color: "#00FFFFFF"  // I update background color by this
                        }
                }

                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        aboutPage.open()
                    }
                }
          }

//----------------------------------------

            Button {
                id: feedback
                Layout.preferredWidth: 120
                Layout.preferredHeight: 120

                style: ButtonStyle {

                    label: Image {
                        source: "images/feedback.png"
                        fillMode: Image.PreserveAspectFit  // ensure it fits
                    }

                        background: Rectangle {
                            implicitWidth: 50
                            implicitHeight: 50
                            opacity: enabled ? 1 : 0.3
                            border.color: "#00FFFFFF"
                            border.width: 1
                            radius: 2
                            color: "#00FFFFFF"  // I update background color by this
                        }
                }

                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        aboutPage.open()
                    }
                }
          }

// ----------------------------------------

            Button {
                id: account
                Layout.preferredWidth: 120
                Layout.preferredHeight: 120

                style: ButtonStyle {

                    label: Image {
                        source: "images/account.png"
                        fillMode: Image.PreserveAspectFit  // ensure it fits

                background: Rectangle {
                            implicitWidth: 50
                            implicitHeight: 50
                            opacity: enabled ? 1 : 0.3
                            border.color: "#00FFFFFF"
                            border.width: 1
                            radius: 2
                            color: "#00FFFFFF"
                        }
                }

                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        accountPage.open()
                    }
                }
          }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be beneficial.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 14:18:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-appstudio-questions/centering-gridlayout-on-page/m-p/1178981#M4280</guid>
      <dc:creator>JoshBillings</dc:creator>
      <dc:date>2022-06-01T14:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Centering GridLayout on Page</title>
      <link>https://community.esri.com/t5/arcgis-appstudio-questions/centering-gridlayout-on-page/m-p/1179222#M4281</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/26942"&gt;@JoshBillings&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You're actually really close! There is another anchor you can use in the gridlayout such as:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;anchors.horizontalCenter: parent.horizontalCenter&lt;/LI-CODE&gt;&lt;P&gt;and get rid of the left anchor and margin. This would make it so it is always anchored to the bottom and center of its parent regardless of the screen size. Also, get rid of the height and width in the gridlayout as that could cause an issue with the area the buttons try to fit inside.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That should do it for you.&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Trevor&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 20:49:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-appstudio-questions/centering-gridlayout-on-page/m-p/1179222#M4281</guid>
      <dc:creator>TrevorFrame</dc:creator>
      <dc:date>2022-06-01T20:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Centering GridLayout on Page</title>
      <link>https://community.esri.com/t5/arcgis-appstudio-questions/centering-gridlayout-on-page/m-p/1179470#M4285</link>
      <description>&lt;P&gt;Worked like a charm. You're the man - thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 14:33:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-appstudio-questions/centering-gridlayout-on-page/m-p/1179470#M4285</guid>
      <dc:creator>JoshBillings</dc:creator>
      <dc:date>2022-06-02T14:33:13Z</dc:date>
    </item>
  </channel>
</rss>

