Make RoomSidePane follow buttons size again
Also add selected button color
This commit is contained in:
parent
ca6c55a3e7
commit
125a70bea6
|
@ -14,6 +14,7 @@ Button {
|
||||||
property int fontSize: HStyle.fontSize.normal
|
property int fontSize: HStyle.fontSize.normal
|
||||||
property color backgroundColor: HStyle.controls.button.background
|
property color backgroundColor: HStyle.controls.button.background
|
||||||
property alias overlayOpacity: buttonBackgroundOverlay.opacity
|
property alias overlayOpacity: buttonBackgroundOverlay.opacity
|
||||||
|
property bool checkedLightens: false
|
||||||
|
|
||||||
property bool loading: false
|
property bool loading: false
|
||||||
|
|
||||||
|
@ -40,7 +41,9 @@ Button {
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
id: buttonBackground
|
id: buttonBackground
|
||||||
color: Qt.lighter(backgroundColor, checked ? 1.3 : 1.0)
|
color: Qt.lighter(
|
||||||
|
backgroundColor, checked ? (checkedLightens ? 1.3 : 0.7) : 1.0
|
||||||
|
)
|
||||||
radius: circle ? height : 0
|
radius: circle ? height : 0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -106,7 +109,7 @@ Button {
|
||||||
onClicked: button.clicked()
|
onClicked: button.clicked()
|
||||||
onDoubleClicked: button.doubleClicked()
|
onDoubleClicked: button.doubleClicked()
|
||||||
onEntered: {
|
onEntered: {
|
||||||
overlayOpacity = checked ? 0 : 0.2
|
overlayOpacity = checked ? 0 : 0.15
|
||||||
button.entered()
|
button.entered()
|
||||||
}
|
}
|
||||||
onExited: {
|
onExited: {
|
||||||
|
@ -115,12 +118,12 @@ Button {
|
||||||
}
|
}
|
||||||
onPressAndHold: button.pressAndHold()
|
onPressAndHold: button.pressAndHold()
|
||||||
onPressed: {
|
onPressed: {
|
||||||
overlayOpacity += 0.2
|
overlayOpacity += 0.15
|
||||||
button.pressed()
|
button.pressed()
|
||||||
}
|
}
|
||||||
onReleased: {
|
onReleased: {
|
||||||
if (checkable) { checked = ! checked }
|
if (checkable) { checked = ! checked }
|
||||||
overlayOpacity = checked ? 0 : 0.2
|
overlayOpacity = checked ? 0 : 0.15
|
||||||
button.released()
|
button.released()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,28 +82,13 @@ HColumnLayout {
|
||||||
|
|
||||||
collapsed: width < Layout.minimumWidth + 8
|
collapsed: width < Layout.minimumWidth + 8
|
||||||
|
|
||||||
property int parentWidth: parent.width
|
property int referenceWidth: roomHeader.buttonsWidth
|
||||||
property int collapseBelow: 120
|
onReferenceWidthChanged:
|
||||||
|
if (chatSplitView.canAutoSize) { width = referenceWidth }
|
||||||
|
|
||||||
function set_width() {
|
width: referenceWidth // Initial width
|
||||||
width = parent.width * 0.3 < collapseBelow ?
|
|
||||||
Layout.minimumWidth :
|
|
||||||
Math.min(parent.width * 0.3,
|
|
||||||
roomHeader.buttonsImplicitWidth)
|
|
||||||
}
|
|
||||||
|
|
||||||
onParentWidthChanged:
|
|
||||||
if (chatSplitView.canAutoSize) { set_width() }
|
|
||||||
|
|
||||||
width: set_width() // Initial width
|
|
||||||
Layout.minimumWidth: HStyle.avatar.size
|
Layout.minimumWidth: HStyle.avatar.size
|
||||||
Layout.maximumWidth: parent.width
|
Layout.maximumWidth: parent.width
|
||||||
|
|
||||||
Behavior on width {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: chatSplitView.canAutoSize ? 120 : 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ HRectangle {
|
||||||
property string topic: ""
|
property string topic: ""
|
||||||
|
|
||||||
property alias buttonsImplicitWidth: viewButtons.implicitWidth
|
property alias buttonsImplicitWidth: viewButtons.implicitWidth
|
||||||
|
property int buttonsWidth: viewButtons.Layout.preferredWidth
|
||||||
|
|
||||||
property bool collapseButtons: width < 400
|
property bool collapseButtons: width < 400
|
||||||
|
|
||||||
|
@ -69,6 +70,8 @@ HRectangle {
|
||||||
HButton {
|
HButton {
|
||||||
iconName: "room_view_" + modelData
|
iconName: "room_view_" + modelData
|
||||||
iconDimension: 22
|
iconDimension: 22
|
||||||
|
autoExclusive: true
|
||||||
|
checked: modelData == "members" // TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ Item {
|
||||||
circle: true
|
circle: true
|
||||||
checked: loginWith == modelData
|
checked: loginWith == modelData
|
||||||
autoExclusive: true
|
autoExclusive: true
|
||||||
|
checkedLightens: true
|
||||||
onClicked: loginWith = modelData
|
onClicked: loginWith = modelData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user