[bt-devel] Commentary editor font chooser

Eeli Kaikkonen eekaikko at mail.student.oulu.fi
Mon Dec 1 08:58:25 MST 2008


On Sun, 30 Nov 2008, Gary Holmlund wrote:

>
> I have been looking at the  Commentary editor font chooser to eliminate
> the KDE classes. Here is the description from the wiki:
>
> -------------
> Commentary editor uses KDE classes for choosing font, size and color.
> For example font name is selected with KFontAction which apparently has
> its own quite complex widget. It works automatically by just adding the
> action to the toolbar. Replacing it is not trivial.
>
>     * color: replace KColorButton with button and QColorDialog
>     * size: replace KFontSizeAction with QComboBox and QFontDatabase
>     * font name: replace KFontAction with QComboBox and QFontDatabase
>     * KActionCollection has to be replaced/removed, too
> --------------
>
> There are two ways to deal with these widgets.
>
> 1. Use QWidgetAction to wrap the widget into a QAction. This is how KDE
> does these and it would allow the continued use of KActionCollection.
> However, this seemed simple but turned into a complicated function. KDE
> uses about 1000 lines in the KFontSizeAction.
>
> 2. Just keep the widgets as widgets using the QToolbar::addWidget()
> funtion to put them on the toolbar. This is very simple to do, but it
> does not allow the widgets to be in the KActionCollection.
>
> I know that the KActionCollection is not really being used since the
> configuration of toolbars is disabled. I also understand that we want to
> replace it.
>
> What are your thoughts on these issues?
>
> Gary

The only good reason to use KActionCollection in some other classes was
the shortcut editor in Config dialog. The editor took Actions from
Collections. You can look into the source code of 1.6.5 too see how it
happened, and how complicated it makes the Display window classes. We
should find some clean way to do something similar. Maybe it's
reasonable to create some simple replacement of ActionCollection which
could be a mediator between a new shortcut editor and other UI classes.

I guess the best course is to get rid of all KDE classes now and think
about the replacement later, unless you want to desing something larger.
Make the ported code as simple and easy as possible.


  Yours,
	Eeli Kaikkonen (Mr.), Oulu, Finland
	e-mail: eekaikko at mailx.studentx.oulux.fix (with no x)



More information about the bt-devel mailing list