Overwrite internal properties
-
Hello,
is it possible to overwrite internal properties, for example: I need to overwrite the __popupStyle property:
@property Component __popupStyle: Style {property Component frame: Rectangle { width: (parent ? parent.contentWidth : 0) height: (parent ? parent.contentHeight : 0) + 2 border.color: "white" property real maxHeight: 500 property int margin: 1 } property Component menuItem: Text { text: "NOT IMPLEMENTED" color: "red" font { pixelSize: 14 bold: true } } property Component scrollerStyle: Style { padding { left: 0; right: 0; top: 0; bottom: 0 } property bool scrollToClickedPosition: false property Component frame: Item { visible: false } property Component corner: Item { visible: false } property Component __scrollbar: Item { visible: false } property bool useScrollers: true } }@
in the ComboBoxStyle.qml. But i want to overwrite it locally, so it should somehow like that:
@import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Controls.Private 1.0ComboBox {
width: 100; height: 30
model: ["Hello i am a very long string.", "Hello i am a very very long string."]
style: ComboBoxStyle {
__popupStyle: Style {
property Component frame: Rectangle {
width: (parent ? parent.contentWidth : 0)
height: (parent ? parent.contentHeight : 0) + 2
border.color: "white"
property real maxHeight: 500
property int margin: 1
}
property Component menuItem: Text {
text: "NOT IMPLEMENTED"
color: "red"
font {
pixelSize: 14
bold: true
}
}
property Component scrollerStyle: Style {
padding { left: 0; right: 0; top: 0; bottom: 0 }
property bool scrollToClickedPosition: false
property Component frame: Item { visible: false }
property Component corner: Item { visible: false }
property Component __scrollbar: Item { visible: false }
property bool useScrollers: true
}
}
}
}@
It detects the property but i can't overwrite it.To my questions: Is it possible to overwrite a property Component, if yes, how?
-- Update --
It looks like it is possible to overwrite and it also looks like i am theoretically doing it correct. I am searching for the drop-down list/popup properties, am i on the wrong way?
-
Found the property component i was searching for in the MenuStyle.qml which is used by Menu which is used by ComboBox. I am using a ComboBox and i need to change or overwrite this property:
@property Component menuItem: Rectangle{...}@
Is there any possibility for me to do that only for one ComboBox?
I really dont want to replace multiple control-components and styles with custom ones...