Source

Target

Showing with 245 additions and 153 deletions
......@@ -57,6 +57,8 @@ Item {
property int availableWidth
property int contentHeight
property int contentWidth
property real originX
property real originY
property int leftMargin: outerFrame ? root.__style.padding.left : 0
property int rightMargin: outerFrame ? root.__style.padding.right : 0
......@@ -74,6 +76,8 @@ Item {
wheelarea.availableHeight = viewport.height
wheelarea.contentWidth = flickableItem !== null ? flickableItem.contentWidth : 0
wheelarea.contentHeight = flickableItem !== null ? flickableItem.contentHeight : 0
wheelarea.originX = flickableItem !== null ? flickableItem.originX : 0
wheelarea.originY = flickableItem !== null ? flickableItem.originY : 0
recursionGuard = false
}
}
......@@ -123,8 +127,8 @@ Item {
visible: contentWidth > availableWidth
height: visible ? implicitHeight : 0
z: 1
maximumValue: contentWidth > availableWidth ? contentWidth - availableWidth : 0
minimumValue: 0
maximumValue: contentWidth > availableWidth ? originX + contentWidth - availableWidth : 0
minimumValue: originX
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: cornerFill.left
......@@ -158,8 +162,8 @@ Item {
width: visible ? implicitWidth : 0
z: 1
anchors.bottom: cornerFill.top
maximumValue: contentHeight > availableHeight ? contentHeight - availableHeight + __viewTopMargin : 0
minimumValue: 0
maximumValue: contentHeight > availableHeight ? originY + contentHeight - availableHeight + __viewTopMargin : 0
minimumValue: originY
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: __scrollBarTopMargin + topMargin
......
......@@ -195,7 +195,7 @@ FocusScope {
property int index: tabindex
property real availableWidth: tabbar.availableWidth
property QtObject tab: QtObject {
property QtObject styleData: QtObject {
readonly property alias index: tabitem.tabindex
readonly property alias selected: tabitem.selected
readonly property alias title: tabitem.title
......
TARGET = qtquickcontrolsprivate
TARGET = qtquickcontrolsprivateplugin
TARGETPATH = QtQuick/Controls/Private
QT += qml quick gui-private core-private
......
module QtQuick.Controls.Private
plugin qtquickcontrolsprivate
plugin qtquickcontrolsprivateplugin
AbstractCheckable 1.0 AbstractCheckable.qml
Control 1.0 Control.qml
FocusFrame 1.0 FocusFrame.qml
......
......@@ -938,8 +938,8 @@ QVariant QQuickStyleItem::styleHint(const QString &metric)
if (metric == "comboboxpopup") {
return qApp->style()->styleHint(QStyle::SH_ComboBox_Popup, m_styleoption);
} else if (metric == "highlightedTextColor") {
QPalette pal = qApp->palette();
pal.setCurrentColorGroup(active()? QPalette::Active : QPalette::Inactive);
QPalette pal = QApplication::palette("QAbstractItemView");
pal.setCurrentColorGroup(m_styleoption->palette.currentColorGroup());
return pal.highlightedText().color().name();
} else if (metric == "textColor") {
QPalette pal = qApp->palette();
......@@ -1192,8 +1192,11 @@ void QQuickStyleItem::paint(QPainter *painter)
pixmap.fill(Qt::transparent);
QPainter pixpainter(&pixmap);
qApp->style()->drawPrimitive(QStyle::PE_PanelItemViewRow, m_styleoption, &pixpainter);
if (!qApp->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected) && selected())
pixpainter.fillRect(m_styleoption->rect, m_styleoption->palette.highlight());
if ((style() == "mac" || !qApp->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected)) && selected()) {
QPalette pal = QApplication::palette("QAbstractItemView");
pal.setCurrentColorGroup(m_styleoption->palette.currentColorGroup());
pixpainter.fillRect(m_styleoption->rect, pal.highlight());
}
QPixmapCache::insert(pmKey, pixmap);
}
painter->drawPixmap(0, 0, pixmap);
......
......@@ -92,7 +92,13 @@ PaddedStyle {
bottom: 4
}
/*! The background of the button. */
/*! This defines the background of the button. In addition to the public
properties of \c control, the following state properties are available:
\table
\li readonly property bool styleData.hovered - The button is currently hovered.
\endtable
*/
property Component background: Item {
implicitWidth: 100
implicitHeight: 25
......@@ -129,7 +135,13 @@ PaddedStyle {
}
}
/*! The label of the button. */
/*! This defines the label of the button. In addition to the public
properties of \c control, the following state properties are available:
\table
\li readonly property bool styleData.hovered - The button is currently hovered.
\endtable
*/
property Component label: Text {
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
......@@ -149,6 +161,9 @@ PaddedStyle {
id: backgroundLoader
anchors.fill: parent
sourceComponent: background
property QtObject styleData: QtObject {
readonly property bool hovered: control.__containsMouse
}
}
Loader {
......@@ -159,6 +174,9 @@ PaddedStyle {
anchors.topMargin: padding.top
anchors.rightMargin: padding.right
anchors.bottomMargin: padding.bottom
property QtObject styleData: QtObject {
readonly property bool hovered: control.__containsMouse
}
}
}
}
......@@ -89,7 +89,7 @@ PaddedStyle {
/*! This property holds the visible contents of the progress bar
You can access the Slider through the \c control property.
For convenience, you can also access the readonly property \c controlState.progress
For convenience, you can also access the readonly property \c styleData.progress
which provides the current progress as a \c real in the range [0-1]
*/
padding { top: 0 ; left: 0 ; right: 0 ; bottom: 0 }
......
......@@ -95,9 +95,11 @@ PaddedStyle {
/*! This component controls the appearance of the
scroll bar background.
You can access the following state properties:
\list
\li property bool hovered
\li property bool horizontal
\li property bool styleData.hovered
\li property bool styleData.horizontal
\endlist
*/
......@@ -109,26 +111,28 @@ PaddedStyle {
anchors.fill: parent
color: "#ddd"
border.color: "#aaa"
anchors.rightMargin: horizontal ? -2 : -1
anchors.leftMargin: horizontal ? -2 : 0
anchors.topMargin: horizontal ? 0 : -2
anchors.bottomMargin: horizontal ? -1 : -2
anchors.rightMargin: styleData.horizontal ? -2 : -1
anchors.leftMargin: styleData.horizontal ? -2 : 0
anchors.topMargin: styleData.horizontal ? 0 : -2
anchors.bottomMargin: styleData.horizontal ? -1 : -2
}
}
/*! This component controls the appearance of the
scroll bar handle.
You can access the following state properties:
\list
\li property bool hovered
\li property bool pressed
\li property bool horizontal
\li property bool styleData.hovered
\li property bool styleData.pressed
\li property bool styleData.horizontal
\endlist
*/
property Component handle: BorderImage{
opacity: pressed ? 0.5 : hovered ? 1 : 0.8
source: "images/scrollbar-handle-" + (horizontal ? "horizontal" : "vertical") + ".png"
opacity: styleData.pressed ? 0.5 : styleData.hovered ? 1 : 0.8
source: "images/scrollbar-handle-" + (styleData.horizontal ? "horizontal" : "vertical") + ".png"
border.left: 2
border.top: 2
border.right: 2
......@@ -141,9 +145,9 @@ PaddedStyle {
You can access the following state properties:
\list
\li property bool hovered
\li property bool pressed
\li property bool horizontal
\li property bool styleData.hovered
\li property bool styleData.pressed
\li property bool styleData.horizontal
\endlist
*/
property Component incrementControl: Rectangle {
......@@ -161,13 +165,13 @@ PaddedStyle {
border.color: "#88ffffff"
}
Image {
source: horizontal ? "images/arrow-right.png" : "images/arrow-down.png"
source: styleData.horizontal ? "images/arrow-right.png" : "images/arrow-down.png"
anchors.centerIn: parent
opacity: control.enabled ? 0.7 : 0.5
}
gradient: Gradient {
GradientStop {color: pressed ? "lightgray" : "white" ; position: 0}
GradientStop {color: pressed ? "lightgray" : "lightgray" ; position: 1}
GradientStop {color: styleData.pressed ? "lightgray" : "white" ; position: 0}
GradientStop {color: styleData.pressed ? "lightgray" : "lightgray" ; position: 1}
}
}
}
......@@ -175,10 +179,12 @@ PaddedStyle {
/*! This component controls the appearance of the
scroll bar decrement button.
You can access the following state properties:
\list
\li property bool hovered
\li property bool pressed
\li property bool horizontal
\li property bool styleData.hovered
\li property bool styleData.pressed
\li property bool styleData.horizontal
\endlist
*/
property Component decrementControl: Rectangle {
......@@ -186,10 +192,10 @@ PaddedStyle {
implicitHeight: 16
Rectangle {
anchors.fill: parent
anchors.topMargin: horizontal ? 0 : -1
anchors.leftMargin: horizontal ? -1 : 0
anchors.bottomMargin: horizontal ? -1 : 0
anchors.rightMargin: horizontal ? 0 : -1
anchors.topMargin: styleData.horizontal ? 0 : -1
anchors.leftMargin: styleData.horizontal ? -1 : 0
anchors.bottomMargin: styleData.horizontal ? -1 : 0
anchors.rightMargin: styleData.horizontal ? 0 : -1
color: "lightgray"
Rectangle {
anchors.fill: parent
......@@ -198,15 +204,15 @@ PaddedStyle {
border.color: "#88ffffff"
}
Image {
source: horizontal ? "images/arrow-left.png" : "images/arrow-up.png"
source: styleData.horizontal ? "images/arrow-left.png" : "images/arrow-up.png"
anchors.centerIn: parent
anchors.verticalCenterOffset: horizontal ? 0 : -1
anchors.horizontalCenterOffset: horizontal ? -1 : 0
anchors.verticalCenterOffset: styleData.horizontal ? 0 : -1
anchors.horizontalCenterOffset: styleData.horizontal ? -1 : 0
opacity: control.enabled ? 0.7 : 0.5
}
gradient: Gradient {
GradientStop {color: pressed ? "lightgray" : "white" ; position: 0}
GradientStop {color: pressed ? "lightgray" : "lightgray" ; position: 1}
GradientStop {color: styleData.pressed ? "lightgray" : "white" ; position: 0}
GradientStop {color: styleData.pressed ? "lightgray" : "lightgray" ; position: 1}
}
border.color: "#aaa"
}
......@@ -217,14 +223,13 @@ PaddedStyle {
id: panel
property string activeControl: ""
property bool scrollToClickPosition: true
property var controlStateRef: controlState
implicitWidth: controlState.horizontal ? 200 : bg.implicitWidth
implicitHeight: controlState.horizontal ? bg.implicitHeight : 200
implicitWidth: __styleData.horizontal ? 200 : bg.implicitWidth
implicitHeight: __styleData.horizontal ? bg.implicitHeight : 200
function pixelMetric(arg) {
if (arg === "scrollbarExtent")
return (controlState.horizontal ? bg.height : bg.width);
return (__styleData.horizontal ? bg.height : bg.width);
return 0;
}
......@@ -240,7 +245,7 @@ PaddedStyle {
else if (itemIsHit(decrementLoader, argX, argY))
return "down";
else if (itemIsHit(bg, argX, argY)) {
if (controlState.horizontal && argX < handleControl.x || !controlState.horizontal && argY < handleControl.y)
if (__styleData.horizontal && argX < handleControl.x || !__styleData.horizontal && argY < handleControl.y)
return "upPage"
else
return "downPage"
......@@ -253,7 +258,7 @@ PaddedStyle {
if (arg === "handle") {
return Qt.rect(handleControl.x, handleControl.y, handleControl.width, handleControl.height);
} else if (arg === "groove") {
if (controlState.horizontal) {
if (__styleData.horizontal) {
return Qt.rect(incrementLoader.width - handleOverlap,
0,
__control.width - (incrementLoader.width + decrementLoader.width - handleOverlap * 2),
......@@ -278,49 +283,57 @@ PaddedStyle {
anchors.top: parent.top
anchors.left: parent.left
sourceComponent: decrementControl
property bool hovered: activeControl === "up"
property bool pressed: controlState.upPressed
property bool horizontal: controlState.horizontal
property QtObject styleData: QtObject {
readonly property bool hovered: activeControl === "up"
readonly property bool pressed: __styleData.upPressed
readonly property bool horizontal: __styleData.horizontal
}
}
Loader {
id: bg
anchors.top: controlState.horizontal ? undefined : incrementLoader.bottom
anchors.bottom: controlState.horizontal ? undefined : decrementLoader.top
anchors.left: controlState.horizontal ? incrementLoader.right : undefined
anchors.right: controlState.horizontal ? decrementLoader.left : undefined
anchors.top: __styleData.horizontal ? undefined : incrementLoader.bottom
anchors.bottom: __styleData.horizontal ? undefined : decrementLoader.top
anchors.left: __styleData.horizontal ? incrementLoader.right : undefined
anchors.right: __styleData.horizontal ? decrementLoader.left : undefined
sourceComponent: scrollBarBackground
property bool horizontal: controlState.horizontal
property bool hovered: activeControl !== "none"
property QtObject styleData: QtObject {
readonly property bool horizontal: __styleData.horizontal
readonly property bool hovered: activeControl !== "none"
}
}
Loader {
id: decrementLoader
anchors.bottom: controlState.horizontal ? undefined : parent.bottom
anchors.right: controlState.horizontal ? parent.right : undefined
anchors.bottom: __styleData.horizontal ? undefined : parent.bottom
anchors.right: __styleData.horizontal ? parent.right : undefined
sourceComponent: incrementControl
property bool hovered: activeControl === "down"
property bool pressed: controlState.downPressed
property bool horizontal: controlState.horizontal
property QtObject styleData: QtObject {
readonly property bool hovered: activeControl === "down"
readonly property bool pressed: __styleData.downPressed
readonly property bool horizontal: __styleData.horizontal
}
}
property var flickableItem: control.flickableItem
property int extent: Math.max(minimumHandleLength, controlState.horizontal ?
property int extent: Math.max(minimumHandleLength, __styleData.horizontal ?
(flickableItem ? flickableItem.width/flickableItem.contentWidth : 0 ) * bg.width :
(flickableItem ? flickableItem.height/flickableItem.contentHeight : 0) * bg.height)
Loader {
id: handleControl
height: controlState.horizontal ? implicitHeight : extent
width: controlState.horizontal ? extent : implicitWidth
height: __styleData.horizontal ? implicitHeight : extent
width: __styleData.horizontal ? extent : implicitWidth
anchors.top: bg.top
anchors.left: bg.left
anchors.topMargin: controlState.horizontal ? 0 : -handleOverlap + (__control.value / __control.maximumValue) * (bg.height + 2 * handleOverlap- height)
anchors.leftMargin: controlState.horizontal ? -handleOverlap + (__control.value / __control.maximumValue) * (bg.width + 2 * handleOverlap - width) : 0
anchors.topMargin: __styleData.horizontal ? 0 : -handleOverlap + (__control.value / __control.maximumValue) * (bg.height + 2 * handleOverlap- height)
anchors.leftMargin: __styleData.horizontal ? -handleOverlap + (__control.value / __control.maximumValue) * (bg.width + 2 * handleOverlap - width) : 0
sourceComponent: handle
property bool hovered: activeControl === "handle"
property bool pressed: controlState.handlePressed
property bool horizontal: controlState.horizontal
property QtObject styleData: QtObject {
readonly property bool hovered: activeControl === "handle"
readonly property bool pressed: __styleData.handlePressed
readonly property bool horizontal: __styleData.horizontal
}
}
}
......
......@@ -129,7 +129,7 @@ PaddedStyle {
/*! \internal */
property Component panel: Item {
id: styleitem
implicitWidth: controlState.contentWidth + 26
implicitWidth: styleData.contentWidth + 26
implicitHeight: backgroundLoader.implicitHeight
property color foregroundColor: spinboxStyle.textColor
......
......@@ -59,7 +59,7 @@ import QtQuick.Controls.Private 1.0
style: TabViewStyle {
frameOverlap: 1
tab: Rectangle {
color: tab.selected ? "steelblue" :"lightsteelblue"
color: styleData.selected ? "steelblue" :"lightsteelblue"
border.color: "steelblue"
implicitWidth: Math.max(text.width + 4, 80)
implicitHeight: 20
......@@ -67,8 +67,8 @@ import QtQuick.Controls.Private 1.0
Text {
id: text
anchors.centerIn: parent
text: tab.title
color: tab.selected ? "white" : "black"
text: styleData.title
color: styleData.selected ? "white" : "black"
}
}
frame: Rectangle { color: "steelblue" }
......@@ -119,16 +119,16 @@ Style {
}
/*! This defines the tab. You can access the tab state through the
\c tab property, with the following properties:
\c styleData property, with the following properties:
\table
\li readonly property int index - This is the current tab index.
\li readonly property bool selected - This is the active tab.
\li readonly property string title - Tab title text.
\li readonly property bool nextSelected - The next tab is selected.
\li readonly property bool previousSelected - The previous tab is selected.
\li readonly property bool hovered - The tab is currently under the mouse.
\li readonly property bool activeFocus - The tab button has keyboard focus.
\li readonly property int styleData.index - This is the current tab index.
\li readonly property bool styleData.selected - This is the active tab.
\li readonly property string styleData.title - Tab title text.
\li readonly property bool styleData.nextSelected - The next tab is selected.
\li readonly property bool styleData.previousSelected - The previous tab is selected.
\li readonly property bool styleData.hovered - The tab is currently under the mouse.
\li readonly property bool styleData.activeFocus - The tab button has keyboard focus.
\endtable
*/
property Component tab: Item {
......@@ -143,16 +143,16 @@ Style {
clip: true
Item {
anchors.fill: parent
anchors.bottomMargin: tab.selected ? 0 : 2
anchors.bottomMargin: styleData.selected ? 0 : 2
clip: true
BorderImage {
anchors.fill: parent
source: tab.selected ? "images/tab_selected.png" : "images/tab.png"
source: styleData.selected ? "images/tab_selected.png" : "images/tab.png"
border.top: 6
border.bottom: 6
border.left: 6
border.right: 6
anchors.topMargin: tab.selected ? 0 : 1
anchors.topMargin: styleData.selected ? 0 : 1
}
BorderImage {
anchors.fill: parent
......@@ -160,7 +160,7 @@ Style {
anchors.leftMargin: -2
anchors.rightMargin: -1
source: "images/focusframe.png"
visible: tab.activeFocus && tab.selected
visible: styleData.activeFocus && styleData.selected
border.left: 4
border.right: 4
border.top: 4
......@@ -170,7 +170,7 @@ Style {
Text {
id: textitem
anchors.centerIn: parent
text: tab.title
text: styleData.title
renderType: Text.NativeRendering
scale: control.tabPosition === Qt.TopEdge ? 1 : -1
color: __syspal.text
......
......@@ -70,12 +70,13 @@ ScrollViewStyle {
/* Delegate for header. This delegate is described in \l TableView::headerDelegate */
property Component headerDelegate: BorderImage {
source: "images/header.png"
border.left: 4
Text {
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
anchors.leftMargin: 4
text: itemValue
text: styleData.value
color: textColor
renderType: Text.NativeRendering
}
......@@ -93,21 +94,21 @@ ScrollViewStyle {
property Component rowDelegate: Rectangle {
implicitHeight: 20
implicitWidth: 80
property color selectedColor: hasActiveFocus ? "#38d" : "#999"
property color selectedColor: styleData.hasActiveFocus ? "#38d" : "#999"
gradient: Gradient {
GradientStop { color: rowSelected ? Qt.lighter(selectedColor, 1.3) : alternateBackground ? "#f2f2f2" : "white" ; position: 0 }
GradientStop { color: rowSelected ? Qt.lighter(selectedColor, 1.0) : alternateBackground ? "#f2f2f2" : "white" ; position: 1 }
GradientStop { color: styleData.selected ? Qt.lighter(selectedColor, 1.3) : styleData.alternate ? "#f2f2f2" : "white" ; position: 0 }
GradientStop { color: styleData.selected ? Qt.lighter(selectedColor, 1.0) : styleData.alternate ? "#f2f2f2" : "white" ; position: 1 }
}
Rectangle {
anchors.bottom: parent.bottom
width: parent.width
height: 1
color: rowSelected ? Qt.darker(selectedColor, 1.4) : "transparent"
color: styleData.elected ? Qt.darker(selectedColor, 1.4) : "transparent"
}
Rectangle {
anchors.top: parent.top
width: parent.width ; height: 1
color: rowSelected ? Qt.darker(selectedColor, 1.1) : "transparent"
color: styleData.elected ? Qt.darker(selectedColor, 1.1) : "transparent"
}
}
......@@ -123,18 +124,18 @@ ScrollViewStyle {
anchors.margins: 6
anchors.left: parent.left
anchors.right: parent.right
horizontalAlignment: itemTextAlignment
horizontalAlignment: styleData.textAlignment
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: 1
elide: itemElideMode
text: itemValue != undefined ? itemValue : ""
color: itemTextColor
elide: styleData.elideMode
text: styleData.value != undefined ? styleData.value : ""
color: styleData.textColor
renderType: Text.NativeRendering
}
Text {
id: sizehint
font: label.font
text: itemValue ? itemValue : ""
text: styleData.value ? styleData.value : ""
visible: false
}
}
......
......@@ -74,11 +74,11 @@ PaddedStyle {
elementType: "scrollbar"
hover: activeControl != "none"
activeControl: "none"
sunken: __control.upPressed | __control.downPressed | __control.handlePressed
sunken: __styleData.upPressed | __styleData.downPressed | __styleData.handlePressed
minimum: __control.minimumValue
maximum: __control.maximumValue
value: __control.value
horizontal: __control.orientation === Qt.Horizontal
horizontal: __styleData.horizontal
enabled: __control.enabled
implicitWidth: horizontal ? 200 : pixelMetric("scrollbarExtent")
......
......@@ -114,17 +114,17 @@ PaddedStyle {
id: styleitem
elementType: "spinbox"
anchors.fill: parent
sunken: (controlState.downEnabled && controlState.downPressed) || (controlState.upEnabled && controlState.upPressed)
hover: controlState.containsMouse
sunken: (styleData.downEnabled && styleData.downPressed) || (styleData.upEnabled && styleData.upPressed)
hover: styleData.containsMouse
hints: control.styleHints
hasFocus: control.activeFocus
enabled: control.enabled
value: (controlState.upPressed ? 1 : 0) |
(controlState.downPressed ? 1<<1 : 0) |
(controlState.upEnabled ? (1<<2) : 0) |
(controlState.downEnabled ? (1<<3) : 0)
contentWidth: controlState.contentWidth
contentHeight: controlState.contentHeight
value: (styleData.upPressed ? 1 : 0) |
(styleData.downPressed ? 1<<1 : 0) |
(styleData.upEnabled ? (1<<2) : 0) |
(styleData.downEnabled ? (1<<3) : 0)
contentWidth: styleData.contentWidth
contentHeight: styleData.contentHeight
}
}
}
......@@ -74,13 +74,13 @@ Style {
property Component tab: Item {
id: item
property string tabpos: control.count === 1 ? "only" : index === 0 ? "beginning" : index === control.count - 1 ? "end" : "middle"
property string selectedpos: tab.nextSelected ? "next" : tab.previousSelected ? "previous" : ""
property string selectedpos: styleData.nextSelected ? "next" : styleData.previousSelected ? "previous" : ""
property string orientation: control.tabPosition === Qt.TopEdge ? "Top" : "Bottom"
property int tabHSpace: __barstyle.pixelMetric("tabhspace");
property int tabVSpace: __barstyle.pixelMetric("tabvspace");
property int totalOverlap: tabOverlap * (control.count - 1)
property real maxTabWidth: (control.width + totalOverlap) / control.count
implicitWidth: Math.min(maxTabWidth, Math.max(50, styleitem.textWidth(tab.title)) + tabHSpace + 2)
implicitWidth: Math.min(maxTabWidth, Math.max(50, styleitem.textWidth(styleData.title)) + tabHSpace + 2)
implicitHeight: Math.max(styleitem.font.pixelSize + tabVSpace + 6, 0)
StyleItem {
......@@ -97,9 +97,9 @@ Style {
properties: { "hasFrame" : true }
hints: [orientation, tabpos, selectedpos]
selected: tab.selected
text: elidedText(tab.title, tabbarItem.elide, item.width - item.tabHSpace)
hover: tab.hovered
selected: styleData.selected
text: elidedText(styleData.title, tabbarItem.elide, item.width - item.tabHSpace)
hover: styleData.hovered
hasFocus: tabbarItem.activeFocus && selected
}
}
......
......@@ -46,8 +46,8 @@ ScrollViewStyle {
readonly property TableView control: __control
property bool activateItemOnSingleClick: __styleitem.styleHint("activateItemOnSingleClick")
property color textColor: __styleitem.styleHint("textColor")
property color highlightedTextColor: __styleitem.styleHint("highlightedTextColor")
property color textColor: __styleitem.textColor
property color highlightedTextColor: __styleitem.highlightedTextColor
property StyleItem __styleitem: StyleItem{
property color textColor: styleHint("textColor")
......@@ -55,25 +55,33 @@ ScrollViewStyle {
elementType: "item"
visible: false
active: control.activeFocus
onActiveChanged: {
highlightedTextColor = styleHint("highlightedTextColor")
textColor = styleHint("textColor")
}
}
property Component headerDelegate: StyleItem {
elementType: "header"
activeControl: itemSort
raised: true
sunken: itemPressed
text: itemValue
hover: itemContainsMouse
hints: itemPosition
sunken: styleData.pressed
text: styleData.value
hover: styleData.containsMouse
hints: headerPosition
property string itemSort: (control.sortIndicatorVisible && styleData.column === control.sortIndicatorColumn) ? (control.sortIndicatorOrder == Qt.AscendingOrder ? "up" : "down") : "";
property string headerPosition: control.columnCount === 1 ? "only" :
styleData.column === control.columnCount-1 ? "end" :
styleData.column === 0 ? "beginning" : ""
}
property Component rowDelegate: StyleItem {
id: rowstyle
elementType: "itemrow"
activeControl: alternateBackground ? "alternate" : ""
selected: rowSelected ? true : false
activeControl: styleData.alternate ? "alternate" : ""
selected: styleData.selected ? true : false
height: Math.max(16, rowstyle.implicitHeight)
active: hasActiveFocus
active: styleData.hasActiveFocus
}
property Component itemDelegate: Item {
......@@ -88,17 +96,17 @@ ScrollViewStyle {
font: __styleitem.font
anchors.left: parent.left
anchors.right: parent.right
horizontalAlignment: itemTextAlignment
horizontalAlignment: styleData.textAlignment
anchors.verticalCenter: parent.verticalCenter
elide: itemElideMode
text: itemValue != undefined ? itemValue : ""
color: itemTextColor
elide: styleData.elideMode
text: styleData.value !== undefined ? styleData.value : ""
color: styleData.textColor
renderType: Text.NativeRendering
}
Text {
id: sizehint
font: label.font
text: itemValue ? itemValue : ""
text: styleData.value ? styleData.value : ""
visible: false
}
}
......
Here are some tips if you need to run the Qt Quick Controls auto tests.
- Testplugin
Some autotests require the test plugin under testplugin/QtQuickControlsTests.
The test plugin is not installed (i.e. to the qml folder), so
in order for the tst_controls to find it, you can either:
- Run make check in the controls folder. The plugin will be found
at run time because IMPORTPATH is defined in the pro file.
- In Qt Creator run settings or in the console, set QML2_IMPORT_PATH
macro to the testplugin path. At run time QML2_IMPORT_PATH is used by
by qmlscene to find imports required.
i.e: export QML2_IMPORT_PATH=<path_qtquickcontrols_git_clone>/tests/auto/testplugin
- Use the -import command-line option:
$ cd build/qt5/qtquickcontrols/tests/auto/controls
$ ./tst_controls -import ../testplugin
- Running specific tests:
i) It is possible to run a single file using the -input option. For example:
$ ./tst_controls -input data/test.qml
$ ./tst_controls -input <full_path>/test.qml
Specifying the full path to the qml test file is for example needed for shadow builds.
ii) The -functions command-line option will return a list of the current tests functions.
It is possible to run a single test function using the name of the test function as an argument. For example:
tst_controls Test_Name::function1
......@@ -56,14 +56,14 @@ TableView {
}
headerDelegate: Text {
height: 40
text: itemValue
text: styleData.value
}
itemDelegate: Text {
width: parent.width
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
text: itemValue !== undefined ? itemValue : ""
color: itemTextColor
text: styleData.value !== undefined ? styleData.value : ""
color: styleData.textColor
MouseArea {
anchors.fill: parent
onClicked: table.test = 1
......
......@@ -178,22 +178,22 @@ Item {
setCoordinates(spinbox)
mouseMove(spinbox, mainCoord.x, mainCoord.y)
compare(spinbox.__controlState.containsMouse, true)
compare(spinbox.__controlState.upHovered, false)
compare(spinbox.__controlState.downHovered, false)
compare(spinbox.__styleData.containsMouse, true)
compare(spinbox.__styleData.upHovered, false)
compare(spinbox.__styleData.downHovered, false)
mouseMove(spinbox.parent, upCoord.x, upCoord.y)
compare(spinbox.__controlState.upHovered, true)
compare(spinbox.__controlState.downHovered, false)
compare(spinbox.__styleData.upHovered, true)
compare(spinbox.__styleData.downHovered, false)
mouseMove(spinbox, downCoord.x, downCoord.y)
compare(spinbox.__controlState.upHovered, false)
compare(spinbox.__controlState.downHovered, true)
compare(spinbox.__styleData.upHovered, false)
compare(spinbox.__styleData.downHovered, true)
mouseMove(spinbox, mainCoord.x - 2, mainCoord.y - 2)
compare(spinbox.__controlState.containsMouse, false)
compare(spinbox.__controlState.upHovered, false)
compare(spinbox.__controlState.downHovered, false)
compare(spinbox.__styleData.containsMouse, false)
compare(spinbox.__styleData.upHovered, false)
compare(spinbox.__styleData.downHovered, false)
spinbox.destroy()
}
......
The test plugin is not installed (i.e. to the qml folder).
In order for the tst_controls to find it, you can either:
- Run make check in the controls folder. The plugin will be found
at run time because IMPORTPATH is defined in the pro file.
- In Qt Creator run settings or in the console, set QML2_IMPORT_PATH
macro to the testplugin path. At run time QML2_IMPORT_PATH is used by
by qmlscene to find imports required.
i.e: export QML2_IMPORT_PATH=<path_qtquickcontrols_git_clone>/tests/auto/testplugin
......@@ -78,6 +78,12 @@ ApplicationWindow {
value: 1000
implicitWidth: 80
}
CheckBox {
id: largeCheck
text: "Large"
checked: false
implicitWidth: 80
}
Item { Layout.fillWidth: true }
}
}
......@@ -139,6 +145,7 @@ ApplicationWindow {
frameVisible: frameCheck.checked
text: loremIpsum + loremIpsum + loremIpsum + loremIpsum
anchors.fill: parent
font.pixelSize: largeCheck.checked ? 26 : 13
}
}
Tab {
......@@ -152,7 +159,7 @@ ApplicationWindow {
model: 30
delegate: Rectangle {
width: parent.width
height: 30
height: largeCheck.checked ? 60 : 30
Text {
anchors.fill: parent
anchors.margins: 4
......@@ -177,6 +184,17 @@ ApplicationWindow {
model: 10
frameVisible: frameCheck.checked
rowDelegate: Rectangle {
width: parent.width
height: largeCheck.checked ? 60 : 30
Rectangle {
anchors.bottom: parent.bottom
width: parent.width
height: 1
color: "darkgray"
}
}
TableViewColumn {title: "first"
width: view.viewport.width
}
......