Replace HToolButton usages with HButton

Also change sidePane toolbar: option button and filter rooms field
This commit is contained in:
miruka 2019-04-28 12:08:54 -04:00
parent 80067b5060
commit 2e8e042808
6 changed files with 18 additions and 93 deletions

View File

@ -7,7 +7,6 @@
- Bug fixes - Bug fixes
- 100% CPU usage when hitting top edge to trigger messages loading - 100% CPU usage when hitting top edge to trigger messages loading
- Fix tooltip hide()
- Sending `![A picture](https://picsum.photos/256/256)` → not clickable? - Sending `![A picture](https://picsum.photos/256/256)` → not clickable?
- Icons aren't reloaded - Icons aren't reloaded
- Bug when resizing window being tiled (i3), can't figure it out - Bug when resizing window being tiled (i3), can't figure it out

View File

@ -3,11 +3,14 @@ import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4 import QtQuick.Layouts 1.4
Button { Button {
property string iconName: ""
property var iconDimension: null
property bool circle: false
property int fontSize: HStyle.fontSize.normal property int fontSize: HStyle.fontSize.normal
property color backgroundColor: "lightgray" property color backgroundColor: "lightgray"
property alias overlayOpacity: buttonBackgroundOverlay.opacity property alias overlayOpacity: buttonBackgroundOverlay.opacity
property string iconName: ""
property bool circle: false
property bool loading: false property bool loading: false
property int contentWidth: 0 property int contentWidth: 0
@ -53,7 +56,7 @@ Button {
HIcon { HIcon {
svgName: loading ? "hourglass" : iconName svgName: loading ? "hourglass" : iconName
dimension: contentLayout.height dimension: iconDimension || contentLayout.height
} }
HLabel { HLabel {

View File

@ -1,31 +0,0 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
ToolButton {
property string tooltip: ""
property string iconName: ""
id: button
display: ToolButton.IconOnly
icon.source: "../../icons/" + iconName + ".svg"
background: Rectangle { color: "transparent" }
onClicked: toolTip.hide()
ToolTip {
id: toolTip
text: tooltip
delay: Qt.styleHints.mousePressAndHoldInterval
visible: text ? toolTipZone.containsMouse : false
}
MouseArea {
id: toolTipZone
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.NoButton // Make button receive clicks normally
onEntered: button.background.color = "#656565"
onExited: button.background.color = "transparent"
}
}

View File

@ -50,16 +50,14 @@ ColumnLayout {
} }
} }
Base.HToolButton { Base.HButton {
id: toggleExpand id: toggleExpand
iconName: roomList.visible ? "up" : "down" iconName: roomList.visible ? "up" : "down"
Layout.maximumWidth: 28 iconDimension: 16
Layout.minimumHeight: row.height backgroundColor: "transparent"
onClicked: roomList.visible = ! roomList.visible
onClicked: { Layout.preferredHeight: row.height
toggleExpand.ToolTip.hide()
roomList.visible = ! roomList.visible
}
} }
} }

View File

@ -3,47 +3,20 @@ import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4 import QtQuick.Layouts 1.4
import "../base" as Base import "../base" as Base
RowLayout { Base.HRowLayout {
id: toolBar id: toolBar
Layout.fillWidth: true
Layout.maximumHeight: 32
spacing: 0 spacing: 0
HToolButton {
visible: ! toolBarIsBig()
iconName: "reduced_menu"
tooltip: "Menu"
}
HToolButton {
iconName: "settings"
tooltip: "Settings"
}
HToolButton {
iconName: "add_account"
tooltip: "Add new account"
}
HToolButton {
iconName: "set_status"
tooltip: "Set status for all accounts"
}
HToolButton {
iconName: "search"
tooltip: "Filter rooms"
}
TextField {
id: filterField
visible: false
placeholderText: qsTr("Filter rooms")
selectByMouse: true
font.family: "Roboto"
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.preferredHeight: 32
background: Rectangle { color: "lightgray" }
Base.HButton { iconName: "settings" }
Base.HTextField {
id: filterField
placeholderText: qsTr("Filter rooms")
Layout.fillWidth: true
Layout.preferredHeight: 32
} }
} }

View File

@ -1,17 +0,0 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "../base" as Base
Base.HToolButton {
function toolBarIsBig() {
return sidePane.width >
Layout.minimumWidth * (toolBar.children.length - 2)
}
id: button
visible: toolBarIsBig()
Layout.fillHeight: true
Layout.fillWidth: true
Layout.minimumWidth: height
}