1
0

BottomNavTab.qml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import QtQuick 2.15
  2. import QtQuick.Controls 2.15
  3. import "." as Components
  4. Rectangle {
  5. id: tab
  6. property string icon: ""
  7. property string text: ""
  8. property bool active: false
  9. signal clicked()
  10. color: touchArea.pressed ? Components.ThemeManager.pressedColor : "transparent"
  11. Column {
  12. anchors.centerIn: parent
  13. spacing: 3
  14. Components.Icon {
  15. name: tab.icon
  16. size: 22
  17. color: tab.active ? Components.ThemeManager.navIconActive
  18. : Components.ThemeManager.navIconInactive
  19. anchors.horizontalCenter: parent.horizontalCenter
  20. Behavior on color {
  21. ColorAnimation { duration: 200 }
  22. }
  23. }
  24. Label {
  25. text: tab.text
  26. font.family: Components.ThemeManager.fontMedium
  27. font.pixelSize: 11
  28. color: tab.active ? Components.ThemeManager.navTextActive
  29. : Components.ThemeManager.navTextInactive
  30. anchors.horizontalCenter: parent.horizontalCenter
  31. Behavior on color {
  32. ColorAnimation { duration: 200 }
  33. }
  34. }
  35. }
  36. MouseArea {
  37. id: touchArea
  38. anchors.fill: parent
  39. onClicked: tab.clicked()
  40. }
  41. }