[Interest] Issue with ComboBox style properties in QtQuick.Controls 2.1
Mark R Youngquist
mark.youngquist at legrand.us
Thu May 18 16:21:29 CEST 2017
Qt Quick Controls 2 does not use the style property as controls 1 does.
See documentation here for customizing the look and feel:
https://doc.qt.io/qt-5/qtquickcontrols2-customize.html#customizing-combobox
Customizing Qt Quick Controls 2 | Qt Quick Controls 2 5.8<https://doc.qt.io/qt-5/qtquickcontrols2-customize.html#customizing-combobox>
doc.qt.io
Qt Quick Controls 2 consist of a hierarchy (tree) of items. In order to provide a custom look and feel, the default QML implementation of each item can be replaced ...
<http://vantagecontrols.com>
________________________________
From: Interest <interest-bounces+mark.youngquist=vantagecontrols.com at qt-project.org> on behalf of Nibedit Dey <nibedit.dev at gmail.com>
Sent: Thursday, May 18, 2017 8:11:11 AM
To: interest at qt-project.org
Subject: [Interest] Issue with ComboBox style properties in QtQuick.Controls 2.1
Hello Everyone,
I am trying to use SwipeView and ComboBoxStyle together in a file. In QtQuick.Controls 2.1, seems like style properties is not there.
I tried to mix both modules. I believe we shouldn't do this.
But when I experimented this approach to use SwipeView and ComboboxStyle together.
Please refer to the snippets below.
In first case, QtQuick.Controls 2.1 is used before 1.4. Hence it works properly.
In second case, QtQuick.Controls 1.4 is used before 2.1 and it gives error.
In third case, I mixed and accessed with another name and it fails again.
Is it a bug in ComboBox implementation in QtQuick.Controls 2.1? How can I use both SwipeView and ComboBoxStyle together?
Snippet 1: //Works
import QtQuick 2.5
import QtQuick.Window 2.2
import QtQuick.Controls 2.1
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
Window {
visible: true
width: 640
height: 480
title: qsTr("Snippet 1")
SwipeView{
currentIndex: 0
anchors.fill : parent
Item {
id: page1
ComboBox {
x: 100
width: 200
model: [ "Apple","Banana", "Orange","Others" ]
style: ComboBoxStyle {
id: comboBox
background: Rectangle {
id: rectCategory
color: "transparent"
border.width: 1
border.color: "gray"
radius: 15
}
label: Text {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 20
font.capitalization: Font.SmallCaps
color: "#40C0FF"
text: control.currentText
}
}
}
}
Item {
id:page2
}
}
}
Snippet 2:
Cannot assign to non-existent property "style"
import QtQuick 2.5
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls 2.1
Window {
visible: true
width: 640
height: 480
title: qsTr("Snippet 2")
SwipeView{
currentIndex: 0
anchors.fill : parent
Item {
id: page1
ComboBox {
x: 100
width: 200
model: [ "Apple","Banana", "Orange","Others" ]
style: ComboBoxStyle {
id: comboBox
background: Rectangle {
id: rectCategory
color: "transparent"
border.width: 1
border.color: "gray"
radius: 15
}
label: Text {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 20
font.capitalization: Font.SmallCaps
color: "#40C0FF"
text: control.currentText
}
}
}
}
Item {
id:page2
}
}
}
Snippet 3:
Error: NewControls.SwipeView is not a type
import QtQuick 2.5
import QtQuick.Window 2.2
import QtQuick.Controls 2.1 as OldControls
import QtQuick.Controls 1.4 as NewControls
import QtQuick.Controls.Styles 1.4
Window {
visible: true
width: 640
height: 480
title: qsTr("Snippet 3")
NewControls.SwipeView{
currentIndex: 0
anchors.fill : parent
Item {
id: page1
OldControls.ComboBox {
x: 100
width: 200
model: [ "Apple","Banana", "Orange","Others" ]
style: ComboBoxStyle {
id: comboBox
background: Rectangle {
id: rectCategory
color: "transparent"
border.width: 1
border.color: "gray"
radius: 15
}
label: Text {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 20
font.capitalization: Font.SmallCaps
color: "#40C0FF"
text: control.currentText
}
}
}
}
Item {
id:page2
}
}
}
Let me know, your suggestions.
Regards,
Nibedit
________________________________
Ce message, ainsi que tous les fichiers joints ? ce message, peuvent contenir des informations sensibles et/ ou confidentielles ne devant pas ?tre divulgu?es. Si vous n'?tes pas le destinataire de ce message (ou que vous recevez ce message par erreur), nous vous remercions de le notifier imm?diatement ? son exp?diteur, et de d?truire ce message. Toute copie, divulgation, modification, utilisation ou diffusion, non autoris?e, directe ou indirecte, de tout ou partie de ce message, est strictement interdite.
Se d?sabonner: Si vous souhaitez ?tre retir? de notre liste de diffusion, s'il vous pla?t envoyer vos coordonn?es ? CASL.unsubscribe at legrand.ca<mailto:casl.unsubscribe at legrand.ca> et indiquer quels sont les messages que vous ne souhaitez plus recevoir.
This e-mail, and any document attached hereby, may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized, direct or indirect, copying, disclosure, distribution or other use of the material or parts thereof is strictly forbidden.
Unsubscribe: If you would like to be removed from our mailing list, please send your contact information to CASL.unsubscribe at legrand.ca<mailto:casl.unsubscribe at legrand.ca> and indicate what messages you no longer wish to receive.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170518/13481257/attachment.html>
More information about the Interest
mailing list