Commit 50b61dbe authored by Ulf Hermann's avatar Ulf Hermann

WelcomePage: Fix scrolling logic

We only need one scrollable element in the WelcomePage. By passing
the height properties of inner elements to the outermost one we can
avoid multiple vertical scrollbars next to each other. Since this
removes the QScrollArea around the welcome page it fixes
QTCREATORBUG-10796

Task-number: QTCREATORBUG-10796

Change-Id: I08b0409e21f16be6c3e0e5a58f2665320d0a14fe
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent ad9b9e0d
......@@ -33,9 +33,10 @@ import widgets 1.0
Rectangle {
id: rectangle1
width: 1024
height: Math.min(3024, parent.height - y)
height: grid.contentHeight + 100
CustomizedGridView {
id: grid
anchors.rightMargin: 38
anchors.bottomMargin: 60
anchors.leftMargin: 38
......
......@@ -33,9 +33,10 @@ import widgets 1.0
Rectangle {
id: rectangle1
width: 1024
height: Math.min(3024, parent.height - y)
height: grid.contentHeight + 100
CustomizedGridView {
id: grid
anchors.rightMargin: 38
anchors.bottomMargin: 60
anchors.leftMargin: 38
......
......@@ -29,43 +29,46 @@
import QtQuick 2.1
import widgets 1.0
import QtQuick.Controls 1.0
Rectangle {
width: 920
height: 600
color: "#edf0f2"
id: root
ScrollView {
id: scrollView
property var fonts: CustomFonts {}
property var colors: CustomColors { }
Rectangle {
width: Math.max(920, scrollView.flickableItem.width - 30)
height: Math.max(loader.height, scrollView.flickableItem.height);
SideBar {
id: sideBar
model: pagesModel
anchors.top: parent.top
anchors.bottom: parent.bottom
id: root
}
SideBar {
id: sideBar
model: pagesModel
anchors.top: parent.top
anchors.bottom: parent.bottom
Rectangle {
color: "#737373"
width: 1
height: parent.height
}
anchors.right: sideBar.right
}
Rectangle {
color: "#737373"
width: 1
height: parent.height
QtObject {
id: tab
property int currentIndex: sideBar.currentIndex
}
anchors.right: sideBar.right
}
PageLoader {
anchors.top: parent.top
model: pagesModel
anchors.bottom: parent.bottom
anchors.left: sideBar.right
anchors.right: parent.right
}
QtObject {
id: tab
property int currentIndex: sideBar.currentIndex
}
PageLoader {
id: loader
model: pagesModel
anchors.left: sideBar.right
anchors.right: parent.right
}
}
}
......@@ -30,33 +30,30 @@
import QtQuick 2.1
import QtQuick.Controls 1.0
ScrollView {
GridView {
x: Math.max((width - (cellWidth * columns)) / 2, 0);
property alias model: gridView.model
GridView {
id: gridView
interactive: false
cellHeight: 240
cellWidth: 216
property int columns: Math.max(Math.floor(width / cellWidth), 1)
id: gridView
interactive: false
cellHeight: 240
cellWidth: 216
property int columns: Math.max(Math.floor(width / cellWidth), 1)
delegate: Delegate {
id: delegate
delegate: Delegate {
id: delegate
property bool isHelpImage: model.imageUrl.search(/qthelp/) != -1
property string sourcePrefix: isHelpImage ? "image://helpimage/" : ""
property bool isHelpImage: model.imageUrl.search(/qthelp/) != -1
property string sourcePrefix: isHelpImage ? "image://helpimage/" : ""
property string mockupSource: model.imageSource
property string helpSource: model.imageUrl !== "" ? sourcePrefix + encodeURI(model.imageUrl) : ""
property string mockupSource: model.imageSource
property string helpSource: model.imageUrl !== "" ? sourcePrefix + encodeURI(model.imageUrl) : ""
imageSource: model.imageSource === undefined ? helpSource : mockupSource
videoSource: model.imageSource === undefined ? model.imageUrl : mockupSource
imageSource: model.imageSource === undefined ? helpSource : mockupSource
videoSource: model.imageSource === undefined ? model.imageUrl : mockupSource
caption: model.name;
description: model.description
isVideo: model.isVideo === true
videoLength: model.videoLength !== undefined ? model.videoLength : ""
tags: model.tags
}
caption: model.name;
description: model.description
isVideo: model.isVideo === true
videoLength: model.videoLength !== undefined ? model.videoLength : ""
tags: model.tags
}
}
......@@ -34,10 +34,16 @@ Item {
property alias model: repeater.model
height: repeater.height
Repeater {
id: repeater
height: itemAt(tab.currentIndex).height
Loader {
anchors.fill: parent
id: loader
anchors.left: parent.left
anchors.right: parent.right
height: item.height
property bool active: index === tab.currentIndex
property bool wasActive
onActiveChanged: {
......
......@@ -35,7 +35,7 @@ Column {
spacing: 16
signal itemChanged
property int currentIndex: 0
property int currentIndex: -1
onCurrentIndexChanged: welcomeMode.activePlugin = currentIndex
Component.onCompleted: currentIndex = welcomeMode.activePlugin
......
......@@ -165,15 +165,9 @@ WelcomeMode::WelcomeMode() :
styledBar->setObjectName(QLatin1String("WelcomePageStyledBar"));
layout->addWidget(styledBar);
QScrollArea *scrollArea = new QScrollArea(m_modeWidget);
scrollArea->setFrameShape(QFrame::NoFrame);
scrollArea->setWidgetResizable(true);
QWidget *container = QWidget::createWindowContainer(m_welcomePage, scrollArea);
container->setMinimumSize(QSize(880, 548));
scrollArea->setWidget(container);
QWidget *container = QWidget::createWindowContainer(m_welcomePage, m_modeWidget);
m_modeWidget->setLayout(layout);
layout->addWidget(scrollArea);
layout->addWidget(container);
connect(PluginManager::instance(), SIGNAL(objectAdded(QObject*)), SLOT(welcomePluginAdded(QObject*)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment