action factory and toolbars

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

action factory and toolbars

ravas
I have converted the qg_actionfactory into a function that returns a map of all actions.
I also deleted the createGUIaction function from every action file
and added the code into the action factory. Tedious it was... but worth it.
Moving the "new QAction" code into the actionfactory simplifies all action files,
and allows for the complete removal of the ridiculously long include list...
There is no point in requesting that each action be made,
just make them all at once.

previous action factory:
- receive list of desired actions, and the toolbar / menu to add them to
- request individual actions made elsewhere
- add action to toolbar/menu on arrival

new action factory:
- make all actions
- export them in a container

This is what I would expect from something called an action factory;
and it makes the new menu / toolbar creation function far easier to read and tweak.
RIP to the overly overloaded addGUI function.

---

We haven't been using QActionGroup.
I grouped actions that are linked with the right click feature,
and use the actiongroup's triggered(QAction*) signal
to set the current action.

Right click will step back in the current action and then exit, nothing more.
Stepping back in the actions makes it an overloaded and inconsistent button.
I am thinking about another hotkey to step back in the actions.
Perhaps ctrl + right click.

I have made all the individual toolbars, and a category toolbar with QToolButtons.



This is straightforward Qt stuff—no complex management required!

Next I will implement custom toolbars, and then custom hotkeys.

Hopefully this stuff can go mainstream...
Reply | Threaded
Open this post in threaded view
|

Re: action factory and toolbars

dxli
Hi Ravas,

It looks great!

1, can this be finally "resolution independent" for HD displays?
2, can we drag the new cad toolbar to the left toolbar area? just to feel like the old way.


ravas wrote
I have converted the qg_actionfactory into a function that returns a map of all actions.
I also deleted the createGUIaction function from every action file
and added the code into the action factory. Tedious it was... but worth it.
Moving the "new QAction" code into the actionfactory simplifies all action files,
and allows for the complete removal of the ridiculously long include list...
There is no point in requesting that each action be made,
just make them all at once.

previous action factory:
- receive list of desired actions, and the toolbar / menu to add them to
- request individual actions made elsewhere
- add action to toolbar/menu on arrival

new action factory:
- make all actions
- export them in a container

This is what I would expect from something called an action factory;
and it makes the new menu / toolbar creation function far easier to read and tweak.
RIP to the overly overloaded addGUI function.

---

We haven't been using QActionGroup.
I grouped actions that are linked with the right click feature,
and use the actiongroup's triggered(QAction*) signal
to set the current action.

Right click will step back in the current action and then exit, nothing more.
Stepping back in the actions makes it an overloaded and inconsistent button.
I am thinking about another hotkey to step back in the actions.
Perhaps ctrl + right click.

I have made all the individual toolbars, and a category toolbar with QToolButtons.



This is straightforward Qt stuff—no complex management required!

Next I will implement custom toolbars, and then custom hotkeys.

Hopefully this stuff can go mainstream...
Reply | Threaded
Open this post in threaded view
|

Re: action factory and toolbars

ravas
This post was updated on .
These are all normal toolbars like the file toolbar;
and the (optional) icon size option works for all of them.
I have the icons set to 28x28 in the screenshot,
because, for me, default icons are a little small even on 1920x1080.
I imagine this option will be enough for HD,
since the icon size seems to be the complaint.
One issue would be the default system icons (undo / redo) on systems that support that.
If they are smaller than our icons, then they will stretch past native resolution before our icons.
My solution would be to set it so that LibreCAD only uses its own icons... it's more consistent anyhow.

The category toolbar is just a simple toolbar like the others,
and can be placed anywhere.
Reply | Threaded
Open this post in threaded view
|

Re: action factory and toolbars

dxli
Hi,

I feel we have to actively achieve resolution independence:

http://doc.qt.io/qt-5/scalability.html


ravas wrote
These are all normal toolbars like the file toolbar;
and the (optional) icon size option works for all of them.
I have the icons set to 28x28 in the screenshot,
because, for me, default icons are a little small even on 1920x1080.
I imagine this option will be enough for HD,
since the icon size seems to be the complaint.
One issue would be the default system icons (undo / redo) on systems that support that.
If they are smaller than our icons, then they will stretch past native resolution before our icons.
My solution would be to set it so that LibreCAD only uses its own icons... it's more consistent anyhow.

The category toolbar is just a simple toolbar like the others,
and can be placed anywhere.
Reply | Threaded
Open this post in threaded view
|

Re: action factory and toolbars

ravas
It seems like more work / complexity for a problem that might already be solved by an icon size option.
Even if all icons appear the same size universally, someone might still think that size is too small.
I'll keep my focus on things I can test.
Reply | Threaded
Open this post in threaded view
|

Re: action factory and toolbars

dxli
This issue is clearly not a special case, but due to the "pixel size" issue.

if icons are set to have fixed sizes in pixels, the physical sizes, say, in mms, will be reciprocally proportional to DPI, and the insanely high DPI displays get insanely small icons.

Since you are creating the toolbars from scratch, it might be good to avoid creating icons with fixed pixel sizes.
 
ravas wrote
It seems like more work / complexity for a problem that might already be solved by an icon size option.
Even if all icons appear the same size universally, someone might still think that size is too small.
I'll keep my focus on things I can test.
Reply | Threaded
Open this post in threaded view
|

Re: action factory and toolbars

ravas
You can control all icons at once with setIconSize.
I have custom size disabled by default.
Nothing is fixed.



void QC_ApplicationWindow::set_icon_size()
{
    RS_SETTINGS->beginGroup("/Appearance");
    bool custom_size = RS_SETTINGS->readNumEntry("/SetIconSize", 0);
    if (custom_size)
    {
        int icon_size = RS_SETTINGS->readNumEntry("/IconSize", 24);
        setIconSize(QSize(icon_size, icon_size));
    }
    RS_SETTINGS->endGroup();
}
Reply | Threaded
Open this post in threaded view
|

Re: action factory and toolbars

dxli
Hi Ravas,

It's great, since you are already close to a comprehensive solution.

Have a look at the Qt-5.5 feature:

https://github.com/LibreCAD/LibreCAD/commit/f05ef2f1b234f1a220aa98deca3ad8fd2424b027
Reply | Threaded
Open this post in threaded view
|

Re: action factory and toolbars

ravas
真棒