DotButton.qml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import QtQuick 2.3
  2. import QtQuick.Controls 1.4
  3. import QtQuick.Controls.Styles 1.3
  4. import QtQuick.Controls 2.0 as Controls2
  5. import QtGraphicalEffects 1.0
  6. import UM 1.3 as UM
  7. import Cura 1.0 as Cura
  8. Rectangle
  9. {
  10. property var iconSource: null
  11. width: 36 * screenScaleFactor
  12. height: width
  13. radius: 0.5 * width
  14. color: clickArea.containsMouse ? UM.Theme.getColor("primary_hover") : UM.Theme.getColor("primary")
  15. UM.RecolorImage
  16. {
  17. id: icon
  18. width: parent.width - 1
  19. height: width
  20. anchors.verticalCenter: parent.verticalCenter
  21. anchors.horizontalCenter: parent.horizontalCenter
  22. color: UM.Theme.getColor("primary_text")
  23. source: iconSource
  24. }
  25. MouseArea
  26. {
  27. id: clickArea
  28. anchors.fill:parent
  29. hoverEnabled: true
  30. onClicked:
  31. {
  32. if (OutputDevice.activeCamera !== null)
  33. {
  34. OutputDevice.setActiveCamera(null)
  35. }
  36. else
  37. {
  38. OutputDevice.setActiveCamera(modelData.camera)
  39. }
  40. }
  41. }
  42. }