fix(Communities) Long community names should be truncated

UI issue is fixed, additional similar issue is fixed in CommunityProfilePopup.qml.

Closes: #2492
This commit is contained in:
Sale Djenic 2021-06-24 12:40:51 +02:00 committed by Iuri Matias
parent b720a611c4
commit ef7ac11f06
3 changed files with 19 additions and 4 deletions

View File

@ -15,7 +15,6 @@ Rectangle {
property Component pinnedMessagesPopupComponent property Component pinnedMessagesPopupComponent
id: root id: root
Layout.fillHeight: true
color: Style.current.secondaryMenuBackground color: Style.current.secondaryMenuBackground
Component { Component {
@ -56,6 +55,7 @@ Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: -4 anchors.topMargin: -4
width: parent.width - optionsBtn.width - optionsBtn.anchors.rightMargin
} }
StatusRoundButton { StatusRoundButton {

View File

@ -8,7 +8,7 @@ import "../components"
import "./" import "./"
Button { Button {
implicitWidth: Math.max(communityImage.width + communityName.width + (Style.current.halfPadding * 3), 200) width: parent.width
implicitHeight: communityImage.height + Style.current.padding implicitHeight: communityImage.height + Style.current.padding
background: Rectangle { background: Rectangle {
@ -49,16 +49,18 @@ Button {
Item { Item {
height: childrenRect.height height: childrenRect.height
width: childrenRect.width
anchors.left: communityImage.right anchors.left: communityImage.right
anchors.leftMargin: Style.current.halfPadding anchors.leftMargin: Style.current.halfPadding
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
StyledText { StyledText {
id: communityName id: communityName
width: parent.width
text: chatsModel.communities.activeCommunity.name text: chatsModel.communities.activeCommunity.name
font.pixelSize: 15 font.pixelSize: 15
font.weight: Font.Bold font.weight: Font.Bold
elide: Text.ElideRight
} }
StyledText { StyledText {

View File

@ -65,16 +65,29 @@ ModalPopup {
StyledTextEdit { StyledTextEdit {
id: communityName id: communityName
text: modalHeader.title text: textMetrics.elidedText
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 2 anchors.topMargin: 2
anchors.left: communityImg.active ? communityImg.right : parent.left anchors.left: communityImg.active ? communityImg.right : parent.left
anchors.leftMargin: communityImg.active ? Style.current.smallPadding : 0 anchors.leftMargin: communityImg.active ? Style.current.smallPadding : 0
anchors.right: parent.right
/* Because of ModalPopup's close button we must set rightMargin,
cause we don't want overlap it.
This should be generally fixed in ModalPopup file. */
anchors.rightMargin: 40
font.bold: true font.bold: true
font.pixelSize: 17 font.pixelSize: 17
readOnly: true readOnly: true
} }
TextMetrics {
id: textMetrics
font: communityName.font
text: modalHeader.title
elideWidth: communityName.width
elide: Text.ElideMiddle
}
StyledText { StyledText {
id: headerDescription id: headerDescription
text: modalHeader.description text: modalHeader.description