forked from qt-creator/qt-creator
QmlDesigner.ItemLibrary: Updated scroll bar style
This commit is contained in:
committed by
Kai Koehne
parent
fac5b92194
commit
ba8317f60b
@@ -104,7 +104,7 @@ ItemLibraryTreeView::ItemLibraryTreeView(QWidget *parent) :
|
|||||||
connect(this, SIGNAL(clicked(const QModelIndex &)), this, SLOT(activateItem(const QModelIndex &)));
|
connect(this, SIGNAL(clicked(const QModelIndex &)), this, SLOT(activateItem(const QModelIndex &)));
|
||||||
setHeaderHidden(true);
|
setHeaderHidden(true);
|
||||||
setIndentation(20);
|
setIndentation(20);
|
||||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
|
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ reasons and then passed to the section views */
|
|||||||
anchors.topMargin: 3
|
anchors.topMargin: 3
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: scrollbar.left
|
anchors.right: scrollbarFrame.left
|
||||||
overShoot: false
|
overShoot: false
|
||||||
|
|
||||||
interactive: false
|
interactive: false
|
||||||
@@ -211,17 +211,25 @@ content position out of scope regarding the scrollbar. */
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Scrollbar {
|
Item {
|
||||||
id: scrollbar
|
id: scrollbarFrame
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: 2
|
anchors.topMargin: 2
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.bottomMargin: 2
|
anchors.bottomMargin: 1
|
||||||
anchors.left: parent.right
|
|
||||||
anchors.leftMargin: -10
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
// The next line unfortunately introduces a cyclic property binding (strangely,
|
||||||
|
// in SectionView)
|
||||||
|
// width: (itemsFlickable.contentHeight > itemsFlickable.height)? 11:0
|
||||||
|
width: 11
|
||||||
|
|
||||||
flickable: itemsFlickable
|
Scrollbar {
|
||||||
|
id: scrollbar
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.leftMargin: 1
|
||||||
|
|
||||||
|
flickable: itemsFlickable
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,9 +35,11 @@ Item {
|
|||||||
property string backgroundColor: "#4f4f4f"
|
property string backgroundColor: "#4f4f4f"
|
||||||
property string raisedBackgroundColor: "#e0e0e0"
|
property string raisedBackgroundColor: "#e0e0e0"
|
||||||
|
|
||||||
property string scrollbarBorderColor: "#8F8F8F"
|
property string scrollbarColor: "#444444"
|
||||||
property string scrollbarGradientStartColor: "#7E7E7E"
|
property string scrollbarBorderColor: "#333333"
|
||||||
property string scrollbarGradientEndColor: "#C6C6C6"
|
property string scrollbarGradientStartColor: "#393939"
|
||||||
|
property string scrollbarGradientMiddleColor: "#656565"
|
||||||
|
property string scrollbarGradientEndColor: "#888888"
|
||||||
property int scrollbarClickScrollAmount: 40
|
property int scrollbarClickScrollAmount: 40
|
||||||
|
|
||||||
property string itemNameTextColor: "#FFFFFF"
|
property string itemNameTextColor: "#FFFFFF"
|
||||||
|
|||||||
@@ -50,11 +50,17 @@ Item {
|
|||||||
|
|
||||||
property int scrollHeight: height - handle.height
|
property int scrollHeight: height - handle.height
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent;
|
anchors.top: parent.top
|
||||||
anchors.rightMargin: 1
|
anchors.topMargin: 2
|
||||||
anchors.bottomMargin: 1
|
anchors.bottom: parent.bottom
|
||||||
color: "transparent"
|
anchors.bottomMargin: 3
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
width: 6
|
||||||
|
radius: 3
|
||||||
|
color: style.scrollbarColor
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: style.scrollbarBorderColor
|
border.color: style.scrollbarBorderColor
|
||||||
}
|
}
|
||||||
@@ -101,9 +107,7 @@ Item {
|
|||||||
id: handle
|
id: handle
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: 1
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
// anchors.rightMargin: 1
|
|
||||||
height: Math.max(width, bar.height * Math.min(1, flickable.height / flickable.contentHeight))
|
height: Math.max(width, bar.height * Math.min(1, flickable.height / flickable.contentHeight))
|
||||||
|
|
||||||
property bool updateFlickable: true
|
property bool updateFlickable: true
|
||||||
@@ -113,29 +117,25 @@ Item {
|
|||||||
flickable.contentY = Math.max(0, flickable.contentHeight * y / bar.height)
|
flickable.contentY = Math.max(0, flickable.contentHeight * y / bar.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.height - 1
|
width: parent.height
|
||||||
height: parent.width - 1
|
height: parent.width
|
||||||
y: 1 - height
|
y: -height - 2
|
||||||
|
x: -2
|
||||||
rotation: 90
|
|
||||||
|
rotation: 90
|
||||||
transformOrigin: Item.BottomLeft
|
transformOrigin: Item.BottomLeft
|
||||||
|
|
||||||
color: "black"
|
border.color: style.scrollbarBorderColor
|
||||||
|
border.width: 1
|
||||||
|
radius: 3
|
||||||
Rectangle {
|
|
||||||
width: parent.width - 2
|
|
||||||
height: parent.height - 2
|
|
||||||
y: 1
|
|
||||||
x: 1
|
|
||||||
|
|
||||||
gradient: Gradient {
|
gradient: Gradient {
|
||||||
GradientStop { position: 0.0; color: style.scrollbarGradientStartColor }
|
GradientStop { position: 0.15; color: style.scrollbarGradientStartColor }
|
||||||
GradientStop { position: 1.0; color: style.scrollbarGradientEndColor }
|
GradientStop { position: 0.78; color: style.scrollbarGradientMiddleColor }
|
||||||
|
GradientStop { position: 0.80; color: style.scrollbarGradientEndColor }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|||||||
Reference in New Issue
Block a user