Project

General

Profile

Actions

Support #2069

closed
VV KD

Process scroll event in QTreeView

Support #2069: Process scroll event in QTreeView

Added by Vitaly Volochay about 13 years ago. Updated over 12 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.

KD Updated by Koen Deforche about 13 years ago Actions #1

  • 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

KD Updated by Koen Deforche about 13 years ago Actions #2

  • Assignee set to Koen Deforche

VV Updated by Vitaly Volochay about 13 years ago Actions #3

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.

KD Updated by Koen Deforche about 13 years ago Actions #4

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

VV Updated by Vitaly Volochay about 13 years ago Actions #5

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

KD Updated by Koen Deforche about 13 years ago Actions #6

  • Target version changed from 3.3.0 to 3.3.2

KD Updated by Koen Deforche over 12 years ago Actions #7

  • Status changed from Feedback to Resolved

KD Updated by Koen Deforche over 12 years ago Actions #8

  • Status changed from Resolved to Closed
Actions

Also available in: PDF Atom