mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 09:26:18 -05:00
Set max width for text area
This commit is contained in:
parent
2809a9638a
commit
ee0b347200
@ -63,15 +63,20 @@ Item
|
||||
|
||||
ListView
|
||||
{
|
||||
property var styles: StyleChat.chat
|
||||
id: chatListView
|
||||
width: parent.width - 20
|
||||
width: parent.width - styles.bubbleMargin
|
||||
height: parent.height - inferiorPanel.height
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
height: 300
|
||||
model: chatModel.model
|
||||
delegate: ChatBubbleDelegate {}
|
||||
spacing: 10
|
||||
spacing: styles.bubbleSpacing
|
||||
preferredHighlightBegin: 1
|
||||
|
||||
onHeightChanged: {
|
||||
chatListView.currentIndex = count - 1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Item {
|
||||
@ -79,7 +84,7 @@ Item
|
||||
property var styles: StyleChat.inferiorPanel
|
||||
|
||||
id: inferiorPanel
|
||||
height: (msgComposer.height > styles.height)? msgComposer.height: styles.height
|
||||
height: ( msgComposer.height > styles.height)? msgComposer.height: styles.height
|
||||
width: parent.width
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
@ -118,12 +123,18 @@ Item
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: attachButton.right
|
||||
|
||||
height: (contentHeight > font.pixelSize)? contentHeight +font.pixelSize : parent.styles.height
|
||||
height: setTextAreaHeight()
|
||||
|
||||
////
|
||||
//// (contentHeight > font.pixelSize)? contentHeight +font.pixelSize : parent.styles.height
|
||||
|
||||
|
||||
width: chatView.width -
|
||||
(sendButton.width + sendButton.anchors.margins) -
|
||||
(attachButton.width + attachButton.anchors.margins) -
|
||||
(emojiButton.width + emojiButton.anchors.margins)
|
||||
|
||||
|
||||
placeholderText: styles.placeHolder
|
||||
background: styles.background
|
||||
|
||||
@ -140,6 +151,21 @@ Item
|
||||
}
|
||||
}
|
||||
|
||||
function setTextAreaHeight (){
|
||||
if (msgComposer.height >= chatView.height / msgComposer.styles.maxHeight)
|
||||
{
|
||||
return msgComposer.height
|
||||
}
|
||||
else if (contentHeight > font.pixelSize)
|
||||
{
|
||||
return msgComposer.contentHeight + msgComposer.font.pixelSize
|
||||
}
|
||||
else
|
||||
{
|
||||
return parent.styles.height
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BtnIcon {
|
||||
|
@ -34,6 +34,7 @@ QtObject {
|
||||
|
||||
property QtObject msgComposer: QtObject{
|
||||
readonly property string placeHolder: "Send message..."
|
||||
readonly property int maxHeight: 2 // chatListView/maxHeight
|
||||
|
||||
property QtObject background: Rectangle {
|
||||
color: "transparent"
|
||||
@ -56,9 +57,12 @@ QtObject {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
property QtObject chat: QtObject {
|
||||
// Measures
|
||||
readonly property int bubbleMargin: 20
|
||||
readonly property int bubbleSpacing: 10
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user