Sfoglia il codice sorgente

Fix QML warning: Detected anchors on an item that is managed by a layout.

Signed-off-by: Camila <hello@camila.codes>
Camila 4 anni fa
parent
commit
5585f61cc0
2 ha cambiato i file con 23 aggiunte e 19 eliminazioni
  1. 22 19
      src/gui/tray/Window.qml
  2. 1 0
      theme/Style/Style.qml

+ 22 - 19
src/gui/tray/Window.qml

@@ -354,10 +354,9 @@ Window {
                         Column {
                             id: accountLabels
                             spacing: Style.userStatusSpacing
-                            Layout.alignment: Qt.AlignLeft
+                            Layout.alignment: Qt.AlignLeft | Qt.AlignTop
                             Layout.leftMargin: Style.userStatusSpacing
-                            anchors.top: currentAccountAvatar.top
-                            anchors.topMargin: Style.userStatusSpacing
+                            Layout.topMargin: Style.accountLabelsLayoutTopMargin
                             Label {
                                 id: currentAccountUser
                                 width: Style.currentAccountLabelWidth
@@ -419,6 +418,7 @@ Window {
                     spacing: 0
                     Layout.preferredWidth:  Style.trayWindowHeaderHeight
                     Layout.preferredHeight: Style.trayWindowHeaderHeight
+                    Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
                     
                     HeaderButton {
                         id: openLocalFolderButton
@@ -436,24 +436,27 @@ Window {
                             radius: width*0.5
                             z: 1
                         }
-                   }
-
-                   Image {
-                        id: folderStateIndicator
-                        visible: UserModel.currentUser.hasLocalFolder
-                        source: UserModel.currentUser.isConnected
-                                ? Style.stateOnlineImageSource
-                                : Style.stateOfflineImageSource
-                        cache: false
-                        anchors.top: openLocalFolderButton.verticalCenter
-                        anchors.left: openLocalFolderButton.horizontalCenter
-                        
-                        sourceSize.width: Style.folderStateIndicatorSize
-                        sourceSize.height: Style.folderStateIndicatorSize
     
-                        Accessible.role: Accessible.Indicator
-                        Accessible.name: UserModel.currentUser.isConnected ? qsTr("Connected") : qsTr("Disconnected")
+                        Image {
+                            id: folderStateIndicator
+                            visible: UserModel.currentUser.hasLocalFolder
+                            source: UserModel.currentUser.isConnected
+                                    ? Style.stateOnlineImageSource
+                                    : Style.stateOfflineImageSource
+                            cache: false
+                            
+                            anchors.top: openLocalFolderButton.verticalCenter
+                            anchors.left: openLocalFolderButton.horizontalCenter  
+                            sourceSize.width: Style.folderStateIndicatorSize
+                            sourceSize.height: Style.folderStateIndicatorSize
+        
+                            Accessible.role: Accessible.Indicator
+                            Accessible.name: UserModel.currentUser.isConnected ? qsTr("Connected") : qsTr("Disconnected")
+                            z: 2
+                        }
                     }
+                    
+ 
 
                     Accessible.role: Accessible.Button
                     Accessible.name: qsTr("Open local folder of current account")

+ 1 - 0
theme/Style/Style.qml

@@ -52,6 +52,7 @@ QtObject {
     property int accountLabelsSpacing: 4
     property int accountLabelsAnchorsMargin: 7
     property int accountLabelsLayoutMargin: 9
+    property int accountLabelsLayoutTopMargin: 12
 
     // Visual behaviour
     property bool hoverEffectsEnabled: true