Im trying to build a system using the Qt libs under linux, the simple stuff is all working really well but im looking to do something a little more complicated. I would like to access the page object trees to give me something with a little more intellegence.
I know this isn't implemented in the Qt libs yet, is it possible to access anyway?
I tried re parsing the gmn and generating the Ar and Gr for a specific code and it seemed to work but the functions to give me the number of child objects to the root object keeps turning up zero.
Thanks in advance,
Josh
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
to grab an event near to some date and it seems to work but then when i try to draw the bounding box using:
...
GuidoMapGetElementBoundingBox(currentElt,&outLeft,&outTop,&outRight,&outBottom);
rect = new QRect(int(outLeft),int(outTop),int(outLeft-outRight),int(outTop-outBottom));
...
and then in the paintEvent call:
...
if (rect!=NULL) painter.drawRect(*rect);
...
I'm getting it drawing the boxes in the wrong positions (seems to be scaled down towards the top and the left)
I know this is pretty simplistic so im probably missing a scaling factor and margins or something like that but i cant work out where to find them. Can i get them from the GR?
Thanks in advance,
Josh
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I guess you're using the GUIDOScoreMap API (GuidoMapGetRootElement and GuidoMapChildCount). You have to know that a GuidoEltRef contains graphic layout information, thus you can't access these elements as long as there is no corresponding graphic instance. In others terms: you need to draw the page (using GuidoOnDraw) before querying the graphic mapping. If you don't want to display the score before accessing the page elements, then you can use a 'NullGDevice' (included in the src distribution or from the svn repository): it doesn't draw anything but the graphic mapping is computed.
Note that a graphic mapping is valid for a specific page and for a given layout only: if you change the page size for example, you'll have to query the mapping again.
I hope that it helps.
Best,
Dominique
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for that, I'm having trouble though. Also i don't like the idea of having to parse the score twice. Is there any reason i couldn't drag the GR out from the QGuidoWidget and use that for the GetRootElement ChildCount and element info functions?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I wrote a little function to return a pointer to the GR from a qguidowidget into its code. But whenever i try to use the "GuidoMapGetRootElement" function it segfaults. Is there any reason it should not be able to do this?
Do you have any better suggestions for getting the element data out from the Qt objects?
Thankyou,
Josh
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Im trying to build a system using the Qt libs under linux, the simple stuff is all working really well but im looking to do something a little more complicated. I would like to access the page object trees to give me something with a little more intellegence.
I know this isn't implemented in the Qt libs yet, is it possible to access anyway?
I tried re parsing the gmn and generating the Ar and Gr for a specific code and it seemed to work but the functions to give me the number of child objects to the root object keeps turning up zero.
Thanks in advance,
Josh
ok, sorry, your right you cant help without code :)
I managed to work that problem out anyway. But now i have a new one :S
Im using:
...
currentElt=GuidoMapFindEventBeforeDate(rootElt, date);
...
to grab an event near to some date and it seems to work but then when i try to draw the bounding box using:
...
GuidoMapGetElementBoundingBox(currentElt,&outLeft,&outTop,&outRight,&outBottom);
rect = new QRect(int(outLeft),int(outTop),int(outLeft-outRight),int(outTop-outBottom));
...
and then in the paintEvent call:
...
if (rect!=NULL) painter.drawRect(*rect);
...
I'm getting it drawing the boxes in the wrong positions (seems to be scaled down towards the top and the left)
I know this is pretty simplistic so im probably missing a scaling factor and margins or something like that but i cant work out where to find them. Can i get them from the GR?
Thanks in advance,
Josh
Hi,
I guess you're using the GUIDOScoreMap API (GuidoMapGetRootElement and GuidoMapChildCount). You have to know that a GuidoEltRef contains graphic layout information, thus you can't access these elements as long as there is no corresponding graphic instance. In others terms: you need to draw the page (using GuidoOnDraw) before querying the graphic mapping. If you don't want to display the score before accessing the page elements, then you can use a 'NullGDevice' (included in the src distribution or from the svn repository): it doesn't draw anything but the graphic mapping is computed.
Note that a graphic mapping is valid for a specific page and for a given layout only: if you change the page size for example, you'll have to query the mapping again.
I hope that it helps.
Best,
Dominique
Thanks for that, I'm having trouble though. Also i don't like the idea of having to parse the score twice. Is there any reason i couldn't drag the GR out from the QGuidoWidget and use that for the GetRootElement ChildCount and element info functions?
I wrote a little function to return a pointer to the GR from a qguidowidget into its code. But whenever i try to use the "GuidoMapGetRootElement" function it segfaults. Is there any reason it should not be able to do this?
Do you have any better suggestions for getting the element data out from the Qt objects?
Thankyou,
Josh
Please, send some piece of the code that crashes. Otherwise I can't tell anything about the problem.
dom