Customize Gui with Plugin

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

Moderator: andrew

Post Reply
moppi
Registered Member
Posts: 2
Joined: Thu Sep 26, 2019 2:15 pm

Customize Gui with Plugin

Post by moppi » Tue Oct 01, 2019 12:42 pm

Hello,

Is it possible to customize the default GUI of QCAD with a plugin?
I want to:
- hide menu entries
- hide buttons / buttonbars / widgets

Result should be a customized default gui of qcad.

Best regards

Moppi

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

Re: Customize Gui with Plugin

Post by andrew » Tue Oct 01, 2019 2:44 pm

Yes, you can do that from either a plugin or a simple script.

Example script to hide the tool Draw > Line > Freehand Line:

File: scripts/Misc/MyCustomUI/MyCustomUI.js

Code: Select all

function MyCustomUI() {
} 

MyCustomUI.init = function() {

    // hide the tool Draw > Line > Freehand Line

    // hide tool from menu:
    RSettings.setValue("LineFreehand/VisibleInMenu", false);

    // hide tool from line tool bar:
    RSettings.setValue("LineFreehand/VisibleInToolBar", false);

    // hide tool from CAD tool bar at the left:
    RSettings.setValue("LineFreehand/VisibleInCadToolBar", false);

    // hide tool from tool matrix (View > Toolbars and Widgets > Widgets > Tool Matrix):
    RSettings.setValue("LineFreehand/VisibleInMatrixPanel", false);
};

moppi
Registered Member
Posts: 2
Joined: Thu Sep 26, 2019 2:15 pm

Re: Customize Gui with Plugin

Post by moppi » Tue Oct 01, 2019 5:44 pm

Hello,

thank you very much.
Is there any overview to take a look what you can change with "setValue"?
I used scripts-directory to take a look, but maybe there is a list for it.

Is it possible to change application name too?

Best regards

moppi

John Hyslop
Premier Member
Posts: 256
Joined: Mon Sep 30, 2019 6:21 am
Location: Melbourne - Australia

Re: Customize Gui with Plugin

Post by John Hyslop » Sat Nov 16, 2019 3:21 am

Hi Andrew

Love the ability to be able to switch off tools I may never use or rarely use, so I'm going to
just switch off the toolbar items and leave the menu in case I need to use at some time..

I have these 2 lines that now switch off the Clip Rectangle & Edit Text but I'd like to know if
there is a list somewhere with these values as I pretty much guessed the clip rectangle one
by trying ClipRectangle then ClipRect then ClipToRectangle... is there any documentation
available for these settings on toolbars? these work for me below, added to your JS file MyCustomUI.

// hide tool Edit Text From Toolbar
RSettings.setValue("EditText/VisibleInToolBar", false);

// hide tool Clip Rectangle From Toolbar
RSettings.setValue("ClipToRectangle/VisibleInToolBar", false);
};

Cheers
John
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

Post Reply

Return to “QCAD Developers and Contributors”