XMLGUI, actions and dialogs
Simon Hausmann
hausmann at kde.org
Thu Sep 11 16:31:41 BST 2003
On Thu, Sep 11, 2003 at 08:25:13AM +0000, Dirk Schönberger wrote:
>
> If I develop GUIs for KDE applications, I currently have three way to do
> this
>
> - menubars, toolbars and popup menus are defined by an XML .rc file, the
> behaviour behind this is implemented in C++
> - popup dialogs are implemented by a mix of C++ declarations (dialog
> definitions, pages, ...), Qt Designer files which are used to generate
> source code and subclasses of these generated classes which implement the
> behaviour. Theoretically there exist the possibility to load the UI files
> directly by using a factory, somehow this feature is not used (this would
> allow to change the GUI of an application on a local base)
> - custom GUIs are implemented fully manually with variable approaches. This
> includes container level GUIs like the different sidebars and tabs in
> applications
> like KDevelop, or Karbon or Krita from KOffice. At least in Karbon and
> Krita there is no clear distinction between "view functionality", i.e. the
> display of the
> document data, and "controller functionality", i.e. the display of the
> sidebars / tabs. So e.g. the sidebar as part of an embedded object (to see
> what I mean
> please try to embed a Krita part inside a KWord document in current CVS).
> Instead the sidebar should somehow be merged with the container GUI, i.e.
> the
> toolbars, menubars ...
>
> Would it be possible/useful to extend the XMLGUI framework to be able to
> display popup dialogs and tabs, sidebars? So that it is possible to define
> a popup dialogs with something like this in an external resource file:
>
> <!DOCTYPE kpartgui>
> <kpartgui name="krita">
> <SideBar>
> <Page name="fill" >
> <Action name="cmykColor" />
> <Action name="rgbColor" />
> <Action name="hsvColor" />
> </Menu>
> </SideBar>
> </kpartgui>
>
> <!DOCTYPE kpartgui>
> <kpartgui name="xxx">
> <Dialog title="Properties">
> <Page title="Page 1" >
> <Action name="editName" />
> <Action name="editFirstName" />
> </Page>
> <Page title="Page 2" >
> <Action name="editAddress" />
> <Action name="editEmail" />
> </Page>
> </Dialog>
> </kpartgui>
>
> Using this approach would allow to use the features of the existing XMLGUI
> framework, namely the merging of multiple UI trees (e.g. the Krita sidebar
> with the KWord menu and toolbars, or the dialog UI with some shared UI
> resource (think "dialog layout" and "button order" here)
Technically you can do that. The interesting class for this is the
KXMLGUIBuilder class, which through inheritance allows implementing
support for new containers by tags you can specify. If you want to
do this only for one particular component then you can use your own
KXMLGUIBuilder instance with it by calling KXMLGUIClient's
setClientBuilder method.
Simon
More information about the kde-core-devel
mailing list