class KDialog


Table of contents
Modules
kdeui Classes
All Classes
Module kdeui
Namespace global
Class KDialog
Inherits QDialog

A dialog base class with standard buttons and predefined layouts.

Provides basic functionality needed by nearly all dialogs.

It offers the standard action buttons you'd expect to find in a dialog as well as the capability to define at most three configurable buttons. You can define a main widget that contains your specific dialog layout

The class takes care of the geometry management. You only need to define a minimum size for the widget you want to use as the main widget.

By default, the dialog is non-modal.

Standard buttons (action buttons):\n

You select which buttons should be displayed, but you do not choose the order in which they are displayed. This ensures a standard interface in KDE. The button order can be changed, but this ability is only available for a central KDE control tool. The following buttons are available: OK, Cancel/Close, Apply/Try, Default, Help and three user definable buttons: User1, User2 and User3. You must specify the text of the UserN buttons. Each button emit a signal, so you can choose to connect that signal.

The default action of the Help button will open the help system if you have provided a path to the help text. The default action of Ok and Cancel will run QDialog.accept() and QDialog.reject(), which you can override by reimplementing slotButtonClicked(). The default action of the Close button will close the dialog.

Note that the KDialog will animate a button press when the user presses Escape. The button that is enabled is either Cancel, Close or the button that is defined by setEscapeButton(). Your custom dialog code should reimplement the keyPressEvent and animate the cancel button so that the dialog behaves like regular dialogs.

Layout:\n

The dialog consists of a help area on top (becomes visible if you define a help path and use enableLinkedHelp()), the main area which is the built-in dialog face or your own widget in the middle and by default a button box at the bottom. The button box can also be placed at the right edge (to the right of the main widget). Use setButtonsOrientation() to control this behavior. A separator can be placed above the button box (or to the left when the button box is at the right edge).

Standard compliance:\n

The marginHint() and spacingHint() sizes shall be used whenever you lay out the interior of a dialog. One special note. If you make your own action buttons (OK, Cancel etc), the space between the buttons shall be spacingHint(), whereas the space above, below, to the right and to the left shall be marginHint(). If you add a separator line above the buttons, there shall be a marginHint() between the buttons and the separator and a marginHint() above the separator as well.

Example:\n

KDialog *dialog = new KDialog( this );
dialog->setCaption( "My title" );
dialog->setButtons( KDialog.Ok | KDialog.Cancel | KDialog.Apply );

FooWidget *widget = new FooWidget( dialog ); dialog->setMainWidget( widget ); connect( dialog, SIGNAL( applyClicked() ), widget, SLOT( save() ) ); connect( dialog, SIGNAL( okClicked() ), widget, SLOT( save() ) ); connect( widget, SIGNAL( changed( bool ) ), dialog, SLOT( enableButtonApply( bool ) ) );

dialog->enableButtonApply( false ); dialog->show();

This class can be used in many ways. Note that most KDE ui widgets and many of KDE core applications use the KDialog so for more inspiration you should study the code for these.

See also KPageDialog Author Thomas Tanghus Author Espen Sand Author Mirko Boehm Author Olivier Goffart Author Tobias Koenig



enums

enum details

methods