1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Imagine
import QtQuick.Window
ApplicationWindow {
id: window
width: 1280
height: 720
minimumWidth: 1180
minimumHeight: 663
visible: true
title: "Qt Quick Controls - Imagine Style Example: Automotive"
readonly property color colorGlow: "#1d6d64"
readonly property color colorWarning: "#d5232f"
readonly property color colorMain: "#6affcd"
readonly property color colorBright: "#ffffff"
readonly property color colorLightGrey: "#888"
readonly property color colorDarkGrey: "#333"
readonly property int fontSizeExtraSmall: Qt.application.font.pixelSize * 0.8
readonly property int fontSizeMedium: Qt.application.font.pixelSize * 1.5
readonly property int fontSizeLarge: Qt.application.font.pixelSize * 2
readonly property int fontSizeExtraLarge: Qt.application.font.pixelSize * 5
Component.onCompleted: {
x = Screen.width / 2 - width / 2
y = Screen.height / 2 - height / 2
}
Shortcut {
sequence: "Ctrl+Q"
onActivated: Qt.quit()
}
Frame {
id: frame
anchors.fill: parent
anchors.margins: 90
RowLayout {
id: mainRowLayout
anchors.fill: parent
anchors.margins: 24
spacing: 36
Container {
id: leftTabBar
currentIndex: 1
Layout.fillWidth: false
Layout.fillHeight: true
ButtonGroup {
buttons: columnLayout.children
}
contentItem: ColumnLayout {
id: columnLayout
spacing: 3
Repeater {
model: leftTabBar.contentModel
}
}
FeatureButton {
id: navigationFeatureButton
text: qsTr("Navigation")
icon.name: "navigation"
Layout.fillHeight: true
}
FeatureButton {
text: qsTr("Music")
icon.name: "music"
checked: true
Layout.fillHeight: true
}
FeatureButton {
text: qsTr("Message")
icon.name: "message"
Layout.fillHeight: true
}
FeatureButton {
text: qsTr("Command")
icon.name: "command"
Layout.fillHeight: true
}
FeatureButton {
text: qsTr("Settings")
icon.name: "settings"
Layout.fillHeight: true
}
}
StackLayout {
currentIndex: leftTabBar.currentIndex
Layout.preferredWidth: 150
Layout.maximumWidth: 150
Layout.fillWidth: false
Item {}
ColumnLayout {
spacing: 12
ButtonGroup {
id: viewButtonGroup
buttons: viewTypeRowLayout.children
}
RowLayout {
id: viewTypeRowLayout
spacing: 3
Layout.bottomMargin: 12
Button {
text: qsTr("Compact")
font.pixelSize: fontSizeExtraSmall
checkable: true
checked: true
Layout.fillWidth: true
}
Button {
text: qsTr("Full")
font.pixelSize: fontSizeExtraSmall
checkable: true
Layout.fillWidth: true
}
}
LargeLabel {
text: qsTr("VOLUME")
color: "white"
font.pixelSize: fontSizeMedium
}
Dial {
id: volumeDial
from: 0
value: 42
to: 100
stepSize: 1
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 128
Layout.preferredHeight: 128
Label {
text: volumeDial.value.toFixed(0)
color: "white"
font.pixelSize: Qt.application.font.pixelSize * 3
anchors.centerIn: parent
}
}
ButtonGroup {
id: audioSourceButtonGroup
}
RowLayout {
Layout.topMargin: 8
LargeLabel {
id: radioOption
text: qsTr("RADIO")
color: "white"
font.pixelSize: fontSizeMedium
horizontalAlignment: Label.AlignLeft
Layout.fillWidth: true
}
LargeLabel {
text: qsTr("AUX")
color: colorLightGrey
font.pixelSize: fontSizeMedium * 0.8
horizontalAlignment: Label.AlignHCenter
glowEnabled: false
Layout.alignment: Qt.AlignBottom
Layout.fillWidth: true
}
LargeLabel {
text: qsTr("MP3")
color: colorDarkGrey
font.pixelSize: fontSizeMedium * 0.6
horizontalAlignment: Label.AlignRight
glowEnabled: false
Layout.alignment: Qt.AlignBottom
Layout.fillWidth: true
}
}
Frame {
id: stationFrame
leftPadding: 1
rightPadding: 1
topPadding: 1
bottomPadding: 1
Layout.fillWidth: true
Layout.fillHeight: true
Layout.preferredHeight: 128
ListView {
id: stationListView
clip: true
anchors.fill: parent
ScrollIndicator.vertical: ScrollIndicator {
parent: stationFrame
anchors.top: parent.top
anchors.right: parent.right
anchors.rightMargin: 1
anchors.bottom: parent.bottom
}
model: ListModel {
ListElement { name: "V-Radio"; frequency: "105.5" }
ListElement { name: "World News"; frequency: "93.4" }
ListElement { name: "TekStep FM"; frequency: "95.0" }
ListElement { name: "Classic Radio"; frequency: "89.9" }
ListElement { name: "Buena Vista FM"; frequency: "100.8" }
ListElement { name: "Drive-by Radio"; frequency: "99.1" }
ListElement { name: "Unknown #1"; frequency: "104.5" }
ListElement { name: "Unknown #2"; frequency: "91.2" }
ListElement { name: "Unknown #3"; frequency: "93.8" }
ListElement { name: "Unknown #4"; frequency: "80.4" }
ListElement { name: "Unknown #5"; frequency: "101.1" }
ListElement { name: "Unknown #6"; frequency: "92.2" }
}
delegate: ItemDelegate {
id: stationDelegate
width: stationListView.width
height: 22
text: model.name
font.pixelSize: fontSizeExtraSmall
topPadding: 0
bottomPadding: 0
contentItem: RowLayout {
Label {
text: model.name
font: stationDelegate.font
horizontalAlignment: Text.AlignLeft
elide: Text.ElideRight
Layout.fillWidth: true
}
Label {
text: model.frequency
font: stationDelegate.font
horizontalAlignment: Text.AlignRight
elide: Text.ElideRight
Layout.fillWidth: true
}
}
}
}
}
Frame {
Layout.fillWidth: true
Layout.fillHeight: false
ColumnLayout {
anchors.fill: parent
Label {
text: qsTr("Sort by")
font.pixelSize: fontSizeExtraSmall
}
ColumnLayout {
RadioButton {
text: qsTr("Name")
font.pixelSize: fontSizeExtraSmall
Layout.fillWidth: false
}
RadioButton {
text: qsTr("Frequency")
font.pixelSize: fontSizeExtraSmall
Layout.fillWidth: false
}
RadioButton {
text: qsTr("Favourites")
font.pixelSize: fontSizeExtraSmall
checked: true
Layout.fillWidth: false
}
}
}
}
}
}
Rectangle {
color: colorMain
implicitWidth: 1
Layout.fillHeight: true
}
ColumnLayout {
Layout.preferredWidth: 350
Layout.fillWidth: true
Layout.fillHeight: true
LargeLabel {
id: timeLabel
text: qsTr("11:02")
font.pixelSize: fontSizeExtraLarge
Layout.alignment: Qt.AlignHCenter
LargeLabel {
text: qsTr("AM")
font.pixelSize: fontSizeLarge
anchors.left: parent.right
anchors.leftMargin: 8
}
}
Label {
text: qsTr("01/01/2018")
color: colorLightGrey
font.pixelSize: fontSizeMedium
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 2
Layout.bottomMargin: 10
}
Image {
source: "qrc:/icons/car.png"
fillMode: Image.PreserveAspectFit
Layout.fillHeight: true
Column {
x: parent.width * 0.88
y: parent.height * 0.56
spacing: 3
Image {
source: "qrc:/icons/warning.png"
anchors.horizontalCenter: parent.horizontalCenter
}
LargeLabel {
text: qsTr("Door open")
color: colorWarning
}
}
}
}
Rectangle {
color: colorMain
implicitWidth: 1
Layout.fillHeight: true
}
ColumnLayout {
Row {
spacing: 8
Image {
source: "qrc:/icons/weather.png"
}
Column {
spacing: 8
Row {
anchors.horizontalCenter: parent.horizontalCenter
LargeLabel {
id: outsideTempValueLabel
text: qsTr("31")
font.pixelSize: fontSizeExtraLarge
}
LargeLabel {
text: qsTr("°C")
font.pixelSize: Qt.application.font.pixelSize * 2.5
anchors.baseline: outsideTempValueLabel.baseline
}
}
Label {
text: qsTr("Osaka, Japan")
color: colorLightGrey
font.pixelSize: fontSizeMedium
}
}
}
ColumnLayout {
id: airConRowLayout
spacing: 8
Layout.preferredWidth: 128
Layout.preferredHeight: 380
Layout.fillHeight: true
Item {
Layout.fillHeight: true
}
SwitchDelegate {
text: qsTr("AC")
leftPadding: 0
rightPadding: 0
topPadding: 0
bottomPadding: 0
Layout.fillWidth: true
}
// QTBUG-63269
Item {
implicitHeight: temperatureValueLabel.implicitHeight
Layout.fillWidth: true
Layout.topMargin: 16
Label {
text: qsTr("Temperature")
anchors.baseline: temperatureValueLabel.bottom
anchors.left: parent.left
}
LargeLabel {
id: temperatureValueLabel
text: qsTr("24°C")
font.pixelSize: fontSizeLarge
anchors.right: parent.right
}
}
Slider {
value: 0.35
Layout.fillWidth: true
}
// QTBUG-63269
Item {
implicitHeight: powerValueLabel.implicitHeight
Layout.fillWidth: true
Layout.topMargin: 16
Label {
text: qsTr("Power")
anchors.baseline: powerValueLabel.bottom
anchors.left: parent.left
}
LargeLabel {
id: powerValueLabel
text: qsTr("10%")
font.pixelSize: fontSizeLarge
anchors.right: parent.right
}
}
Slider {
value: 0.25
Layout.fillWidth: true
}
SwitchDelegate {
text: qsTr("Low")
leftPadding: 0
rightPadding: 0
topPadding: 0
bottomPadding: 0
Layout.fillWidth: true
Layout.topMargin: 16
}
SwitchDelegate {
text: qsTr("High")
checked: true
leftPadding: 0
rightPadding: 0
topPadding: 0
bottomPadding: 0
Layout.fillWidth: true
}
SwitchDelegate {
text: qsTr("Defog")
leftPadding: 0
rightPadding: 0
topPadding: 0
bottomPadding: 0
Layout.fillWidth: true
}
SwitchDelegate {
text: qsTr("Recirculate")
leftPadding: 0
rightPadding: 0
topPadding: 0
bottomPadding: 0
Layout.fillWidth: true
}
Item {
Layout.fillHeight: true
}
}
}
Container {
id: rightTabBar
currentIndex: 1
Layout.fillHeight: true
Layout.fillWidth: false
ButtonGroup {
buttons: rightTabBarContentLayout.children
}
contentItem: ColumnLayout {
id: rightTabBarContentLayout
spacing: 3
Repeater {
model: rightTabBar.contentModel
}
}
Item {
Layout.fillHeight: true
}
FeatureButton {
text: qsTr("Windows")
icon.name: "windows"
Layout.maximumHeight: navigationFeatureButton.height
Layout.fillHeight: true
Layout.fillWidth: false
}
FeatureButton {
text: qsTr("Air Con.")
icon.name: "air-con"
checked: true
Layout.maximumHeight: navigationFeatureButton.height
Layout.fillHeight: true
Layout.fillWidth: false
}
FeatureButton {
text: qsTr("Seats")
icon.name: "seats"
Layout.maximumHeight: navigationFeatureButton.height
Layout.fillHeight: true
Layout.fillWidth: false
}
FeatureButton {
text: qsTr("Statistics")
icon.name: "statistics"
Layout.maximumHeight: navigationFeatureButton.height
Layout.fillHeight: true
Layout.fillWidth: false
}
}
}
}
}
|