Project

General

Profile

Actions

Support #2069

closed

Process scroll event in QTreeView

Added by Vitaly Volochay over 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
Start date:
07/29/2013
Due date:
% Done:

0%

Estimated time:

Description

Hello! I want to process scrolling in QTreeView but there is no such signal.

I tried this:

wApp->declareJavaScriptFunction("onScroll", "function() { alert(\'Scroll event!\'); }");
tree->doJavaScript(tree->jsRef() + ".onscroll = " + wApp->javaScriptClass() + ".onScroll()");

but alert only shows up one time when widget creates and when I scroll view nothing happens.

How to make it working? May be I should use setJavaScriptMember() function?

Thanks in advance.

Actions #1

Updated by Koen Deforche over 10 years ago

  • Status changed from New to Feedback

Hey Vital,

Problems with QTreeView should probably be reported with digia :-)

What you are trying to get from WTreeView is not possible however, the treeview is a complex widget and its internal layout (including the scrollable region) is not accessible.

Before we try to make it accessible, what is your use case for this?

Regards,

koen

Actions #2

Updated by Koen Deforche over 10 years ago

  • Assignee set to Koen Deforche
Actions #3

Updated by Vitaly Volochay over 10 years ago

I have horizontal layout: on the left - WTreeView, on the right - WPaintedWidget which content depends on current scroll value. In other words I need to draw lines opposite tree nodes.

However I write this crazy js solution and it works:

wApp->declareJavaScriptFunction("SuperScroll",

"function() "

"{ console.log( \"Super scroll!\"); "

"var top = this.scrollTop;"

"console.log(\"this top:\", top);"

"console.log(\"this id:\", this.id)}");

treeView~~doJavaScript("var firstChild = " + treeView~~>jsRef() + ".children[0];"

"console.log(\"first child: \", firstChild.id);"

"var tree = firstChild.children[1];"

"console.log(\"tree: \", tree.id);"

"tree.addEventListener('scroll', " + wApp->javaScriptClass() + ".SuperScroll, false);");

I looked html dom hierarchy of WTreeView and find that second child of first child of WTreeView is proper scroll area, but I am a bit afraid of version problem if u change some code in WTreeView.

Actions #4

Updated by Koen Deforche over 10 years ago

Hey,

That sounds like a sensible use-case, indeed. I guess we the super-crazy hack would be simplified if we provide access to the widget that is the virtual scroll container --- that's probably a safe thing to do.

Regards,

koen

Actions #5

Updated by Vitaly Volochay over 10 years ago

Thank you, Koen, that would be nice with usage example.

Actions #6

Updated by Koen Deforche over 10 years ago

  • Target version changed from 3.3.0 to 3.3.2
Actions #7

Updated by Koen Deforche about 10 years ago

  • Status changed from Feedback to Resolved
Actions #8

Updated by Koen Deforche about 10 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF