I have a scene with three layers and on the top most layer touch is enabled. On touching that layer once, the ccTouchesEnded is called multiple times (almost 15 times). I can't track the reason for this behavior.
My best guess is: are you sure this layer is only added once? If instances of that layer class have been added 15 times, it would explain the issue you see. Set a breakpoint where you add that particular layer to see if it happens to be added multiple times.
Related
Currently I'm searching for a possible solution to apply 2 Physical Renderers in the manifest on 1 applet. Is it possible at all? If so, do I have to extend one file with the other?
You can definitely use multiple Physical Renderers on a single applet by extending one of your PRs with a second one. Make sure that you define your Manifest Files in the correct order. To do that set the sequence number of your base PR to 1 and the extending PR to 2. Without a specified order you are likely to get dependency issues.
I'm trying to create structure to draw many graphs in separate sub windows one below another, something that looks like that :
I need to change the size of these graph by dragging lines separating them.
I tried using panes in wxAUI but resizing one affects other, and it seems to be rather unstable. The main problem is that when I'm moving one sash to another it starts pushing it. Maybe there is some way to solve it?
I also tried using multiple wxSplitterWindow each nested in another, but this strategy also seems to fail because resizing one window affects all nested inside and their splitters are moving due to sizing even if I try to cach event EVT_SPLITTER_SASH_POS_CHANGED.
Do you have any ideas how to solve that?
I'm afraid there is indeed no out of the box solution doing what you need. wxSplitterWindow itself is implemented using wxWidgets API, so you could adapt its code to create your own window supporting multiple splitters, AFAICS it should be quite straightforward but, still, will require some work.
I have a mapping in my application that must be maintained for every line.
When the user deletes a line, I'm trying to detect which line so I can update my mapping.
The contentsChange signal has where in the document a change occurred and how many characters are added or deleted, but at this point it's too late to determine what was there before the delete.
So far here's what I've been thinking about trying:
If I peek at the undo stack maybe I can get at the lines that were deleted, but this may not be reliably for large change blocks.
I could keep a previous state of the file for every change, and then try to look there when the signal is raised, but this seems like a lot of unnecessary overhead.
I could try to dig into the source and create a new signal before something is about to be deleted, but then I have to build my code and release this modification since I'm using LGPL.
I can put consecutive values in userState in every block and if when contentsChanged is fired, and I detect a gap in the consecutive values between the previous and next block from where the change occurs, I can infer the deleted blocks. The downside here is that I have to then update all of the remaining blocks after I detect a change to restore the consecutive values.
What's the most graceful (simplest and inexpensive) way to do this?
I'm using Qt5.2.1 with c++.
Edit:
I'm trying a major redesign of my application by putting more of my custom info in the user state directly in the block (per line since I don't have word wrap). If I can get by with this approach, it will avoid the problem of having detect when a line is deleted all together, but the problem is still an interesting one and I think it still begs for an an answer.
In other GUI frameworks, the operation stack that fed the undo stack had pre-change callbacks, and post-change callbacks. I think the pre-change callback is what's missing here. Or is there some better way I don't know about???
Just trying to wrap my head around QTouchEvent. Any help/advice is appreciated.
Specifically I'm a bit confused when a touch event is fired (for e.g. TouchBegin); does this represent only one unique touch point? If so why is there a list of touch points inside QTouchEvent?
If not, is it the case that Qt will group together several TouchBegin instances that happen in a given time fraction and deliver it as one event, with the list of points encapsulated in the event? Likewise a QTouchUpdate event will contain information about several touch points that are being updated at that time?
Also I assume that;
QTouchEvent::TouchPoint::id
will remain consistent throughout TouchBegin, TouchUpdate and TouchEnd. Meaning that in different touch events if I see a point with the same id, it is the same touch point that both events are referring to. Is this assumption correct?
FYI: I've been working with TUIO for sometime, so if someone is familiar with both Qt and TUIO a comparative explanation would be much easier for me to understand. I've read through Qt documentation as well, but wasn't able to find an answer to my question.
Still I'd really appreciate any help at all.
Thank you.
How exactly the events are reported seem to differ in different platforms. If you press it with two fingers, it can start with a single touch point (TouchBegin), and immediately follow that with a new QTouchEvent with two TouchUpdate points. But it can also group two touch points into the TouchBegin QTouchEvent. But I have also witnessed two TouchBegin events, event though this is kind of forbidden (see "Touch Point Grouping" in the QTouchEvent doc).
After the begin, there are again differences in the TouchUpdates. Sometimes you always get two points (or the amount you have fingers down) even if you lift one finger. In this case the pressure is 0 for the lifted finger "id". Alternatively you'll get the amount of touchpoint ids that are actually down.
The best way to understand how these are generated is to install an eventfilter and observe the events while you press them.
I am using wxWidgets and Visual C++ to create functionality similar to using Unix "tail -f" with rich formatting (colors, fonts, images) in a GUI. I am targeting both wxMSW and wxMAC.
The obvious answer is to use wxTextCtrl with wxTE_RICH, using calls to wxTextCtrl::SetDefaultStyle() and wxTextCtrl::WriteText().
However, on my 3ghz workstation, compiled in release mode, I am unable to keep tailing a log that grows on average of 1 ms per line, eventually falling behind. For each line, I am incurring:
Two calls to SetDefaultStyle()
Two calls two WriteText()
A call to Freeze() and Thaw() the widget
When running this, my CPU goes to 100% on one core using wxMSW after filling up roughly 20,000 lines. The program is visibly slower once it reaches a certain threshold, falling further behind.
I am open to using other controls (wxListCtrl, wxRichTextCtrl, etc).
Have you considered limiting the amount of lines in the view? When we had a similar issue, we just made sure never more than 10,000 lines are in the view. If more lines come in at the bottom we remove lines at the top. This was not using WxWidgets, it was using a native Cocoa UI on Mac, but the issue is the same. If a styled text view (with colors, formatting and pretty printing) grows to large, appending more data at the bottom becomes pretty slow.
Sounds like the control you are using is simply not built for the amount of data you are throwing at it. I would consider building a custom control. Here's some things you could take into account:
When a new line comes in, you don't need to re-render the previous lines... they don't change and the layout won't change due to the new data.
Try to only keep the visible portion plus a few screens of look-back in memory at a time. This would make it a little lighter... but you will have to do your own scroll management if you want the user to be able to scroll back further than your look-back and make it all appear to be seamless.
Don't necessarily update one line at a time. When there is new data, grab it all and update. If you get 10 lines really quickly, and you update the screen all at once, you might save on some of the overhead of doing it line by line.
Hope this helps.
Derive from wxVListBox. From the docs:
wxVListBox is a listbox-like control with the following two main differences from a regular listbox: it can have an arbitrarily huge number of items because it doesn't store them itself but uses OnDrawItem() callback to draw them (so it is a Virtual listbox) and its items can have variable height as determined by OnMeasureItem() (so it is also a listbox with the lines of Variable height).