[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: DialogCore / AboutCore classes
From:       Mirko Sucker <mirko.sucker () unibw-hamburg ! de>
Date:       1999-09-01 21:07:38
[Download RAW message or body]

Espen Sand wrote:

> Hello Mirko.
>
> I will see what I can do to merge the two classes. I will however first
> complete CDialogCore so I know exactly what I will need. I hope you
> understand.
>
> Yes I have studied the DialogBase but I found that I could not use it for
> all the dialogs I have in khexedit (which area rather many and different
> looking). So decided to make one that was a bit more versatile, but also a bit
> more restrictive. Some Issues:
>
> 1. Perhaps most important. I use no resizeEvent() event handler. Everything
> is taken care of by the Qt layout mechanism. This makes the dialog code *much*
> simpler to maintain (at least my experience :-). I have reimplemented the
> show() method where I basically only do:
> setGeometry( x(), y(), minimumSize().width(),minimumSize().height() );
> QDialog::show();
> Thats the only place I set the size of anything in the CDialogCore.

Hello Espen,
this is a kind of misunderstanding.
When using DialogBase, the user does not have to take care of any resize handling at
all. The only thing that has to be done by the user is to set the minimum size for the
main widget. As DialogBase places some frames around it, it need to handle its own
resizing - thats all. So, if you need to set up your dialog, you only take care for
your own widgets. This is the same if you derive DialogBase or use it directly as
I mentioned in the last mail.

> 2. I needed more Action buttons (other than Apply,Ok and Cancel) at the same
> time So I added Help,Default and Close, as well as the user definable buttons.
> In all, eight button can be used in a dialog at the same time.

OK, this is not a problem. In DialogBase, the buttons are simply the ones that have
been used until now. But be aware - user buttons usually do NOT have the same
synoptical meaning as the three buttons OK, Apply and Cancel. Regarding this, you need
to place them differently to create a comprehensable user interface.

> 3. The user can not change the text of a button after it has be created. I
> really don't like that possibility. The user can only set the text of the
> three special buttons in the constructor.

In this case you simply missed the setButtonApplyText(..) and related methods. It sets
the button texts, tooltips and quickhelps for the predefined buttons.

> 4. I needed to be able to set a default button (minor issue though).

Good idea. How about a simply method the sets the input focus and the default button?

> 5. This is more personal taste. I like to define as much as possible in the
> constructor so a dialog should normally be a class of its own. The CDialogCore
> constructor is shown below: (the separator controls a horizontal line above the
> action buttons)

Good idea.

> CDialogCore( int dialogType, int buttonMask, int defaultButton,
> ...A few examples below (from khexedit)
>
> The configuration dialog box:
> ---------------------
>
> COptionDialog::COptionDialog( const QString &title, QWidget *parent,
>                               char *name, bool modal )
>   :CDialogCore( TreeList, Help|Default|Apply|Ok|Cancel,Ok, parent, name,
>                 title, true, modal )
> {
>   setupLayoutPage();
>   setupCursorPage();
>   setupColorPage();
>   setupFontPage();
>   setupFilePage();
>   setupMiscPage();
> }
>
> while the printer dialog is created as:
> ---------------------------
>
> CPrinterDialog::CPrinterDialog( const QString &title, QWidget *parent,
>                                 char *name, bool modal )
>   :CDialogCore( Tabbed, Help|User2|User1|Cancel, User1, parent, name,
>                 title, false, modal, i18n("&Print"), i18n("Pre&view") ),
>   setupDestinationPage();
>   setupOptionPage();
>   setupLayoutPage();
> }
>
> On Mon, 30 Aug 1999, Mirko Sucker wrote:
> >Espen Sand wrote:
> >
> >> FYI: From My Struggle towards (even) better dialogs in KDE.
> >>
> >> I have been working this weekend on a dialog base class - DialogCore
> >> The reason for this is to make a class that more or less forces the user to
> >> follow certain rules when making dialogs. My goal is to get this class into
> >> kdeui so that I can use it in other (than khexedit) programs I have planned to
> >> "clean up".
> >
> >Hello Espen,
> >there is a class in kdeui that provides this stuff, it is DialogBase. Apart from
> >the three different layouts, it provides everything you are talking about.
> >
> >> *DialogCore provides three layouts (defined in constructor)
> >> +Plain (std dialog)
> >> +Tabbed (a tabbed dialog)
> >> +TreeList (treelist+pages as config window in khexedit, korganizer). The
> >> treelist is based on the QSplitter + QlistView.
> >
> >> *DialogCore defines an inner and outer margin. The outer is used by the
> >> DialogCore itself and and the user should use the "innerMagin()" only.
> >> (I hope DialogCore can read these margins from a central KDE object later).
> >
> >Instead of this, in DialogBase the user creates a widget that is child of the
> >dialog:
> >---
> >DialogBase dialog;
> >QMultiLineEdit line(&dialog);
> >dialog.setMainWidget(&line);
> >if(!dialog.exec()) ...
> >---
> >This is everything needed to create a dialog to enter a multi line text. The user
> >does not have to take care about inner and outer margins (that, BTW, arew there,
> >too).
> >I would be happy if you manage to add the three different styles to DialogBase,
> >instead of adding another class that implements the same stuff once again.
> >Greetings,
> >--Mirko.
> >
> >> ... I have begun making a general "about dialog" core class, AboutCore, that will
> >> be
> >
> >> able to create the "About KDE dialog" as well as my current "About khexedit" and
> >> more. The  AboutCore is sublassed from the "DialogCore". I can
> >> already make the "About KDE dialog" using this class. I will try to implement
> >> all features from the (nice :-) "KAboutDialog" by Mirko Sucker.
> >
> >But remember that KAboutDialog is not THE About Dialog for KDE, it is meant for
> >application about dialogs.
> >Greetings,
> >--Mirko.
> >
> >--
> >Denn der  Mensch  liebt und ehrt den  Menschen,  solange er ihn
> >nicht zu beurteilen vermag, und die Sehnsucht ist ein Erzeugnis
> >mangelhafter Erkenntnis. (Thomas Mann)
>
> --
> Espen Sand

--
Denn der  Mensch  liebt und ehrt den  Menschen,  solange er ihn
nicht zu beurteilen vermag, und die Sehnsucht ist ein Erzeugnis
mangelhafter Erkenntnis. (Thomas Mann)

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic