Add tooltips to buttons and room invite button

This commit is contained in:
miruka
2019-08-22 09:27:26 -04:00
parent 3082c64666
commit 627a186700
10 changed files with 75 additions and 31 deletions

View File

@@ -50,9 +50,7 @@ HRectangle {
fillMode: Image.PreserveAspectCrop
source: Qt.resolvedUrl(imageUrl)
HoverHandler {
id: hoverHandler
}
HoverHandler { id: hoverHandler }
HToolTip {
id: avatarToolTip
@@ -65,17 +63,10 @@ HRectangle {
height: width
delay: 1000
background: HRectangle {
id: background
border.color: "black"
border.width: 2
}
HImage {
id: avatarToolTipImage
anchors.centerIn: parent
sourceSize.width: parent.width - background.border.width * 2
sourceSize.height: parent.height - background.border.width * 2
sourceSize.width: parent.width
sourceSize.height: parent.height
width: sourceSize.width
height: sourceSize.width
fillMode: Image.PreserveAspectCrop

View File

@@ -21,6 +21,11 @@ Button {
property bool loading: false
property bool circle: false
property HToolTip toolTip: HToolTip {
id: toolTip
visible: text && hovered
}
background: HButtonBackground {
button: button

View File

@@ -5,9 +5,9 @@ MenuItem {
id: menuItem
spacing: theme.spacing
leftPadding: spacing
rightPadding: spacing
rightPadding: leftPadding
topPadding: spacing / 1.75
bottomPadding: spacing / 1.75
bottomPadding: topPadding
height: visible ? implicitHeight : 0

View File

@@ -2,12 +2,25 @@ import QtQuick 2.12
import QtQuick.Controls 2.12
ToolTip {
// Be sure to have a width and height set, to prevent the tooltip from
// going out of the window's boundaries
id: toolTip
delay: 150
padding: 0
delay: theme.controls.toolTip.delay
padding: background.border.width
background: HRectangle {
id: background
color: theme.controls.toolTip.background
border.color: theme.controls.toolTip.border
border.width: theme.controls.toolTip.borderWidth
}
contentItem: HLabel {
color: theme.controls.toolTip.text
text: toolTip.text
leftPadding: theme.spacing / 1.5
rightPadding: leftPadding
topPadding: theme.spacing / 2
bottomPadding: topPadding
}
enter: Transition {
HNumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
@@ -21,6 +34,6 @@ ToolTip {
}
HoverHandler {
onHoveredChanged: if (!hovered) { toolTip.hide() }
onHoveredChanged: if (! hovered) toolTip.hide()
}
}

View File

@@ -80,6 +80,10 @@ HRectangle {
height: parent.height
autoExclusive: true
checked: activeButton == modelData
enabled: modelData == "members"
toolTip.text: qsTr(
modelData.charAt(0).toUpperCase() + modelData.slice(1)
)
onClicked: activeButton =
activeButton == modelData ? null : modelData
}

View File

@@ -40,15 +40,29 @@ HColumnLayout {
}
}
HTextField {
id: filterField
placeholderText: qsTr("Filter members")
backgroundColor: theme.sidePane.filterRooms.background
bordered: false
HRowLayout {
Layout.minimumHeight: theme.baseElementsHeight
Layout.maximumHeight: Layout.minimumHeight
onTextChanged: filterLimiter.requestFire()
HTextField {
id: filterField
placeholderText: qsTr("Filter members")
backgroundColor: theme.chat.roomSidePane.filterMembers.background
bordered: false
Layout.fillWidth: true
Layout.preferredHeight: theme.baseElementsHeight
onTextChanged: filterLimiter.requestFire()
Layout.fillWidth: true
Layout.fillHeight: true
}
HButton {
icon.name: "room-send-invite"
iconItem.dimension: parent.height
toolTip.text: qsTr("Invite to this room")
backgroundColor: theme.chat.roomSidePane.inviteButton.background
Layout.fillHeight: true
}
}
}

View File

@@ -58,6 +58,7 @@ HTileDelegate {
backgroundColor: "transparent"
padding: sidePane.currentSpacing / 1.5
rightPadding: leftPadding
toolTip.text: collapsed ? qsTr("Expand") : qsTr("Collapse")
onClicked: accountDelegate.toggleCollapse()
visible: opacity > 0

View File

@@ -9,14 +9,16 @@ HRowLayout {
property alias roomFilter: filterField.text
Layout.fillWidth: true
Layout.preferredHeight: theme.baseElementsHeight
Layout.minimumHeight: theme.baseElementsHeight
Layout.maximumHeight: Layout.minimumHeight
HButton {
icon.name: "add-account"
toolTip.text: qsTr("Add another account")
backgroundColor: theme.sidePane.settingsButton.background
onClicked: pageLoader.showPage("SignIn")
Layout.preferredHeight: parent.height
Layout.fillHeight: true
}
HTextField {
@@ -26,7 +28,7 @@ HRowLayout {
bordered: false
Layout.fillWidth: true
Layout.preferredHeight: parent.height
Layout.fillHeight: true
onTextChanged: {
if (window.uiState.sidePaneFilter == text) return