Skip to content

Commit 3972a69

Browse files
committed
Partial removal of 'SwiftNav' Qt Quick Control style
Because QTBUG-108518 will not be resolved in time for 6.5, we must remove the use of custom Qt Quick Control Styles that require fallback to another style, as the fallback style's theme does not properly initialize. (See bug). This removes SwiftNav style controls for all but TabBar and TabButton. Some additional things done here: * Remove use of SwiftButton where the customization done in SwiftButton was not used, and Material button is more appropriate to use with the same look and feel. * Remove use of SwiftComboBox where the customization done in SwiftComboBox was not used, and Material ComboBox is more appropriate to use with the same look and feel.
1 parent 79b1767 commit 3972a69

28 files changed

+78
-290
lines changed

resources/AdvancedTabComponents/AdvancedNetworkingTab.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Item {
7979
Layout.preferredHeight: Constants.networking.refreshButtonHeight
8080
Layout.fillWidth: true
8181

82-
SwiftButton {
82+
Button {
8383
anchors.verticalCenter: parent.verticalCenter
8484
anchors.verticalCenterOffset: Constants.networking.refreshButtonVerticalOffset
8585
ToolTip.visible: hovered

resources/AdvancedTabComponents/AdvancedSpectrumAnalyzerTabChannelBar.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import "../Constants"
2+
import "../BaseComponents"
23
import QtCharts
34
import QtQuick
45
import QtQuick.Controls
@@ -22,7 +23,7 @@ RowLayout {
2223
antialiasing: Globals.useAntiAliasing
2324
}
2425

25-
ComboBox {
26+
SwiftComboBox {
2627
id: channelDropdown
2728

2829
Layout.preferredHeight: Constants.advancedSpectrumAnalyzer.dropdownHeight

resources/AdvancedTabComponents/DeviceMonitorAndResetDevice.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Item {
1919
Layout.fillHeight: true
2020
}
2121

22-
SwiftButton {
22+
Button {
2323
id: resetButton
2424

2525
Layout.preferredWidth: parent.width * 0.5

resources/AdvancedTabComponents/MessageBroadcaster.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ Item {
241241
Layout.fillHeight: true
242242
Layout.preferredWidth: parent.width / 2
243243

244-
SwiftButton {
244+
Button {
245245
id: startButton
246246

247247
width: parent.width
@@ -278,7 +278,7 @@ Item {
278278
Layout.fillHeight: true
279279
Layout.preferredWidth: parent.width / 2
280280

281-
SwiftButton {
281+
Button {
282282
id: stopButton
283283

284284
enabled: false

resources/styles/SwiftNav/ComboBox.qml renamed to resources/BaseComponents/SwiftComboBox.qml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,25 @@
3737
**
3838
****************************************************************************/
3939
import QtQuick
40-
import QtQuick.Controls.Material
41-
import QtQuick.Controls.Material.impl
40+
import QtQuick.Window
4241
import QtQuick.Controls.impl
4342
import QtQuick.Templates as T
44-
import QtQuick.Window
43+
import QtQuick.Controls.Material
44+
import QtQuick.Controls.Material.impl
4545

4646
T.ComboBox {
4747
id: control
4848

4949
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding)
5050
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding, implicitIndicatorHeight + topPadding + bottomPadding)
51+
5152
topInset: 6
5253
bottomInset: 6
54+
5355
leftPadding: padding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
5456
rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
55-
Material.elevation: flat ? control.pressed || control.hovered ? 2 : 0 : control.pressed ? 8 : 2
57+
58+
Material.elevation: flat ? control.pressed || (enabled && control.hovered) ? 2 : 0 : control.pressed ? 8 : 2
5659
Material.background: flat ? "transparent" : undefined
5760
Material.foreground: flat ? undefined : Material.primaryTextColor
5861

@@ -77,13 +80,16 @@ T.ComboBox {
7780
padding: 6
7881
leftPadding: control.editable ? 2 : control.mirrored ? 0 : 12
7982
rightPadding: control.editable ? 2 : control.mirrored ? 12 : 0
83+
8084
text: control.editable ? control.editText : control.displayText
85+
8186
enabled: control.editable
8287
autoScroll: control.editable
8388
readOnly: control.down
8489
inputMethodHints: control.inputMethodHints
8590
validator: control.validator
8691
selectByMouse: control.selectTextByMouse
92+
8793
font: control.font
8894
color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
8995
selectionColor: control.Material.accentColor
@@ -97,9 +103,14 @@ T.ComboBox {
97103
background: Rectangle {
98104
implicitWidth: 120
99105
implicitHeight: control.Material.buttonHeight
106+
100107
radius: control.flat ? 0 : 2
101108
color: !control.editable ? control.Material.dialogColor : "transparent"
109+
102110
layer.enabled: control.enabled && !control.editable && control.Material.background.a > 0
111+
layer.effect: ElevationEffect {
112+
elevation: control.Material.elevation
113+
}
103114

104115
Rectangle {
105116
visible: control.editable
@@ -117,13 +128,9 @@ T.ComboBox {
117128
height: parent.height
118129
pressed: control.pressed
119130
anchor: control.editable && control.indicator ? control.indicator : control
120-
active: control.pressed || control.visualFocus || control.hovered
131+
active: enabled && (control.pressed || control.visualFocus || control.hovered)
121132
color: control.Material.rippleColor
122133
}
123-
124-
layer.effect: ElevationEffect {
125-
elevation: control.Material.elevation
126-
}
127134
}
128135

129136
popup: T.Popup {
@@ -133,6 +140,7 @@ T.ComboBox {
133140
transformOrigin: Item.Top
134141
topMargin: 12
135142
bottomMargin: 12
143+
136144
Material.theme: control.Material.theme
137145
Material.accent: control.Material.accent
138146
Material.primary: control.Material.primary
@@ -145,10 +153,9 @@ T.ComboBox {
145153
easing.type: Easing.OutQuint
146154
duration: 220
147155
}
148-
149156
NumberAnimation {
150157
property: "opacity"
151-
from: 0
158+
from: 0.0
152159
easing.type: Easing.OutCubic
153160
duration: 150
154161
}
@@ -162,10 +169,9 @@ T.ComboBox {
162169
easing.type: Easing.OutQuint
163170
duration: 220
164171
}
165-
166172
NumberAnimation {
167173
property: "opacity"
168-
to: 0
174+
to: 0.0
169175
easing.type: Easing.OutCubic
170176
duration: 150
171177
}
@@ -185,8 +191,8 @@ T.ComboBox {
185191
background: Rectangle {
186192
radius: 2
187193
color: parent.Material.dialogColor
188-
layer.enabled: control.enabled
189194

195+
layer.enabled: control.enabled
190196
layer.effect: ElevationEffect {
191197
elevation: 8
192198
}

resources/styles/SwiftNav/RoundButton.qml renamed to resources/BaseComponents/SwiftRoundButton.qml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@
3636
** $QT_END_LICENSE$
3737
**
3838
****************************************************************************/
39-
import "../../Constants"
39+
import "../Constants"
4040
import QtQuick
41-
import QtQuick.Controls
4241
import QtQuick.Controls.impl
4342
import QtQuick.Templates as T
4443

resources/BaselineTabComponents/BaselinePlot.qml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Item {
4646
Layout.alignment: Qt.AlignLeft
4747
Layout.leftMargin: Constants.baselinePlot.navBarMargin
4848

49-
SwiftButton {
49+
Button {
5050
id: baselinePauseButton
5151

5252
ButtonGroup.group: baselineButtonGroup
@@ -63,7 +63,7 @@ Item {
6363
}
6464
}
6565

66-
SwiftButton {
66+
Button {
6767
id: baselineClearButton
6868

6969
onPressed: backend_request_broker.baseline_plot([baselineButtonGroup.buttons[2].checked, baselineButtonGroup.buttons[1].pressed, baselineButtonGroup.buttons[0].pressed])
@@ -90,7 +90,7 @@ Item {
9090
}
9191
}
9292

93-
SwiftButton {
93+
Button {
9494
id: baselineZoomAllButton
9595

9696
onClicked: {
@@ -116,7 +116,7 @@ Item {
116116
}
117117
}
118118

119-
SwiftButton {
119+
Button {
120120
id: baselineCenterButton
121121

122122
onClicked: {
@@ -142,7 +142,7 @@ Item {
142142
}
143143
}
144144

145-
SwiftButton {
145+
Button {
146146
id: baselineResetFiltersButton
147147

148148
onPressed: backend_request_broker.baseline_plot([baselineButtonGroup.buttons[2].checked, baselineButtonGroup.buttons[1].pressed, baselineButtonGroup.buttons[0].pressed])

resources/ConnectionScreen.qml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Item {
157157
text: Constants.connection.serialLabel
158158
}
159159

160-
ComboBox {
160+
SwiftComboBox {
161161
id: serialDevice
162162

163163
Layout.preferredHeight: Constants.connection.dropdownHeight
@@ -191,7 +191,7 @@ Item {
191191
text: Constants.connection.baudrateLabel
192192
}
193193

194-
ComboBox {
194+
SwiftComboBox {
195195
id: serialDeviceBaudRate
196196

197197
Layout.preferredHeight: Constants.connection.dropdownHeight
@@ -207,7 +207,7 @@ Item {
207207
text: Constants.connection.flowLabel
208208
}
209209

210-
ComboBox {
210+
SwiftComboBox {
211211
id: serialDeviceFlowControl
212212

213213
Layout.preferredHeight: Constants.connection.dropdownHeight
@@ -247,7 +247,7 @@ Item {
247247
text: Constants.connection.hostLabel
248248
}
249249

250-
ComboBox {
250+
SwiftComboBox {
251251
id: tcpUrlBar
252252

253253
Layout.fillWidth: true
@@ -273,7 +273,7 @@ Item {
273273
text: Constants.connection.portLabel
274274
}
275275

276-
ComboBox {
276+
SwiftComboBox {
277277
id: tcpPortBar
278278

279279
Layout.preferredWidth: parent.width / 4
@@ -317,7 +317,7 @@ Item {
317317
text: Constants.connection.fileLabel
318318
}
319319

320-
ComboBox {
320+
SwiftComboBox {
321321
id: fileUrlBar
322322

323323
Layout.alignment: Qt.AlignLeft
@@ -348,7 +348,7 @@ Item {
348348
Layout.fillWidth: true
349349
}
350350

351-
SwiftButton {
351+
Button {
352352
id: closeButton
353353

354354
text: "Cancel"
@@ -359,7 +359,7 @@ Item {
359359
}
360360
}
361361

362-
SwiftButton {
362+
Button {
363363
id: connectButton
364364

365365
property string tooltipText: "Connect"

resources/LoggingBar.qml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Rectangle {
139139
RowLayout {
140140
anchors.fill: parent
141141

142-
ComboBox {
142+
SwiftComboBox {
143143
id: sbpLoggingFormat
144144

145145
currentIndex: 0
@@ -157,7 +157,7 @@ Rectangle {
157157
}
158158
}
159159

160-
ComboBox {
160+
SwiftComboBox {
161161
id: recordingFilenameText
162162

163163
Layout.fillWidth: true
@@ -171,7 +171,7 @@ Rectangle {
171171
visible: sbpLoggingButton.checked
172172
}
173173

174-
ComboBox {
174+
SwiftComboBox {
175175
id: folderPathBar
176176

177177
Layout.fillWidth: true

resources/LogoPopup.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Item {
5555
Layout.topMargin: 12
5656
Layout.alignment: Qt.AlignCenter
5757

58-
SwiftButton {
58+
Button {
5959
text: `Check for updates`
6060
Layout.preferredWidth: dialog.width / 4
6161
Layout.alignment: Qt.AlignLeft
@@ -64,7 +64,7 @@ Item {
6464
}
6565
}
6666

67-
SwiftButton {
67+
Button {
6868
id: closeButton
6969

7070
text: "Close"

0 commit comments

Comments
 (0)