Просмотр исходного кода

Fix QML warning: Cannot specify left, right... anchors for items inside Row.

Signed-off-by: Camila <hello@camila.codes>
Camila 4 лет назад
Родитель
Сommit
19e581657d
3 измененных файлов с 17 добавлено и 27 удалено
  1. 9 17
      src/gui/tray/UserLine.qml
  2. 6 8
      src/gui/tray/Window.qml
  3. 2 2
      theme/Style/Style.qml

+ 9 - 17
src/gui/tray/UserLine.qml

@@ -61,7 +61,7 @@ MenuItem {
                     id: accountControlRowLayout
                     height: accountButton.height
                     width: accountButton.width
-                    spacing: 0
+                    spacing: Style.userStatusSpacing
                     Image {
                         id: accountAvatar
                         Layout.leftMargin: 7
@@ -99,15 +99,10 @@ MenuItem {
 
                     Column {
                         id: accountLabels
-                        spacing: Style.accountLabelsSpacing
-                        Layout.alignment: Qt.AlignLeft
-                        Layout.leftMargin: Style.accountLabelsLayoutMargin
-                        anchors.top: accountAvatar.top
-                        anchors.topMargin: Style.userStatusAnchorsMargin
-                        anchors.left: accountAvatar.right
-                        anchors.leftMargin: Style.accountLabelsAnchorsMargin
+                        Layout.leftMargin: Style.accountLabelsSpacing
                         Label {
                             id: accountUser
+                            Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
                             width: 128
                             text: name
                             elide: Text.ElideRight
@@ -115,11 +110,12 @@ MenuItem {
                             font.pixelSize: Style.topLinePixelSize
                             font.bold: true
                         }
-                        Row {
+                        RowLayout {
                             id: userStatus
                             visible: model.isConnected && 
                                      model.serverHasUserStatus
-                            anchors.top: accountUser.bottom
+                            spacing: Style.userStatusAnchorsMargin
+                            Layout.alignment: Qt.AlignLeft | Qt.AlignTop
                             Label {
                                 id: emoji
                                 visible: model.statusEmoji !== ""
@@ -128,9 +124,8 @@ MenuItem {
                             }
                             Label {
                                 id: message
-                                anchors.bottom: emoji.bottom
-                                anchors.left: emoji.right
-                                anchors.leftMargin: emoji.width + Style.userStatusSpacing
+                                Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
+                                Layout.leftMargin: Style.userStatusAnchorsMargin
                                 visible: model.statusMessage !== ""
                                 width: Style.currentAccountLabelWidth
                                 text: statusMessage
@@ -141,10 +136,7 @@ MenuItem {
                         }
                         Label {
                             id: accountServer
-                            anchors.top: userStatus.bottom
-                            anchors.topMargin: message.visible
-                                               ? message.height + Style.accountServerAnchorsMargin
-                                               : Style.userStatusAnchorsMargin
+                            Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
                             width: Style.currentAccountLabelWidth
                             text: server
                             elide: Text.ElideRight

+ 6 - 8
src/gui/tray/Window.qml

@@ -353,12 +353,12 @@ Window {
 
                         Column {
                             id: accountLabels
-                            spacing: Style.userStatusSpacing
-                            Layout.alignment: Qt.AlignLeft | Qt.AlignTop
+                            spacing: 0
+                            Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
                             Layout.leftMargin: Style.userStatusSpacing
-                            Layout.topMargin: Style.accountLabelsLayoutTopMargin
                             Label {
                                 id: currentAccountUser
+                                Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
                                 width: Style.currentAccountLabelWidth
                                 text: UserModel.currentUser.name
                                 elide: Text.ElideRight
@@ -366,11 +366,11 @@ Window {
                                 font.pixelSize: Style.topLinePixelSize
                                 font.bold: true
                             }
-                            Row {
+                            RowLayout {
                                 id: currentUserStatus
                                 visible: UserModel.currentUser.isConnected &&
                                          UserModel.currentUser.serverHasUserStatus
-                                anchors.top: currentAccountUser.bottom
+                                spacing: Style.accountLabelsSpacing
                                 Label {
                                     id: emoji
                                     visible: UserModel.currentUser.statusEmoji !== ""
@@ -379,9 +379,7 @@ Window {
                                 }
                                 Label {
                                     id: message
-                                    anchors.bottom: emoji.bottom
-                                    anchors.left: emoji.right
-                                    anchors.leftMargin: emoji.width + Style.userStatusSpacing
+                                    Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
                                     visible: UserModel.currentUser.statusMessage !== ""
                                     width: Style.currentAccountLabelWidth
                                     text: UserModel.currentUser.statusMessage !== ""

+ 2 - 2
theme/Style/Style.qml

@@ -51,8 +51,8 @@ QtObject {
     property int accountServerAnchorsMargin: 10
     property int accountLabelsSpacing: 4
     property int accountLabelsAnchorsMargin: 7
-    property int accountLabelsLayoutMargin: 9
-    property int accountLabelsLayoutTopMargin: 12
+    property int accountLabelsLayoutMargin: 12
+    property int accountLabelsLayoutTopMargin: 10
 
     // Visual behaviour
     property bool hoverEffectsEnabled: true