[For coders / stylesheet authors] Introducing the Snooper

MusE is a MIDI/Audio sequencer with recording and editing capabilities, aiming to be a complete multitrack virtual studio for Linux. http://muse-sequencer.org/

Moderators: khz, MattKingUSA, spamatica

Tim E. Real
Established Member
Posts: 289
Joined: Sat Sep 15, 2012 12:36 am

[For coders / stylesheet authors] Introducing the Snooper

Postby Tim E. Real » Wed Nov 27, 2019 5:10 am

In github master now:

Hi all. For those interested in designing styleheets for MusE, or just interested in object hierarchy, I present...
The Snooper:

If you don't see a desired property listed, you can always request we add it.
If it's one of our own controls there's a good chance we can get around to adding it.

It will not auto-update when something new is created. You must click 'Update tree'.
Be ware of that when say, switching selected tracks in the Arranger, since the mixer strip is destroyed
and recreated each time a different track is selected.
I'm thinking of installing an auto-update timer, but we'll see...

Snooper 1.jpeg
You do not have the required permissions to view the files attached to this post.

kybos
Established Member
Posts: 23
Joined: Wed Oct 23, 2019 5:50 am

Re: [For coders / stylesheet authors] Introducing the Snooper

Postby kybos » Wed Nov 27, 2019 4:17 pm

Very useful!
It's a little lost in the settings behind the current style sheet, I would almost say it deserved a more prominent place, e.g. in the help menu. Actually it's a generic tool, useful for debugging, learning the code etc., not only for style sheet design.

By the way: What is the menu entry "Did you know?" for? It does not do anything (for me at least).

Tim E. Real
Established Member
Posts: 289
Joined: Sat Sep 15, 2012 12:36 am

Re: [For coders / stylesheet authors] Introducing the Snooper

Postby Tim E. Real » Wed Nov 27, 2019 6:03 pm

Hang in there... Trying to improve it even more with realtime event propagation monitoring up the ownership chain.

[Edit:] Progress! I used QObject::installEventFilter() on each listed object
instead of brutally tapping into the 'main vein' QCoreApplication::notify() chain.
I get notification of each event as it passes up the food chain to each object.
:idea: That means we should be able to show who 'accepted' the event, and who stopped the further propagation.
Oh, this is going to be fun. Flashing coloured indicators on each line in the tree... Just like a real snooper.

On Windows we had these fantastic tools called 'snoopers' or 'tree walkers'.
They could monitor any running executable and show detailed object trees and event monitoring.
A quick search revealed no such thing for Qt executables but I need to look closer.
I was hoping not to have to build it in to MusE but hey, here we are !

The did you know was added by Robert I think.
It pops up every time MusE is started with 'helpful' hints.
There's a file somewhere with the hints stored. A plain text file I think so that lines can be added easily?

spamatica
Established Member
Posts: 223
Joined: Mon Feb 08, 2010 10:38 am

Re: [For coders / stylesheet authors] Introducing the Snooper

Postby spamatica » Wed Nov 27, 2019 8:51 pm

Tim E. Real wrote:The did you know was added by Robert I think.
It pops up every time MusE is started with 'helpful' hints.
There's a file somewhere with the hints stored. A plain text file I think so that lines can be added easily?


Right. It stops 'hinting' if you check the 'do not open' checkbox, which I'm guessing most people do ;)
The content is somewhat stale, I've been meaning to remove some lines and add some more up to date ones.
You're of course welcome to add more hints..

Edit: Oooh, I missed the line about the accept(), awesome, maybe we can finally get this sorted!
Edit2: about the 'did you know' I saw you wrote menu entry, I see it's listed in the menu. I guess that one is also bound so it reacts to the checkbox, which is a little silly.

Tim E. Real
Established Member
Posts: 289
Joined: Sat Sep 15, 2012 12:36 am

Re: [For coders / stylesheet authors] Introducing the Snooper

Postby Tim E. Real » Thu Nov 28, 2019 8:17 pm

Improvements and fixes in git master now!
Hi! Sorry for the delay.

Well, let me say this: Don't understate the power of such a tool.
The Snooper has already earned a badge of honour.
It is likely nobody would have been able to trace this problem that Robert is having, without it.

Looky here:
In the Snooper, an orange item means an event was delivered to that item. No orange? No event delivered.

Robert, when I press the End key, here is the tree.
Notice that the event makes it all the way to the top (MusEGui::MusE) where it is handled properly by us:
snooper end key 1.jpeg

However... when I press the PgDown/Up key, here is the tree.
Notice that the event STOPS at that QMdiArea.
Yes, that stupid thing is eating our Page Up and Page Down events, specifically.
Looks like a trip to the QMdiArea source code is in order to see what's happening...
snooper pgdown key 1.jpeg
You do not have the required permissions to view the files attached to this post.

spamatica
Established Member
Posts: 223
Joined: Mon Feb 08, 2010 10:38 am

Re: [For coders / stylesheet authors] Introducing the Snooper

Postby spamatica » Thu Nov 28, 2019 8:47 pm

Woohoo!
I hadn't realized you wrote the above message and just went on a journey with your snooper thingy. Really awesome tool!!

I found exactly what you describe, it's the qmdiarea that are eating pgup and pgdown events.
...It will probably come back and bite me but I subclassed qmdiarea and overrode the event handler and voila, pgup and down work again \o/.
I guess it is possible that we actually want some of the keypresses that this class processes but, well, I sorta doubt it.

Also, with return, found the same thing. Just putting an ignore in the eventhandler for the partcanvas and return is back! The actual fix needs some more thought but knowing where it is eaten goes a long way!

I'll try to have something whipped up in the next few days.

Tim E. Real
Established Member
Posts: 289
Joined: Sat Sep 15, 2012 12:36 am

Re: [For coders / stylesheet authors] Introducing the Snooper

Postby Tim E. Real » Thu Nov 28, 2019 8:55 pm

Oh. Well, this explains it then, I didn't realize it was a scrollable area:

QMdiArea:
Inherits:
QAbstractScrollArea

Mm, yeah, well of course it's gonna eat up keys, eh?

And, yes, I believe it is possible the absence of these keys may affect our ability to scroll the area.

spamatica
Established Member
Posts: 223
Joined: Mon Feb 08, 2010 10:38 am

Re: [For coders / stylesheet authors] Introducing the Snooper

Postby spamatica » Thu Nov 28, 2019 9:02 pm

Went one step deeper and looked at the qt sources as you suggested.

QMidArea inherits from QAbstractScrollArea and there the culprit can be observed:
https://code.woboq.org/qt5/qtbase/src/w ... a.cpp.html

In "void QAbstractScrollArea::keyPressEvent(QKeyEvent * e)" it handles PgUp and PgDown and at the end it sets accept(). I very much doubt we want this functionality.

spamatica
Established Member
Posts: 223
Joined: Mon Feb 08, 2010 10:38 am

Re: [For coders / stylesheet authors] Introducing the Snooper

Postby spamatica » Thu Nov 28, 2019 9:05 pm

Tim E. Real wrote:And, yes, I believe it is possible the absence of these keys may affect our ability to scroll the area.


Hah, missed your message again, basically just parroted what you already found...

I doubt the above though. But I have my overridden solution and will test for this.

spamatica
Established Member
Posts: 223
Joined: Mon Feb 08, 2010 10:38 am

Re: [For coders / stylesheet authors] Introducing the Snooper

Postby spamatica » Sat Nov 30, 2019 9:46 pm

Committed my changes now. I could not find any ill effects (famous last words), do report if it's infact causing some side effect.
PgUp PgDown fixed by the overridden QMdiArea and fixed the Return event being eaten in the PartCanvas key event handler.

Also I fixed a bug in the Drum editor when it was opened on a part while the midi port was not properly initialized in the drummap.
Too deep waters for me to find the real reason so I simply added a range check on the port value and a hopefully clear comment as to the reason.


Return to “MusE Sequencer”

Who is online

Users browsing this forum: No registered users and 1 guest