summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergio Ahumada <sahumada@blackberry.com>2014-06-11 11:40:06 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-11 11:40:06 +0200
commitaea87565b41c3a757d9b5d9aa76528ca68068361 (patch)
tree4f9da2fecd6c787a86accad707d74db042f8f478
parent806a3d491432ebdf0ead05fada7ea6ff9af71701 (diff)
parent45d97d579256694e2c94bc64526e4aed96c27270 (diff)
downloadqtquickcontrols-aea87565b41c3a757d9b5d9aa76528ca68068361.tar.gz
Merge "Merge remote-tracking branch 'origin/stable' into 5.3" into refs/staging/5.3
-rw-r--r--src/controls/Styles/Desktop/TableViewStyle.qml6
-rw-r--r--src/controls/TableView.qml20
-rw-r--r--src/controls/qquickmenu.cpp20
-rw-r--r--src/controls/qquickmenu_p.h2
4 files changed, 35 insertions, 13 deletions
diff --git a/src/controls/Styles/Desktop/TableViewStyle.qml b/src/controls/Styles/Desktop/TableViewStyle.qml
index 33cc6779..5ad1f394 100644
--- a/src/controls/Styles/Desktop/TableViewStyle.qml
+++ b/src/controls/Styles/Desktop/TableViewStyle.qml
@@ -77,9 +77,9 @@ ScrollViewStyle {
hints: control.styleHints
properties: {"headerpos": headerPosition, "textalignment": styleData.textAlignment}
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 string headerPosition: !styleData.resizable && control.columnCount === 1 ? "only" :
+ !styleData.resizable && styleData.column === control.columnCount-1 ? "end" :
+ styleData.column === 0 ? "beginning" : ""
}
property Component rowDelegate: BorderImage {
diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml
index c04ba971..5feeac01 100644
--- a/src/controls/TableView.qml
+++ b/src/controls/TableView.qml
@@ -558,7 +558,7 @@ ScrollView {
id: listView
focus: true
activeFocusOnTab: root.activeFocusOnTab
- anchors.topMargin: tableHeader.height
+ anchors.topMargin: headerVisible ? tableHeader.height : 0
anchors.fill: parent
currentIndex: -1
visible: columnCount > 0
@@ -951,10 +951,10 @@ ScrollView {
delegate: Item {
id: headerRowDelegate
z:-index
- width: columnCount === 1 ? viewport.width + __verticalScrollBar.width : modelData.width
- implicitWidth: headerStyle.implicitWidth
+ width: modelData.width
+ implicitWidth: columnCount === 1 ? viewport.width + __verticalScrollBar.width : headerStyle.implicitWidth
visible: modelData.visible
- height: headerVisible ? headerStyle.height : 0
+ height: headerStyle.height
Loader {
id: headerStyle
@@ -967,6 +967,7 @@ ScrollView {
readonly property bool containsMouse: headerClickArea.containsMouse
readonly property int column: index
readonly property int textAlignment: modelData.horizontalAlignment
+ readonly property bool resizable: modelData.resizable
}
}
Rectangle{
@@ -1033,11 +1034,16 @@ ScrollView {
readonly property int textAlignment: modelData.horizontalAlignment
}
parent: tableHeader
- x: headerRowDelegate.x - listView.contentX
+ x: __implicitX
+ property double __implicitX: headerRowDelegate.x - listView.contentX
width: modelData.width
height: parent.height
sourceComponent: root.headerDelegate
visible: headerClickArea.pressed
+ onVisibleChanged: {
+ if (!visible)
+ x = Qt.binding(function () { return __implicitX })
+ }
opacity: 0.5
}
@@ -1045,13 +1051,13 @@ ScrollView {
MouseArea {
id: headerResizeHandle
property int offset: 0
- property int minimumSize: 20
+ readonly property int minimumSize: 20
preventStealing: true
anchors.rightMargin: -width/2
width: Settings.hasTouchScreen ? Screen.pixelDensity * 3.5 : 16
height: parent.height
anchors.right: parent.right
- enabled: modelData.resizable && columnCount > 1
+ enabled: modelData.resizable && columnCount > 0
onPositionChanged: {
var newHeaderWidth = modelData.width + (mouseX - offset)
modelData.width = Math.max(minimumSize, newHeaderWidth)
diff --git a/src/controls/qquickmenu.cpp b/src/controls/qquickmenu.cpp
index 8982b46c..c12060bf 100644
--- a/src/controls/qquickmenu.cpp
+++ b/src/controls/qquickmenu.cpp
@@ -275,14 +275,28 @@ QQuickMenu::~QQuickMenu()
m_platformMenu = 0;
}
+void QQuickMenu::syncParentMenuBar()
+{
+ QQuickMenuBar *menubar = qobject_cast<QQuickMenuBar *>(parent());
+ if (menubar && menubar->platformMenuBar())
+ menubar->platformMenuBar()->syncMenu(m_platformMenu);
+}
+
void QQuickMenu::setVisible(bool v)
{
QQuickMenuBase::setVisible(v);
if (m_platformMenu) {
m_platformMenu->setVisible(v);
- QQuickMenuBar *menubar = qobject_cast<QQuickMenuBar *>(parent());
- if (menubar && menubar->platformMenuBar())
- menubar->platformMenuBar()->syncMenu(m_platformMenu);
+ syncParentMenuBar();
+ }
+}
+
+void QQuickMenu::setEnabled(bool e)
+{
+ QQuickMenuText::setEnabled(e);
+ if (m_platformMenu) {
+ m_platformMenu->setEnabled(e);
+ syncParentMenuBar();
}
}
diff --git a/src/controls/qquickmenu_p.h b/src/controls/qquickmenu_p.h
index 85cc0107..73f5c505 100644
--- a/src/controls/qquickmenu_p.h
+++ b/src/controls/qquickmenu_p.h
@@ -109,6 +109,7 @@ public:
virtual ~QQuickMenu();
void setVisible(bool);
+ void setEnabled(bool);
int selectedIndex() const { return m_selectedIndex; }
void setSelectedIndex(int index);
@@ -149,6 +150,7 @@ protected Q_SLOTS:
private:
QQuickWindow *findParentWindow();
+ void syncParentMenuBar();
int itemIndexForListIndex(int listIndex) const;
void itemIndexToListIndex(int, int *, int *) const;