PDA

View Full Version : how to stop signals propagation further



babu198649
21st November 2007, 14:50
hi
i have a listview which on double clicked on the icon can expand(invoking a custom slot to expand)
when clicked on the region other than the icon nothing expands(custom slot is not invoked)
so how to catch this signal and also that this signal should not be propagated further (because the custom slot will get executed).

travis
21st November 2007, 15:00
Calling accept() on event stop furthur propagation.

babu198649
21st November 2007, 15:04
yes but how to stop in build signals such as the
buttonClicked() signal in qbuttongroup class

wysota
21st November 2007, 22:46
You can always blockSignals()... but I don't see a reason in doing so. About your expanding problem - can't you connect the clicked() signal of the view to a slot of yours and call expand() on the index you get as the argument?

babu198649
22nd November 2007, 06:06
yes that is what i am doing when it is clicked on the icon of qdir

but when clicked on the other part,where there are no icons i need the screen to maximize and hide some of the widgets

wysota
22nd November 2007, 11:03
Could you post a screenshot of the application window? I have trouble understanding what we are facing.

babu198649
22nd November 2007, 13:58
i have attached the screen shot

in the fourth window i have marked the area (dotted lines that surround " / " )which happens due to the click(where click is written manually) in the outer side of the icons presenting area.


when clicked on the icons the doubleclicked signal of listview is emitted ,but not on the area ,other than the icons present.

wysota
22nd November 2007, 14:34
And you want that "/" item not to be "clickable"? It's enough if you call QModelIndex::isValid() in your slot and exit the slot if it returns false.

babu198649
22nd November 2007, 14:47
no

1) when clicked on the icon it shows sub directories(implemented by catching the
clicked() signal) which is fine

2) when clicked other than icon all the other windows (total 4 windows) should be hidden.

pardon if i cant explain clearly

wysota
22nd November 2007, 16:12
In that case you need to reimplement the mouseReleaseEvent for the viewport and use indexAt() to check for the index under pointer. If it's invalid, emit a custom signal (like clickedInvalid()) or hide the other views manually. If it's valid, call the base class implementation of the event handler and it will emit clicked() for you.

babu198649
27th November 2007, 09:53
thanks u wysota
i have not replied so long because only now i have understood your point.
till now i was searching a way around without using indexat function

wysota
27th November 2007, 11:13
And look how much time you wasted instead of using a method that was designed for what you want.

babu198649
27th November 2007, 11:21
right
but there are lot of functions and understanding the functionalities of all the functions takes time:)

wysota
27th November 2007, 11:25
Using Qt Assistant and browsing API of the classes you use is essential.