Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
cc295bc9
Commit
cc295bc9
authored
May 31, 2010
by
Jörg Schummer
Committed by
Kai Koehne
Jun 08, 2010
Browse files
QuickDesigner.itemLibrary: enable mouse wheel interaction in items view
Task-number: BAUHAUS-657
parent
1373fc13
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/components/itemlibrary/itemlibrary.cpp
View file @
cc295bc9
...
...
@@ -153,6 +153,7 @@ ItemLibrary::ItemLibrary(QWidget *parent) :
QDeclarativeItem
*
rootItem
=
qobject_cast
<
QDeclarativeItem
*>
(
m_d
->
m_itemsView
->
rootObject
());
connect
(
rootItem
,
SIGNAL
(
itemSelected
(
int
)),
this
,
SLOT
(
showItemInfo
(
int
)));
connect
(
rootItem
,
SIGNAL
(
itemDragged
(
int
)),
this
,
SLOT
(
startDragAndDrop
(
int
)));
connect
(
this
,
SIGNAL
(
scrollItemsView
(
QVariant
)),
rootItem
,
SLOT
(
scrollView
(
QVariant
)));
connect
(
this
,
SIGNAL
(
resetItemsView
()),
rootItem
,
SLOT
(
resetView
()));
/* create Resources view and its model */
...
...
@@ -318,4 +319,14 @@ void ItemLibrary::showItemInfo(int /*itemLibId*/)
// qDebug() << "showing item info about id" << itemLibId;
}
void
ItemLibrary
::
wheelEvent
(
QWheelEvent
*
event
)
{
if
(
m_d
->
m_stackedWidget
->
currentIndex
()
==
0
&&
m_d
->
m_itemsView
->
rect
().
contains
(
event
->
pos
()))
{
emit
scrollItemsView
(
event
->
delta
());
event
->
accept
();
}
else
QFrame
::
wheelEvent
(
event
);
}
}
src/plugins/qmldesigner/components/itemlibrary/itemlibrary.h
View file @
cc295bc9
...
...
@@ -61,8 +61,12 @@ public Q_SLOTS:
void
startDragAndDrop
(
int
itemLibId
);
void
showItemInfo
(
int
itemLibId
);
protected:
void
wheelEvent
(
QWheelEvent
*
event
);
signals:
void
itemActivated
(
const
QString
&
itemName
);
void
scrollItemsView
(
QVariant
delta
);
void
resetItemsView
();
private:
...
...
src/plugins/qmldesigner/components/itemlibrary/qml/ItemsView.qml
View file @
cc295bc9
...
...
@@ -60,6 +60,10 @@ Rectangle {
// public
function
scrollView
(
delta
)
{
scrollbar
.
scroll
(
-
delta
/
style
.
scrollbarWheelDeltaFactor
)
}
function
resetView
()
{
expandAllEntries
()
scrollbar
.
reset
()
...
...
src/plugins/qmldesigner/components/itemlibrary/qml/ItemsViewStyle.qml
View file @
cc295bc9
...
...
@@ -41,6 +41,7 @@ Item {
property
string
scrollbarGradientMiddleColor
:
"
#656565
"
property
string
scrollbarGradientEndColor
:
"
#888888
"
property
int
scrollbarClickScrollAmount
:
40
property
int
scrollbarWheelDeltaFactor
:
4
property
string
itemNameTextColor
:
"
#FFFFFF
"
...
...
src/plugins/qmldesigner/components/itemlibrary/qml/Scrollbar.qml
View file @
cc295bc9
...
...
@@ -38,6 +38,10 @@ Item {
property
variant
flickable
function
scroll
(
delta
)
{
handle
.
y
=
Math
.
max
(
0
,
Math
.
min
(
scrollHeight
,
handle
.
y
+
delta
))
}
function
reset
()
{
handle
.
y
=
0
}
...
...
@@ -100,7 +104,7 @@ Item {
anchors.right
:
parent
.
right
anchors.top
:
parent
.
top
anchors.bottom
:
handle
.
top
onClicked
:
handle
.
y
=
Math
.
max
(
0
,
handle
.
y
-
style
.
scrollbarClickScrollAmount
)
onClicked
:
scroll
(
-
style
.
scrollbarClickScrollAmount
)
}
Item
{
...
...
@@ -151,6 +155,6 @@ Item {
anchors.right
:
parent
.
right
anchors.top
:
handle
.
bottom
anchors.bottom
:
parent
.
bottom
onClicked
:
handle
.
y
=
Math
.
min
(
scrollHeight
,
handle
.
y
+
style
.
scrollbarClickScrollAmount
)
onClicked
:
scroll
(
style
.
scrollbarClickScrollAmount
)
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment