[SOLVED] menu item order

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
smf
Premier Member
Posts: 177
Joined: Tue Feb 28, 2012 1:05 pm

[SOLVED] menu item order

Post by smf » Mon Jan 05, 2015 2:08 pm

Hello there,

I've some trouble with the menu order of my inserted scripts. I've inserted something like

Code: Select all

action.setSortOrder(501);
at all the init functions (each with different numbers, of course). This results in menu items ordered correctly at my laptop, but not at my computer at home. There the menu items seem to be sorted alphabetically.

Am I doing something wrong or is there an option I missed?

Thanks in advance,
Stefan
Last edited by smf on Wed Jan 07, 2015 4:28 pm, edited 1 time in total.

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: menu item order

Post by andrew » Mon Jan 05, 2015 2:25 pm

Since QCAD 3.7.2, you can define a group sort order and a tool sort order. Tools are sorted by group sort order first and tool sort order second. Separators are inserted between different tool groups. Each tool should have a globally unique combination of group sort order and tool sort order.
action.setGroupSortOrder(12345);
action.setSortOrder(100);
Start QCAD with the switch -debug-action-order to display the sort orders in the menu for easier debugging:

Code: Select all

./qcad -debug-action-order

smf
Premier Member
Posts: 177
Joined: Tue Feb 28, 2012 1:05 pm

Re: menu item order

Post by smf » Mon Jan 05, 2015 4:16 pm

Thanks, that pointed in the right direction. :D Unfortunately, starting with

Code: Select all

-debug-action-order
did produce change the output. Is there a preferred value for setGroupSortOrder?

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: menu item order

Post by andrew » Mon Jan 05, 2015 4:39 pm

These are the start group sort orders for each tool category:

1000 File
2000 Edit
3000 View
4000 Select
5000 Point
6000 Line
7000 Arc
8000 Circle
9000 Ellipse
10000 Spline
11000 Polyline
11500 Shape
12000 Dimension
13000 Modify, Projection
14000 Block
15000 Snap
16000 Info
17000 Layer
18000 Projection
20000 CAM
50000 Window
51000 Misc
52000 Misc Import Export
53000 Misc Select
54000 Misc Draw
55000 Misc Dimensions
56000 Misc Modify
57000 Misc Snap
58000 Misc Info
59000 Misc Layer
60000 Misc Block
70000 Examples
71000 Example Import Export
72000 Example Select
73000 Example Draw
74000 Example Dimensions
75000 Example Modify
76000 Example Snap
77000 Example Info
78000 Example Layer
79000 Example Block
79500 Example Listener
79600 Example Qt
79700 Example Math
80000 Tutorials
100000 Developer
110000 Help

smf
Premier Member
Posts: 177
Joined: Tue Feb 28, 2012 1:05 pm

Re: menu item order

Post by smf » Tue Jan 06, 2015 9:13 am

Thanks a lot! :) Then I will use something like 1612340 to prevent collision.

smf
Premier Member
Posts: 177
Joined: Tue Feb 28, 2012 1:05 pm

Re: [SOLVED] menu item order

Post by smf » Sun Jan 25, 2015 9:49 am

Hi Andrew,

thanks again for the explanation above. I now created several groups, and between all of them is a separator - all but one (means: I have four groups, separators are between first-second and second-third but not third-fourth, where I also would like to have a separator). Is there a way to find out why between two different groups there is no separator like between the other groups?

Thanks in advance!

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”