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 bool adsFocus: false
|
||||
|
||||
clip: true
|
||||
interactive: true
|
||||
highlightMoveDuration: 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: {
|
||||
dialog.hide()
|
||||
|
@@ -13,14 +13,27 @@ ListView {
|
||||
|
||||
property StudioTheme.ControlStyle style: StudioTheme.Values.viewBarButtonStyle
|
||||
|
||||
property bool adsFocus: false
|
||||
|
||||
clip: true
|
||||
interactive: true
|
||||
highlightMoveDuration: 0
|
||||
highlightResizeDuration: 0
|
||||
boundsMovement: Flickable.StopAtBounds
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
id: comboBoxPopupScrollBar
|
||||
visible: root.height < root.contentHeight
|
||||
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: {
|
||||
|
@@ -14,6 +14,11 @@ Rectangle {
|
||||
|
||||
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 {
|
||||
id: column
|
||||
anchors.fill: parent
|
||||
@@ -109,6 +114,7 @@ Rectangle {
|
||||
width: parent.width
|
||||
height: parent.height - toolbar.height - column.spacing
|
||||
model: ConnectionsEditorEditorBackend.connectionModel
|
||||
adsFocus: root.adsFocus
|
||||
}
|
||||
|
||||
BindingsListView {
|
||||
@@ -116,6 +122,7 @@ Rectangle {
|
||||
width: parent.width
|
||||
height: parent.height - toolbar.height - column.spacing
|
||||
model: ConnectionsEditorEditorBackend.bindingModel
|
||||
adsFocus: root.adsFocus
|
||||
}
|
||||
|
||||
PropertiesListView {
|
||||
@@ -123,6 +130,7 @@ Rectangle {
|
||||
width: parent.width
|
||||
height: parent.height - toolbar.height - column.spacing
|
||||
model: ConnectionsEditorEditorBackend.dynamicPropertiesModel
|
||||
adsFocus: root.adsFocus
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -13,10 +13,28 @@ ListView {
|
||||
|
||||
property StudioTheme.ControlStyle style: StudioTheme.Values.viewBarButtonStyle
|
||||
|
||||
property bool adsFocus: false
|
||||
|
||||
clip: true
|
||||
interactive: true
|
||||
highlightMoveDuration: 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: {
|
||||
dialog.hide()
|
||||
|
@@ -457,6 +457,8 @@ void DockWidget::setFocused(bool focused)
|
||||
if (d->m_scrollArea)
|
||||
d->m_scrollArea->setProperty("focused", focused);
|
||||
|
||||
const QString customObjectName = QString("__mainSrollView");
|
||||
|
||||
QList<QQuickWidget *> quickWidgets = d->m_widget->findChildren<QQuickWidget *>();
|
||||
|
||||
for (const auto &quickWidget : std::as_const(quickWidgets)) {
|
||||
@@ -464,7 +466,12 @@ void DockWidget::setFocused(bool focused)
|
||||
if (!rootItem)
|
||||
continue;
|
||||
|
||||
QQuickItem *scrollView = rootItem->findChild<QQuickItem *>("__mainSrollView");
|
||||
if (rootItem->objectName() == customObjectName) {
|
||||
rootItem->setProperty("adsFocus", focused);
|
||||
continue;
|
||||
}
|
||||
|
||||
QQuickItem *scrollView = rootItem->findChild<QQuickItem *>(customObjectName);
|
||||
if (!scrollView)
|
||||
continue;
|
||||
|
||||
|
Reference in New Issue
Block a user