forked from qt-creator/qt-creator
QmlDesigner: Add transient scroll bar
Add transient scroll bar to connections editor Change-Id: Id4afd661da2fcdeacd2a4a0de0e0b9999c14dec2 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
committed by
Henning Gründl
parent
7e09f7d4ff
commit
1327a2c7ce
@@ -13,10 +13,28 @@ ListView {
|
|||||||
|
|
||||||
property StudioTheme.ControlStyle style: StudioTheme.Values.viewBarButtonStyle
|
property StudioTheme.ControlStyle style: StudioTheme.Values.viewBarButtonStyle
|
||||||
|
|
||||||
|
property bool adsFocus: false
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
interactive: true
|
interactive: true
|
||||||
highlightMoveDuration: 0
|
highlightMoveDuration: 0
|
||||||
highlightResizeDuration: 0
|
highlightResizeDuration: 0
|
||||||
|
boundsMovement: Flickable.StopAtBounds
|
||||||
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
|
||||||
|
HoverHandler { id: hoverHandler }
|
||||||
|
|
||||||
|
ScrollBar.vertical: HelperWidgets.ScrollBar {
|
||||||
|
id: verticalScrollBar
|
||||||
|
parent: root
|
||||||
|
x: root.width - verticalScrollBar.width
|
||||||
|
y: 0
|
||||||
|
height: root.availableHeight
|
||||||
|
orientation: Qt.Vertical
|
||||||
|
|
||||||
|
show: (hoverHandler.hovered || root.focus || verticalScrollBar.inUse || root.adsFocus)
|
||||||
|
&& verticalScrollBar.isNeeded
|
||||||
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
dialog.hide()
|
dialog.hide()
|
||||||
|
@@ -13,14 +13,27 @@ ListView {
|
|||||||
|
|
||||||
property StudioTheme.ControlStyle style: StudioTheme.Values.viewBarButtonStyle
|
property StudioTheme.ControlStyle style: StudioTheme.Values.viewBarButtonStyle
|
||||||
|
|
||||||
|
property bool adsFocus: false
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
interactive: true
|
interactive: true
|
||||||
highlightMoveDuration: 0
|
highlightMoveDuration: 0
|
||||||
highlightResizeDuration: 0
|
highlightResizeDuration: 0
|
||||||
|
boundsMovement: Flickable.StopAtBounds
|
||||||
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
|
||||||
ScrollBar.vertical: ScrollBar {
|
HoverHandler { id: hoverHandler }
|
||||||
id: comboBoxPopupScrollBar
|
|
||||||
visible: root.height < root.contentHeight
|
ScrollBar.vertical: HelperWidgets.ScrollBar {
|
||||||
|
id: verticalScrollBar
|
||||||
|
parent: root
|
||||||
|
x: root.width - verticalScrollBar.width
|
||||||
|
y: 0
|
||||||
|
height: root.availableHeight
|
||||||
|
orientation: Qt.Vertical
|
||||||
|
|
||||||
|
show: (hoverHandler.hovered || root.focus || verticalScrollBar.inUse || root.adsFocus)
|
||||||
|
&& verticalScrollBar.isNeeded
|
||||||
}
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
|
@@ -14,6 +14,11 @@ Rectangle {
|
|||||||
|
|
||||||
color: StudioTheme.Values.themePanelBackground
|
color: StudioTheme.Values.themePanelBackground
|
||||||
|
|
||||||
|
property bool adsFocus: false
|
||||||
|
// objectName is used by the dock widget to find this particular ScrollView
|
||||||
|
// and set the ads focus on it.
|
||||||
|
objectName: "__mainSrollView"
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: column
|
id: column
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -109,6 +114,7 @@ Rectangle {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height - toolbar.height - column.spacing
|
height: parent.height - toolbar.height - column.spacing
|
||||||
model: ConnectionsEditorEditorBackend.connectionModel
|
model: ConnectionsEditorEditorBackend.connectionModel
|
||||||
|
adsFocus: root.adsFocus
|
||||||
}
|
}
|
||||||
|
|
||||||
BindingsListView {
|
BindingsListView {
|
||||||
@@ -116,6 +122,7 @@ Rectangle {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height - toolbar.height - column.spacing
|
height: parent.height - toolbar.height - column.spacing
|
||||||
model: ConnectionsEditorEditorBackend.bindingModel
|
model: ConnectionsEditorEditorBackend.bindingModel
|
||||||
|
adsFocus: root.adsFocus
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertiesListView {
|
PropertiesListView {
|
||||||
@@ -123,6 +130,7 @@ Rectangle {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height - toolbar.height - column.spacing
|
height: parent.height - toolbar.height - column.spacing
|
||||||
model: ConnectionsEditorEditorBackend.dynamicPropertiesModel
|
model: ConnectionsEditorEditorBackend.dynamicPropertiesModel
|
||||||
|
adsFocus: root.adsFocus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,10 +13,28 @@ ListView {
|
|||||||
|
|
||||||
property StudioTheme.ControlStyle style: StudioTheme.Values.viewBarButtonStyle
|
property StudioTheme.ControlStyle style: StudioTheme.Values.viewBarButtonStyle
|
||||||
|
|
||||||
|
property bool adsFocus: false
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
interactive: true
|
interactive: true
|
||||||
highlightMoveDuration: 0
|
highlightMoveDuration: 0
|
||||||
highlightResizeDuration: 0
|
highlightResizeDuration: 0
|
||||||
|
boundsMovement: Flickable.StopAtBounds
|
||||||
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
|
||||||
|
HoverHandler { id: hoverHandler }
|
||||||
|
|
||||||
|
ScrollBar.vertical: HelperWidgets.ScrollBar {
|
||||||
|
id: verticalScrollBar
|
||||||
|
parent: root
|
||||||
|
x: root.width - verticalScrollBar.width
|
||||||
|
y: 0
|
||||||
|
height: root.availableHeight
|
||||||
|
orientation: Qt.Vertical
|
||||||
|
|
||||||
|
show: (hoverHandler.hovered || root.focus || verticalScrollBar.inUse || root.adsFocus)
|
||||||
|
&& verticalScrollBar.isNeeded
|
||||||
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
dialog.hide()
|
dialog.hide()
|
||||||
|
@@ -457,6 +457,8 @@ void DockWidget::setFocused(bool focused)
|
|||||||
if (d->m_scrollArea)
|
if (d->m_scrollArea)
|
||||||
d->m_scrollArea->setProperty("focused", focused);
|
d->m_scrollArea->setProperty("focused", focused);
|
||||||
|
|
||||||
|
const QString customObjectName = QString("__mainSrollView");
|
||||||
|
|
||||||
QList<QQuickWidget *> quickWidgets = d->m_widget->findChildren<QQuickWidget *>();
|
QList<QQuickWidget *> quickWidgets = d->m_widget->findChildren<QQuickWidget *>();
|
||||||
|
|
||||||
for (const auto &quickWidget : std::as_const(quickWidgets)) {
|
for (const auto &quickWidget : std::as_const(quickWidgets)) {
|
||||||
@@ -464,7 +466,12 @@ void DockWidget::setFocused(bool focused)
|
|||||||
if (!rootItem)
|
if (!rootItem)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QQuickItem *scrollView = rootItem->findChild<QQuickItem *>("__mainSrollView");
|
if (rootItem->objectName() == customObjectName) {
|
||||||
|
rootItem->setProperty("adsFocus", focused);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QQuickItem *scrollView = rootItem->findChild<QQuickItem *>(customObjectName);
|
||||||
if (!scrollView)
|
if (!scrollView)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user