Commit b81239ae authored by Ronan Abhamon's avatar Ronan Abhamon

feat(Form/ExclusiveButtons): use style file

parent eaafc4b0
...@@ -36,6 +36,7 @@ lupdate_only{ ...@@ -36,6 +36,7 @@ lupdate_only{
ui/modules/Linphone/Popup/*.qml \ ui/modules/Linphone/Popup/*.qml \
ui/modules/Linphone/Select/*.qml \ ui/modules/Linphone/Select/*.qml \
ui/modules/Linphone/Styles/*.qml \ ui/modules/Linphone/Styles/*.qml \
ui/modules/Linphone/Styles/Form/*.qml \
ui/modules/Linphone/View/*.qml \ ui/modules/Linphone/View/*.qml \
ui/views/*.qml \ ui/views/*.qml \
ui/views/MainWindow/*.qml \ ui/views/MainWindow/*.qml \
......
...@@ -60,6 +60,8 @@ ...@@ -60,6 +60,8 @@
<file>ui/modules/Linphone/Styles/CollapseStyle.qml</file> <file>ui/modules/Linphone/Styles/CollapseStyle.qml</file>
<file>ui/modules/Linphone/Styles/DialogStyle.qml</file> <file>ui/modules/Linphone/Styles/DialogStyle.qml</file>
<file>ui/modules/Linphone/Styles/ForceScrollBarStyle.qml</file> <file>ui/modules/Linphone/Styles/ForceScrollBarStyle.qml</file>
<file>ui/modules/Linphone/Styles/Form/ExclusiveButtonsStyle.qml</file>
<file>ui/modules/Linphone/Styles/Form/SmallButtonStyle.qml</file>
<file>ui/modules/Linphone/Styles/MenuStyle.qml</file> <file>ui/modules/Linphone/Styles/MenuStyle.qml</file>
<file>ui/modules/Linphone/Styles/PopupStyle.qml</file> <file>ui/modules/Linphone/Styles/PopupStyle.qml</file>
<file>ui/modules/Linphone/Styles/qmldir</file> <file>ui/modules/Linphone/Styles/qmldir</file>
......
import QtQuick 2.7 import QtQuick 2.7
import Linphone.Styles 1.0
// =================================================================== // ===================================================================
Row { Row {
property int selectedButton: 0 property int _selectedButton: 0
property variant texts property variant texts
signal clicked (int button) signal clicked (int button)
spacing: 8 spacing: ExclusiveButtonsStyle.buttonsSpacing
Repeater { Repeater {
model: texts model: texts
SmallButton { SmallButton {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
backgroundColor: selectedButton === index backgroundColor: _selectedButton === index
? '#8E8E8E' ? ExclusiveButtonsStyle.button.color.selected
: (button.down : (down
? '#FE5E00' ? ExclusiveButtonsStyle.button.color.pressed
: (button.hovered : (hovered
? '#C0C0C0' ? ExclusiveButtonsStyle.button.color.hovered
: '#D1D1D1' : ExclusiveButtonsStyle.button.color.normal
) )
) )
id: button text: modelData
text: modelData
onClicked: {
onClicked: { if (_selectedButton !== index) {
if (selectedButton !== index) { _selectedButton = index
selectedButton = index clicked(index)
clicked(index)
}
}
} }
}
} }
}
} }
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import Linphone.Styles 1.0
// =================================================================== // ===================================================================
Button { Button {
property alias backgroundColor: background.color id: button
property alias backgroundColor: background.color
background: Rectangle {
id: background
background: Rectangle { color: button.down
color: button.down ? SmallButtonStyle.background.color.pressed
? '#FE5E00' : (button.hovered
: (button.hovered ? SmallButtonStyle.background.color.hovered
? '#C0C0C0' : SmallButtonStyle.background.color.normal
: '#D1D1D1' )
) implicitHeight: SmallButtonStyle.background.height
id: background radius: SmallButtonStyle.background.radius
implicitHeight: 22 }
radius: 10 contentItem: Text {
} color: SmallButtonStyle.text.color
contentItem: Text { font.pointSize: SmallButtonStyle.text.fontSize
color:'#FFFFFF' horizontalAlignment: Text.AlignHCenter
font.pointSize: 8 text: button.text
horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter
id: text }
text: button.text hoverEnabled: true
verticalAlignment: Text.AlignVCenter
}
hoverEnabled: true
id: button
} }
pragma Singleton
import QtQuick 2.7
import Linphone 1.0
QtObject {
property int buttonsSpacing: 8
property QtObject button: QtObject {
property QtObject color: QtObject {
property string hovered: '#C0C0C0'
property string normal: '#D1D1D1'
property string pressed: '#FE5E00'
property string selected: '#8E8E8E'
}
}
}
pragma Singleton
import QtQuick 2.7
import Linphone 1.0
QtObject {
property QtObject background: QtObject {
property int height: 22
property int radius: 10
property QtObject color: QtObject {
property string hovered: '#C0C0C0'
property string normal: '#D1D1D1'
property string pressed: '#FE5E00'
}
}
property QtObject text: QtObject {
property int fontSize: 8
property string color: '#FFFFFF'
}
}
...@@ -3,10 +3,13 @@ ...@@ -3,10 +3,13 @@
module Linphone.Style module Linphone.Style
# Components styles. # Components styles.
singleton CollapseStyle 1.0 CollapseStyle.qml singleton CollapseStyle 1.0 CollapseStyle.qml
singleton DialogStyle 1.0 DialogStyle.qml singleton DialogStyle 1.0 DialogStyle.qml
singleton ForceScrollBarStyle 1.0 ForceScrollBarStyle.qml singleton ForceScrollBarStyle 1.0 ForceScrollBarStyle.qml
singleton MenuStyle 1.0 MenuStyle.qml singleton MenuStyle 1.0 MenuStyle.qml
singleton PopupStyle 1.0 PopupStyle.qml singleton PopupStyle 1.0 PopupStyle.qml
singleton SearchBoxStyle 1.0 SearchBoxStyle.qml singleton SearchBoxStyle 1.0 SearchBoxStyle.qml
singleton TimelineStyle 1.0 TimelineStyle.qml singleton TimelineStyle 1.0 TimelineStyle.qml
singleton ExclusiveButtonsStyle 1.0 Form/ExclusiveButtonsStyle.qml
singleton SmallButtonStyle 1.0 Form/SmallButtonStyle.qml
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment