Krita Source Code Documentation
Loading...
Searching...
No Matches
KoDialog Class Reference

A dialog base class with standard buttons and predefined layouts. More...

#include <KoDialog.h>

+ Inheritance diagram for KoDialog:

Public Types

enum  ButtonCode {
  None = 0x00000000 , Help = 0x00000001 , Default = 0x00000002 , Ok = 0x00000004 ,
  Apply = 0x00000008 , Try = 0x00000010 , Cancel = 0x00000020 , Close = 0x00000040 ,
  No = 0x00000080 , Yes = 0x00000100 , Reset = 0x00000200 , Details = 0x00000400 ,
  User1 = 0x00001000 , User2 = 0x00002000 , User3 = 0x00004000 , NoDefault = 0x00008000
}
 
enum  ButtonPopupMode { InstantPopup = 0 , DelayedPopup = 1 }
 
enum  CaptionFlag { NoCaptionFlags = 0 , AppNameCaption = 1 , ModifiedCaption = 2 , HIGCompliantCaption = AppNameCaption }
 

Public Slots

void delayedDestruct ()
 
void enableButton (ButtonCode id, bool state)
 
void enableButtonApply (bool state)
 
void enableButtonCancel (bool state)
 
void enableButtonOk (bool state)
 
void enableLinkedHelp (bool state)
 
bool isDetailsWidgetVisible () const
 
virtual void setCaption (const QString &caption)
 
virtual void setCaption (const QString &caption, bool modified)
 
void setDetailsWidget (QWidget *detailsWidget)
 
void setDetailsWidgetVisible (bool visible)
 
void setHelp (const QString &anchor, const QString &appname=QString())
 
void setHelpLinkText (const QString &text)
 
virtual void setPlainCaption (const QString &caption)
 

Signals

void aboutToShowDetails ()
 
void applyClicked ()
 
void buttonClicked (KoDialog::ButtonCode button)
 
void cancelClicked ()
 
void closeClicked ()
 
void defaultClicked ()
 
void finished ()
 
void helpClicked ()
 
void hidden ()
 
void layoutHintChanged ()
 
void noClicked ()
 
void okClicked ()
 
void resetClicked ()
 
void tryClicked ()
 
void user1Clicked ()
 
void user2Clicked ()
 
void user3Clicked ()
 
void yesClicked ()
 

Public Member Functions

QPushButton * button (ButtonCode id) const
 
QIcon buttonIcon (ButtonCode id) const
 
QString buttonText (ButtonCode id) const
 
QString buttonToolTip (ButtonCode id) const
 
QString buttonWhatsThis (ButtonCode id) const
 
ButtonCode defaultButton () const
 
QString helpLinkText () const
 
void incrementInitialSize (const QSize &size)
 
bool isButtonEnabled (ButtonCode id) const
 
 KoDialog (QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags())
 
QWidget * mainWidget ()
 
QSize minimumSizeHint () const override
 
void setButtonFocus (ButtonCode id)
 
void setButtonGuiItem (ButtonCode id, const KGuiItem &item)
 
void setButtonIcon (ButtonCode id, const QIcon &icon)
 
void setButtons (ButtonCodes buttonMask)
 
void setButtonsOrientation (Qt::Orientation orientation)
 
void setButtonText (ButtonCode id, const QString &text)
 
void setButtonToolTip (ButtonCode id, const QString &text)
 
void setButtonWhatsThis (ButtonCode id, const QString &text)
 
void setDefaultButton (ButtonCode id)
 
void setEscapeButton (ButtonCode id)
 
void setInitialSize (const QSize &size)
 
void setMainWidget (QWidget *widget)
 
void showButton (ButtonCode id, bool state)
 
void showButtonSeparator (bool state)
 
QSize sizeHint () const override
 
 ~KoDialog () override
 

Static Public Member Functions

static int groupSpacingHint ()
 
static QString makeStandardCaption (const QString &userCaption, QWidget *window=0, CaptionFlags flags=HIGCompliantCaption)
 
static int marginHint ()
 
static void resizeLayout (QLayout *lay, int margin, int spacing)
 
static void resizeLayout (QWidget *widget, int margin, int spacing)
 
static int spacingHint ()
 

Protected Slots

virtual void slotButtonClicked (int button)
 

Protected Member Functions

void closeEvent (QCloseEvent *e) override
 
void hideEvent (QHideEvent *) override
 
void keyPressEvent (QKeyEvent *) override
 
void showEvent (QShowEvent *e) override
 

Private Member Functions

 KoDialog (KoDialogPrivate &dd, QWidget *parent, Qt::WindowFlags f=Qt::WindowFlags())
 

Private Attributes

KoDialogPrivate *const d_ptr
 

Detailed Description

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):
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 Q_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 KoDialog 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:
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:
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:

KoDialog *dialog = new KoDialog( this );
dialog->setCaption( "My title" );
dialog->setButtons( KoDialog::Ok | KoDialog::Cancel | KoDialog::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();
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
A dialog base class with standard buttons and predefined layouts.
Definition KoDialog.h:116
void applyClicked()
void enableButtonApply(bool state)
Definition KoDialog.cpp:620
@ Ok
Show Ok button. (this button accept()s the dialog; result set to QDialog::Accepted)
Definition KoDialog.h:127
@ Apply
Show Apply button.
Definition KoDialog.h:128
@ Cancel
Show Cancel-button. (this button reject()s the dialog; result set to QDialog::Rejected)
Definition KoDialog.h:130
KoDialog(QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags())
Definition KoDialog.cpp:176
void okClicked()
KDE Dialog example

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

See also
KPageDialog
Author
Thomas Tanghus tangh.nosp@m.us@e.nosp@m.arthl.nosp@m.ing..nosp@m.net
Espen Sand espen.nosp@m.sa@o.nosp@m.nline.nosp@m..no
Mirko Boehm mirko.nosp@m.@kde.nosp@m..org
Olivier Goffart <ogoffart at kde.org>
Tobias Koenig tokoe.nosp@m.@kde.nosp@m..org

Definition at line 115 of file KoDialog.h.

Member Enumeration Documentation

◆ ButtonCode

Enumerator
None 
Help 

Show Help button. (this button will run the help set with setHelp)

Default 

Show Default button.

Ok 

Show Ok button. (this button accept()s the dialog; result set to QDialog::Accepted)

Apply 

Show Apply button.

Try 

Show Try button.

Cancel 

Show Cancel-button. (this button reject()s the dialog; result set to QDialog::Rejected)

Close 

Show Close-button. (this button closes the dialog)

No 

Show No button. (this button closes the dialog and sets the result to KoDialog::No)

Yes 

Show Yes button. (this button closes the dialog and sets the result to KoDialog::Yes)

Reset 

Show Reset button.

Details 

Show Details button. (this button will show the detail widget set with setDetailsWidget)

User1 

Show User defined button 1.

User2 

Show User defined button 2.

User3 

Show User defined button 3.

NoDefault 

Used when specifying a default button; indicates that no button should be marked by default.

Definition at line 123 of file KoDialog.h.

123 {
124 None = 0x00000000,
125 Help = 0x00000001,
126 Default = 0x00000002,
127 Ok = 0x00000004,
128 Apply = 0x00000008,
129 Try = 0x00000010,
130 Cancel = 0x00000020,
131 Close = 0x00000040,
132 No = 0x00000080,
133 Yes = 0x00000100,
134 Reset = 0x00000200,
135 Details = 0x00000400,
136 User1 = 0x00001000,
137 User2 = 0x00002000,
138 User3 = 0x00004000,
139 NoDefault = 0x00008000
140 };
@ User2
Show User defined button 2.
Definition KoDialog.h:137
@ No
Show No button. (this button closes the dialog and sets the result to KoDialog::No)
Definition KoDialog.h:132
@ Reset
Show Reset button.
Definition KoDialog.h:134
@ User3
Show User defined button 3.
Definition KoDialog.h:138
@ Yes
Show Yes button. (this button closes the dialog and sets the result to KoDialog::Yes)
Definition KoDialog.h:133
@ Default
Show Default button.
Definition KoDialog.h:126
@ NoDefault
Used when specifying a default button; indicates that no button should be marked by default.
Definition KoDialog.h:139
@ User1
Show User defined button 1.
Definition KoDialog.h:136
@ Details
Show Details button. (this button will show the detail widget set with setDetailsWidget)
Definition KoDialog.h:135
@ Help
Show Help button. (this button will run the help set with setHelp)
Definition KoDialog.h:125
@ Try
Show Try button.
Definition KoDialog.h:129
@ Close
Show Close-button. (this button closes the dialog)
Definition KoDialog.h:131

◆ ButtonPopupMode

Enumerator
InstantPopup 
DelayedPopup 

Definition at line 144 of file KoDialog.h.

144 {
145 InstantPopup = 0,
146 DelayedPopup = 1
147 };
@ InstantPopup
Definition KoDialog.h:145
@ DelayedPopup
Definition KoDialog.h:146

◆ CaptionFlag

Used to specify how to construct a window caption

Enumerator
NoCaptionFlags 
AppNameCaption 
ModifiedCaption 
HIGCompliantCaption 

Definition at line 398 of file KoDialog.h.

398 {
399 NoCaptionFlags = 0,
400 AppNameCaption = 1,
401 ModifiedCaption = 2,
403 };
@ ModifiedCaption
Definition KoDialog.h:401
@ AppNameCaption
Definition KoDialog.h:400
@ HIGCompliantCaption
Definition KoDialog.h:402
@ NoCaptionFlags
Definition KoDialog.h:399

Constructor & Destructor Documentation

◆ KoDialog() [1/2]

KoDialog::KoDialog ( QWidget * parent = 0,
Qt::WindowFlags f = Qt::WindowFlags() )
explicit

Creates a dialog.

Parameters
parentThe parent of the dialog.
flagsThe widget flags passed to the QDialog constructor

Definition at line 176 of file KoDialog.cpp.

177 : QDialog(parent ? parent : qApp->activeWindow(), flags)
179{
180 d_ptr->init(this);
181}
void init(KoDialog *)
Definition KoDialog.cpp:159
KoDialogPrivate *const d_ptr
Definition KoDialog.h:787

References d_ptr, and KoDialogPrivate::init().

◆ ~KoDialog()

KoDialog::~KoDialog ( )
override

Destroys the dialog.

Definition at line 190 of file KoDialog.cpp.

191{
192 delete d_ptr;
193}

References d_ptr.

◆ KoDialog() [2/2]

KoDialog::KoDialog ( KoDialogPrivate & dd,
QWidget * parent,
Qt::WindowFlags f = Qt::WindowFlags() )
private

Definition at line 183 of file KoDialog.cpp.

184 : QDialog(parent ? parent : qApp->activeWindow(), flags)
185 , d_ptr(&dd)
186{
187 d_ptr->init(this);
188}

References d_ptr, and KoDialogPrivate::init().

Member Function Documentation

◆ aboutToShowDetails

void KoDialog::aboutToShowDetails ( )
signal

The detailsWidget is about to get shown. This is your last chance to call setDetailsWidget if you haven't done so yet.

◆ applyClicked

void KoDialog::applyClicked ( )
signal

The Apply button was pressed. This signal is only emitted if slotButtonClicked() is not replaced

◆ button()

QPushButton * KoDialog::button ( ButtonCode id) const

Returns the button that corresponds to the id.

Normally you should not use this function. Never delete the object returned by this function. See also enableButton(), showButton(), setButtonGuiItem().

Parameters
idIdentifier of the button.
Returns
The button or 0 if the button does not exist.

Definition at line 591 of file KoDialog.cpp.

592{
593 Q_D(const KoDialog);
594 return d->mButtonList.value(id, 0);
595}

◆ buttonClicked

void KoDialog::buttonClicked ( KoDialog::ButtonCode button)
signal

A button has been pressed. This signal is only emitted if slotButtonClicked() is not replaced

Parameters
buttonis the code of the pressed button.

◆ buttonIcon()

QIcon KoDialog::buttonIcon ( ButtonCode id) const

Returns the icon of any button.

Definition at line 681 of file KoDialog.cpp.

682{
683 QPushButton *button = this->button(id);
684 if (button) {
685 return button->icon();
686 } else {
687 return QIcon();
688 }
689}
QPushButton * button(ButtonCode id) const
Definition KoDialog.cpp:591

References button().

◆ buttonText()

QString KoDialog::buttonText ( ButtonCode id) const

Returns the text of any button.

Definition at line 663 of file KoDialog.cpp.

664{
665 QPushButton *button = this->button(id);
666 if (button) {
667 return button->text();
668 } else {
669 return QString();
670 }
671}

References button().

◆ buttonToolTip()

QString KoDialog::buttonToolTip ( ButtonCode id) const

Returns the tooltip of any button.

Definition at line 703 of file KoDialog.cpp.

704{
705 QPushButton *button = this->button(id);
706 if (button) {
707 return button->toolTip();
708 } else {
709 return QString();
710 }
711}

References button().

◆ buttonWhatsThis()

QString KoDialog::buttonWhatsThis ( ButtonCode id) const

Returns the "What's this?" text of any button.

Definition at line 725 of file KoDialog.cpp.

726{
727 QPushButton *button = this->button(id);
728 if (button) {
729 return button->whatsThis();
730 } else {
731 return QString();
732 }
733}

References button().

◆ cancelClicked

void KoDialog::cancelClicked ( )
signal

The Cancel button was pressed. This signal is only emitted if slotButtonClicked() is not replaced

◆ closeClicked

void KoDialog::closeClicked ( )
signal

The Close button was pressed. This signal is only emitted if slotButtonClicked() is not replaced

◆ closeEvent()

void KoDialog::closeEvent ( QCloseEvent * e)
overrideprotected

Detects when a dialog is being closed from the window manager controls. If the Cancel or Close button is present then the button is activated. Otherwise standard QDialog behavior will take place.

Definition at line 943 of file KoDialog.cpp.

944{
945 Q_D(KoDialog);
946 QPushButton *button = this->button(d->mEscapeButton);
947 if (button && !isHidden()) {
948 button->animateClick();
949
950 if (testAttribute(Qt::WA_DeleteOnClose)) {
951 // Don't let QWidget::close do a deferred delete just yet, wait for the click first
952 d->mDeferredDelete = true;
953 setAttribute(Qt::WA_DeleteOnClose, false);
954 }
955 } else {
956 QDialog::closeEvent(event);
957 }
958}

References button().

◆ defaultButton()

KoDialog::ButtonCode KoDialog::defaultButton ( ) const

Returns the button code of the default button, or NoDefault if there is no default button.

Definition at line 340 of file KoDialog.cpp.

341{
342 Q_D(const KoDialog);
343 QHashIterator<int, QPushButton *> it(d->mButtonList);
344 while (it.hasNext()) {
345 it.next();
346 if (it.value()->isDefault()) {
347 return (ButtonCode)it.key();
348 }
349 }
350
351 return d->mDefaultButton;
352}

◆ defaultClicked

void KoDialog::defaultClicked ( )
signal

The Default button was pressed. This signal is only emitted if slotButtonClicked() is not replaced

◆ delayedDestruct

void KoDialog::delayedDestruct ( )
slot

Destruct the dialog delayed.

You can call this function from slots like closeClicked() and hidden(). You should not use the dialog any more after calling this function.

Deprecated
use hide()+deleteLater()

Definition at line 811 of file KoDialog.cpp.

812{
813 if (isVisible()) {
814 hide();
815 }
816
817 deleteLater();
818}

◆ enableButton

void KoDialog::enableButton ( ButtonCode id,
bool state )
slot

Enable or disable (gray out) a general action button.

Parameters
idButton identifier.
statetrue enables the button(s).

Definition at line 597 of file KoDialog.cpp.

598{
599 QPushButton *button = this->button(id);
600 if (button) {
601 button->setEnabled(state);
602 }
603}

References button().

◆ enableButtonApply

void KoDialog::enableButtonApply ( bool state)
slot

Enable or disable (gray out) the Apply button.

Parameters
statetrue enables the button.

Definition at line 620 of file KoDialog.cpp.

621{
622 enableButton(Apply, state);
623}
void enableButton(ButtonCode id, bool state)
Definition KoDialog.cpp:597

References Apply, and enableButton().

◆ enableButtonCancel

void KoDialog::enableButtonCancel ( bool state)
slot

Enable or disable (gray out) the Cancel button.

Parameters
statetrue enables the button.

Definition at line 625 of file KoDialog.cpp.

626{
627 enableButton(Cancel, state);
628}

References Cancel, and enableButton().

◆ enableButtonOk

void KoDialog::enableButtonOk ( bool state)
slot

Enable or disable (gray out) the OK button.

Parameters
statetrue enables the button.

Definition at line 615 of file KoDialog.cpp.

616{
617 enableButton(Ok, state);
618}

References enableButton(), and Ok.

◆ enableLinkedHelp

void KoDialog::enableLinkedHelp ( bool state)
slot

Display or hide the help link area on the top of the dialog.

Parameters
statetrue will display the area.
See also
helpLinkText()
setHelpLinkText()
setHelp()

Definition at line 885 of file KoDialog.cpp.

886{
887 Q_D(KoDialog);
888 if ((d->mUrlHelp != 0) == state) {
889 return;
890 }
891 if (state) {
892 if (d->mUrlHelp) {
893 return;
894 }
895
896 d->mUrlHelp = new KUrlLabel(this);
897 d->mUrlHelp->setText(helpLinkText());
898 d->mUrlHelp->setFloatEnabled(true);
899 d->mUrlHelp->setUnderline(true);
900 d->mUrlHelp->setMinimumHeight(fontMetrics().height() + marginHint());
901 connect(d->mUrlHelp, SIGNAL(leftClickedUrl()), SLOT(helpLinkClicked()));
902
903 d->mUrlHelp->show();
904 } else {
905 delete d->mUrlHelp;
906 d->mUrlHelp = 0;
907 }
908
909 d->setupLayout();
910}
static int marginHint()
Definition KoDialog.cpp:455
QString helpLinkText() const
Definition KoDialog.cpp:928

References connect(), helpLinkText(), and marginHint().

◆ finished

void KoDialog::finished ( )
signal

The dialog has finished.

A dialog emits finished after a user clicks a button that ends the dialog.

This signal is also emitted when you call hide()

If you have stored a pointer to the dialog do not try to delete the pointer in the slot that is connected to this signal.

You should use deleteLater() instead.

◆ groupSpacingHint()

int KoDialog::groupSpacingHint ( )
static

Returns the number of pixels that should be used to visually separate groups of related options in a dialog according to the KDE standard.

Since
4.2

Definition at line 465 of file KoDialog.cpp.

466{
467 return QApplication::fontMetrics().lineSpacing();
468}

◆ helpClicked

void KoDialog::helpClicked ( )
signal

The Help button was pressed. This signal is only emitted if slotButtonClicked() is not replaced

◆ helpLinkText()

QString KoDialog::helpLinkText ( ) const

Returns the help link text.

If no text has been defined, "Get help..." (internationalized) is returned.

Returns
The help link text.
See also
enableLinkedHelp()
setHelpLinkText()
setHelp()

Definition at line 928 of file KoDialog.cpp.

929{
930 Q_D(const KoDialog);
931 return (d->mHelpLinkText.isEmpty() ? i18n("Get help...") : d->mHelpLinkText);
932}

◆ hidden

void KoDialog::hidden ( )
signal

The dialog is about to be hidden.

A dialog is hidden after a user clicks a button that ends the dialog or when the user switches to another desktop or minimizes the dialog.

◆ hideEvent()

void KoDialog::hideEvent ( QHideEvent * event)
overrideprotected

Emits the hidden signal. You can connect to that signal to detect when a dialog has been closed.

Definition at line 934 of file KoDialog.cpp.

935{
936 Q_EMIT hidden();
937
938 if (!event->spontaneous()) {
939 Q_EMIT finished();
940 }
941}
void finished()
void hidden()

References finished(), and hidden().

◆ incrementInitialSize()

void KoDialog::incrementInitialSize ( const QSize & size)

Convenience method. Add a size to the default minimum size of a dialog.

This method should only be called right before show() or exec().

Parameters
sizeSize added to minimum size.

Definition at line 585 of file KoDialog.cpp.

586{
587 d_func()->mIncSize = size;
588 adjustSize();
589}
int size(const Forest< T > &forest)
Definition KisForest.h:1232

◆ isButtonEnabled()

bool KoDialog::isButtonEnabled ( ButtonCode id) const

Returns whether any button is enabled.

Definition at line 605 of file KoDialog.cpp.

606{
607 QPushButton *button = this->button(id);
608 if (button) {
609 return button->isEnabled();
610 }
611
612 return false;
613}

References button().

◆ isDetailsWidgetVisible

bool KoDialog::isDetailsWidgetVisible ( ) const
slot

Returns the status of the Details button.

Definition at line 764 of file KoDialog.cpp.

765{
766 return d_func()->mDetailsVisible;
767}

◆ keyPressEvent()

void KoDialog::keyPressEvent ( QKeyEvent * event)
overrideprotected

Definition at line 404 of file KoDialog.cpp.

405{
406 Q_D(KoDialog);
407 if (event->modifiers() == 0) {
408 if (event->key() == Qt::Key_F1) {
409 QPushButton *button = this->button(Help);
410
411 if (button) {
412 button->animateClick();
413 event->accept();
414 return;
415 }
416 }
417
418 if (event->key() == Qt::Key_Escape) {
419 QPushButton *button = this->button(d->mEscapeButton);
420
421 if (button) {
422 button->animateClick();
423 event->accept();
424 return;
425 }
426
427 }
428 } else if (event->key() == Qt::Key_F1 && event->modifiers() == Qt::ShiftModifier) {
429 QWhatsThis::enterWhatsThisMode();
430 event->accept();
431 return;
432 } else if (event->modifiers() == Qt::ControlModifier &&
433 (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)) {
434 // accept the dialog when Ctrl-Return is pressed
435 QPushButton *button = this->button(Ok);
436
437 if (button) {
438 button->animateClick();
439 event->accept();
440 return;
441 }
442 }
443
444 QDialog::keyPressEvent(event);
445}

References button(), Help, and Ok.

◆ layoutHintChanged

void KoDialog::layoutHintChanged ( )
signal

Emitted when the margin size and/or spacing size have changed.

Use marginHint() and spacingHint() in your slot to get the new values.

Deprecated
This signal is not emitted. Listen to QEvent::StyleChange events instead.

◆ mainWidget()

QWidget * KoDialog::mainWidget ( )
Returns
The current main widget. Will create a QWidget as the mainWidget if none was set before. This way you can write
ui.setupUi(mainWidget());
QWidget * mainWidget()
Definition KoDialog.cpp:368
when using designer.

Definition at line 368 of file KoDialog.cpp.

369{
370 Q_D(KoDialog);
371 if (!d->mMainWidget) {
372 setMainWidget(new QWidget(this));
373 }
374 return d->mMainWidget;
375}
void setMainWidget(QWidget *widget)
Definition KoDialog.cpp:354

References setMainWidget().

◆ makeStandardCaption()

QString KoDialog::makeStandardCaption ( const QString & userCaption,
QWidget * window = 0,
CaptionFlags flags = HIGCompliantCaption )
static

Builds a caption that contains the application name along with the userCaption using a standard layout.

To make a compliant caption for your window, simply do: setWindowTitle(KoDialog::makeStandardCaption(yourCaption));

To ensure that the caption is appropriate to the desktop in which the application is running, pass in a pointer to the window the caption will be applied to.

If using a KoDialog or KisKMainWindow subclass, call setCaption instead and an appropriate standard caption will be created for you

Parameters
userCaptionThe caption string you want to display in the window caption area. Do not include the application name!
windowa pointer to the window this application will apply to
flags
Returns
the created caption

Definition at line 470 of file KoDialog.cpp.

473{
474 Q_UNUSED(window);
475 QString caption = qApp->applicationDisplayName();
476 QString captionString = userCaption.isEmpty() ? caption : userCaption;
477
478 // If the document is modified, add '[modified]'.
479 if (flags & ModifiedCaption) {
480 captionString += QString::fromUtf8(" [") + i18n("modified") + QString::fromUtf8("]");
481 }
482
483 if (!userCaption.isEmpty()) {
484 // Add the application name if:
485 // User asked for it, it's not a duplication and the app name (caption()) is not empty
486 if (flags & AppNameCaption &&
487 !caption.isEmpty() &&
488 !userCaption.endsWith(caption)) {
489 // TODO: check to see if this is a transient/secondary window before trying to add the app name
490 // on platforms that need this
491 captionString += i18nc("Document/application separator in titlebar", " – ") + caption;
492 }
493 }
494
495 return captionString;
496}

References AppNameCaption, and ModifiedCaption.

◆ marginHint()

int KoDialog::marginHint ( )
static

Returns the number of pixels that should be used between a dialog edge and the outermost widget(s) according to the KDE standard.

Deprecated
Use the style's pixelMetric() function to query individual margins. Different platforms may use different values for the four margins.

Definition at line 455 of file KoDialog.cpp.

456{
457 return QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
458}

◆ minimumSizeHint()

QSize KoDialog::minimumSizeHint ( ) const
override

Reimplemented from QDialog.

Definition at line 391 of file KoDialog.cpp.

392{
393 Q_D(const KoDialog);
394
395 if (d->dirty) {
396 const_cast<KoDialogPrivate *>(d)->queuedLayoutUpdate();
397 }
398 return QDialog::minimumSizeHint() + d->mIncSize;
399}

◆ noClicked

void KoDialog::noClicked ( )
signal

The No button was pressed. This signal is only emitted if slotButtonClicked() is not replaced

◆ okClicked

void KoDialog::okClicked ( )
signal

The OK button was pressed. This signal is only emitted if slotButtonClicked() is not replaced

◆ resetClicked

void KoDialog::resetClicked ( )
signal

The Reset button was pressed. This signal is only emitted if slotButtonClicked() is not replaced

◆ resizeLayout() [1/2]

void KoDialog::resizeLayout ( QLayout * lay,
int margin,
int spacing )
static

Resize every layout associated with lay and its children.

Parameters
laylayout to be resized
marginThe new layout margin
spacingThe new layout spacing
Deprecated
Use QLayout functions where necessary. Setting margin and spacing values recursively for all children prevents QLayout from creating platform native layouts.

Definition at line 539 of file KoDialog.cpp.

540{
541 QLayoutItem *child;
542 int pos = 0;
543
544 while ((child = layout->itemAt(pos))) {
545 if (child->layout()) {
546 resizeLayout(child->layout(), margin, spacing);
547 }
548
549 ++pos;
550 }
551
552 if (layout->layout()) {
553 layout->layout()->setContentsMargins(margin, margin, margin, margin);
554 layout->layout()->setSpacing(spacing);
555 }
556}
static void resizeLayout(QWidget *widget, int margin, int spacing)
Definition KoDialog.cpp:523

References resizeLayout().

◆ resizeLayout() [2/2]

void KoDialog::resizeLayout ( QWidget * widget,
int margin,
int spacing )
static

Resize every layout manager used in widget and its nested children.

Parameters
widgetThe widget used.
marginThe new layout margin.
spacingThe new layout spacing.
Deprecated
Use QLayout functions where necessary. Setting margin and spacing values recursively for all children prevents QLayout from creating platform native layouts.

Definition at line 523 of file KoDialog.cpp.

524{
525 if (widget->layout()) {
526 resizeLayout(widget->layout(), margin, spacing);
527 }
528
529 if (widget->children().count() > 0) {
530 const QList<QObject *> list = widget->children();
531 foreach (QObject *object, list) {
532 if (object->isWidgetType()) {
533 resizeLayout((QWidget *)object, margin, spacing);
534 }
535 }
536 }
537}

References resizeLayout().

◆ setButtonFocus()

void KoDialog::setButtonFocus ( ButtonCode id)

Sets the focus to the button of the passed id.

Definition at line 735 of file KoDialog.cpp.

736{
737 QPushButton *button = this->button(id);
738 if (button) {
739 button->setFocus();
740 }
741}

References button().

◆ setButtonGuiItem()

void KoDialog::setButtonGuiItem ( ButtonCode id,
const KGuiItem & item )

Sets the KGuiItem directly for the button instead of using 3 methods to set the text, tooltip and whatsthis strings. This also allows to set an icon for the button which is otherwise not possible for the extra buttons beside Ok, Cancel and Apply.

Parameters
idThe button identifier.
itemThe KGuiItem for the button.

Definition at line 638 of file KoDialog.cpp.

639{
640 QPushButton *button = this->button(id);
641 if (!button) {
642 return;
643 }
644
645 KGuiItem::assign(button, item);
646}

References button().

◆ setButtonIcon()

void KoDialog::setButtonIcon ( ButtonCode id,
const QIcon & icon )

Sets the icon of any button.

Parameters
idThe button identifier.
iconButton icon.

Definition at line 673 of file KoDialog.cpp.

674{
675 QPushButton *button = this->button(id);
676 if (button) {
677 button->setIcon(icon);
678 }
679}

References button().

◆ setButtons()

void KoDialog::setButtons ( ButtonCodes buttonMask)

Creates (or recreates) the button box and all the buttons in it.

Note that some combinations are not possible. That means, you can't have the following pairs of buttons in a dialog:

  • Default and Details
  • Cancel and Close
  • Ok and Try

This will reset all default KGuiItem of all button.

Parameters
buttonMaskSpecifies what buttons will be made.
Deprecated
Since 5.0 use QDialogButtonBox

Definition at line 195 of file KoDialog.cpp.

196{
197 Q_D(KoDialog);
198 if (d->mButtonBox) {
199 d->mButtonList.clear();
200
201 delete d->mButtonBox;
202 d->mButtonBox = 0;
203 }
204
205 if (buttonMask & Cancel) {
206 buttonMask &= ~Close;
207 }
208
209 if (buttonMask & Apply) {
210 buttonMask &= ~Try;
211 }
212
213 if (buttonMask & Details) {
214 buttonMask &= ~Default;
215 }
216
217 if (buttonMask == None) {
218 d->setupLayout();
219 return; // When we want no button box
220 }
221
222 d->mEscapeButton = (buttonMask & Cancel) ? Cancel : Close;
223 d->mButtonBox = new QDialogButtonBox(this);
224
225 if (buttonMask & Help) {
226 d->appendButton(Help, KStandardGuiItem::help());
227 }
228 if (buttonMask & Default) {
229 d->appendButton(Default, KStandardGuiItem::defaults());
230 }
231 if (buttonMask & Reset) {
232 d->appendButton(Reset, KStandardGuiItem::reset());
233 }
234 if (buttonMask & User3) {
235 d->appendButton(User3, KGuiItem());
236 }
237 if (buttonMask & User2) {
238 d->appendButton(User2, KGuiItem());
239 }
240 if (buttonMask & User1) {
241 d->appendButton(User1, KGuiItem());
242 }
243 if (buttonMask & Ok) {
244 d->appendButton(Ok, KStandardGuiItem::ok());
245 }
246 if (buttonMask & Apply) {
247 d->appendButton(Apply, KStandardGuiItem::apply());
248 }
249 if (buttonMask & Try) {
250 d->appendButton(Try, KGuiItem(i18n("&Try")));
251 }
252 if (buttonMask & Cancel) {
253 d->appendButton(Cancel, KStandardGuiItem::cancel());
254 }
255 if (buttonMask & Close) {
256 d->appendButton(Close, KStandardGuiItem::close());
257 }
258 if (buttonMask & Yes) {
259#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
260 d->appendButton(Yes, KStandardGuiItem::yes());
261#else
262 d->appendButton(Yes, KStandardGuiItem::apply());
263#endif
264 }
265 if (buttonMask & No) {
266#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
267 d->appendButton(No, KStandardGuiItem::no());
268#else
269 d->appendButton(No, KStandardGuiItem::cancel());
270#endif
271
272 }
273 if (buttonMask & Details) {
274 d->appendButton(Details, KGuiItem(QString(), "help-about"));
276 }
277
278 d->setupLayout();
279}
void setDetailsWidgetVisible(bool visible)
Definition KoDialog.cpp:769

References Apply, Cancel, Close, Default, Details, Help, No, None, Ok, Reset, setDetailsWidgetVisible(), Try, User1, User2, User3, and Yes.

◆ setButtonsOrientation()

void KoDialog::setButtonsOrientation ( Qt::Orientation orientation)

Sets the orientation of the button box.

It can be Vertical or Horizontal. If Horizontal (default), the button box is positioned at the bottom of the dialog. If Vertical it will be placed at the right edge of the dialog.

Parameters
orientationThe button box orientation.

Definition at line 281 of file KoDialog.cpp.

282{
283 Q_D(KoDialog);
284 if (d->mButtonOrientation != orientation) {
285 d->mButtonOrientation = orientation;
286
287 if (d->mActionSeparator) {
288 d->mActionSeparator->setOrientation(d->mButtonOrientation);
289 }
290
291 if (d->mButtonOrientation == Qt::Vertical) {
292 enableLinkedHelp(false); // 2000-06-18 Espen: No support for this yet.
293 }
294 }
295}
void enableLinkedHelp(bool state)
Definition KoDialog.cpp:885

References enableLinkedHelp().

◆ setButtonText()

void KoDialog::setButtonText ( ButtonCode id,
const QString & text )

Sets the text of any button.

Parameters
idThe button identifier.
textButton text.

Definition at line 648 of file KoDialog.cpp.

649{
650 Q_D(KoDialog);
651 if (!d->mSettingDetails && (id == Details)) {
652 d->mDetailsButtonText = text;
653 setDetailsWidgetVisible(d->mDetailsVisible);
654 return;
655 }
656
657 QPushButton *button = this->button(id);
658 if (button) {
659 button->setText(text);
660 }
661}

References button(), Details, and setDetailsWidgetVisible().

◆ setButtonToolTip()

void KoDialog::setButtonToolTip ( ButtonCode id,
const QString & text )

Sets the tooltip text of any button.

Parameters
idThe button identifier.
textButton text.

Definition at line 691 of file KoDialog.cpp.

692{
693 QPushButton *button = this->button(id);
694 if (button) {
695 if (text.isEmpty()) {
696 button->setToolTip(QString());
697 } else {
698 button->setToolTip(text);
699 }
700 }
701}

References button().

◆ setButtonWhatsThis()

void KoDialog::setButtonWhatsThis ( ButtonCode id,
const QString & text )

Sets the "What's this?" text of any button.

Parameters
idThe button identifier.
textButton text.

Definition at line 713 of file KoDialog.cpp.

714{
715 QPushButton *button = this->button(id);
716 if (button) {
717 if (text.isEmpty()) {
718 button->setWhatsThis(QString());
719 } else {
720 button->setWhatsThis(text);
721 }
722 }
723}

References button().

◆ setCaption [1/2]

void KoDialog::setCaption ( const QString & caption)
virtualslot

Make a KDE compliant caption.

Parameters
captionYour caption. Do not include the application name in this string. It will be added automatically according to the KDE standard.
Deprecated
Since 5.0 use QWidget::setWindowTitle

Definition at line 498 of file KoDialog.cpp.

499{
500 const QString caption = makeStandardCaption(_caption, this);
501 setPlainCaption(caption);
502}
static QString makeStandardCaption(const QString &userCaption, QWidget *window=0, CaptionFlags flags=HIGCompliantCaption)
Definition KoDialog.cpp:470
virtual void setPlainCaption(const QString &caption)
Definition KoDialog.cpp:516

References makeStandardCaption(), and setPlainCaption().

◆ setCaption [2/2]

void KoDialog::setCaption ( const QString & caption,
bool modified )
virtualslot

Makes a KDE compliant caption.

Parameters
captionYour caption. Do not include the application name in this string. It will be added automatically according to the KDE standard.
modifiedSpecify whether the document is modified. This displays an additional sign in the title bar, usually "**".
Deprecated
Since 5.0 use QWidget::setWindowTitle and QWidget::setWindowModified.

Definition at line 504 of file KoDialog.cpp.

505{
506 CaptionFlags flags = HIGCompliantCaption;
507
508 // ### Qt5 TODO: port to [*], see QWidget::setWindowFilePath
509 if (modified) {
510 flags |= ModifiedCaption;
511 }
512
513 setPlainCaption(makeStandardCaption(caption, this, flags));
514}

References HIGCompliantCaption, makeStandardCaption(), ModifiedCaption, and setPlainCaption().

◆ setDefaultButton()

void KoDialog::setDefaultButton ( ButtonCode id)

Sets the button that will be activated when the Enter key is pressed.

By default, this is the Ok button if it is present

Parameters
idThe button code.

Definition at line 302 of file KoDialog.cpp.

303{
304 Q_D(KoDialog);
305
306 if (newDefaultButton == None) {
307 newDefaultButton = NoDefault; // #148969
308 }
309
310 const KoDialog::ButtonCode oldDefault = defaultButton();
311
312 bool oldDefaultHadFocus = false;
313
314 if (oldDefault != NoDefault) {
315 QPushButton *old = button(oldDefault);
316 if (old) {
317 oldDefaultHadFocus = (focusWidget() == old);
318 old->setDefault(false);
319 }
320 }
321
322 if (newDefaultButton != NoDefault) {
323 QPushButton *b = button(newDefaultButton);
324 if (b) {
325 b->setDefault(true);
326 if (focusWidget() == 0 || oldDefaultHadFocus) {
327 // No widget had focus yet, or the old default button had
328 // -> ok to give focus to the new default button, so that it's
329 // really default (Enter triggers it).
330 // But we don't do this if the kdialog user gave focus to a
331 // specific widget in the dialog.
332 b->setFocus();
333 }
334 }
335 }
336 d->mDefaultButton = newDefaultButton;
337 Q_ASSERT(defaultButton() == newDefaultButton);
338}
ButtonCode defaultButton() const
Definition KoDialog.cpp:340

References button(), defaultButton(), NoDefault, and None.

◆ setDetailsWidget

void KoDialog::setDetailsWidget ( QWidget * detailsWidget)
slot

Sets the widget that gets shown when "Details" is enabled.

The dialog takes over ownership of the widget. Any previously set widget gets deleted.

Definition at line 743 of file KoDialog.cpp.

744{
745 Q_D(KoDialog);
746 if (d->mDetailsWidget == detailsWidget) {
747 return;
748 }
749 delete d->mDetailsWidget;
750 d->mDetailsWidget = detailsWidget;
751
752 if (d->mDetailsWidget->parentWidget() != this) {
753 d->mDetailsWidget->setParent(this);
754 }
755
756 d->mDetailsWidget->hide();
757 d->setupLayout();
758
759 if (!d->mSettingDetails) {
760 setDetailsWidgetVisible(d->mDetailsVisible);
761 }
762}

References setDetailsWidgetVisible().

◆ setDetailsWidgetVisible

void KoDialog::setDetailsWidgetVisible ( bool visible)
slot

Sets the status of the Details button.

Definition at line 769 of file KoDialog.cpp.

770{
771 Q_D(KoDialog);
772 if (d->mDetailsButtonText.isEmpty()) {
773 d->mDetailsButtonText = i18n("&Details");
774 }
775
776 d->mSettingDetails = true;
777 d->mDetailsVisible = visible;
778 if (d->mDetailsVisible) {
779 Q_EMIT aboutToShowDetails();
780 setButtonText(Details, d->mDetailsButtonText + " <<");
781 if (d->mDetailsWidget) {
782 if (layout()) {
783 layout()->setEnabled(false);
784 }
785
786 d->mDetailsWidget->show();
787
788 adjustSize();
789
790 if (layout()) {
791 layout()->activate();
792 layout()->setEnabled(true);
793 }
794 }
795 } else {
796 setButtonText(Details, d->mDetailsButtonText + " >>");
797 if (d->mDetailsWidget) {
798 d->mDetailsWidget->hide();
799 }
800
801 if (layout()) {
802 layout()->activate();
803 adjustSize();
804 }
805
806 }
807
808 d->mSettingDetails = false;
809}
void aboutToShowDetails()
void setButtonText(ButtonCode id, const QString &text)
Definition KoDialog.cpp:648

References aboutToShowDetails(), Details, and setButtonText().

◆ setEscapeButton()

void KoDialog::setEscapeButton ( ButtonCode id)

Sets the button that will be activated when the Escape key is pressed.

By default, the Escape key is mapped to either the Cancel or the Close button if one of these buttons are defined. The user expects that Escape will cancel an operation so use this function with caution.

Parameters
idThe button code.

Definition at line 297 of file KoDialog.cpp.

298{
299 d_func()->mEscapeButton = id;
300}

◆ setHelp

void KoDialog::setHelp ( const QString & anchor,
const QString & appname = QString() )
slot

Sets the help path and topic.

Parameters
anchorDefined anchor in your docbook sources
appnameDefines the appname the help belongs to If empty it's the current one
Note
The help button works differently for the class KCMultiDialog, so it does not make sense to call this function for Dialogs of that type. See KCMultiDialog::slotHelp() for more information.

Definition at line 912 of file KoDialog.cpp.

913{
914 Q_D(KoDialog);
915 d->mAnchor = anchor;
916 d->mHelpApp = appname;
917}

◆ setHelpLinkText

void KoDialog::setHelpLinkText ( const QString & text)
slot

Sets the text that is shown as the linked text.

If text is empty, the text "Get help..." (internationalized) is used instead.

Parameters
textThe link text.
See also
helpLinkText()
enableLinkedHelp()
setHelp()

Definition at line 919 of file KoDialog.cpp.

920{
921 Q_D(KoDialog);
922 d->mHelpLinkText = text;
923 if (d->mUrlHelp) {
924 d->mUrlHelp->setText(helpLinkText());
925 }
926}

References helpLinkText().

◆ setInitialSize()

void KoDialog::setInitialSize ( const QSize & size)

Convenience method. Sets the initial dialog size.

This method should only be called right before show() or exec(). The initial size will be ignored if smaller than the dialog's minimum size.

Parameters
sizeStartup size.

Definition at line 579 of file KoDialog.cpp.

580{
581 d_func()->mMinSize = size;
582 adjustSize();
583}

◆ setMainWidget()

void KoDialog::setMainWidget ( QWidget * widget)

Sets the main widget of the dialog.

Definition at line 354 of file KoDialog.cpp.

355{
356 Q_D(KoDialog);
357 if (d->mMainWidget == widget) {
358 return;
359 }
360 d->mMainWidget = widget;
361 if (d->mMainWidget && d->mMainWidget->layout()) {
362 // Avoid double-margin problem
363 d->mMainWidget->layout()->setContentsMargins(0, 0, 0, 0);
364 }
365 d->setupLayout();
366}

◆ setPlainCaption

void KoDialog::setPlainCaption ( const QString & caption)
virtualslot

Make a plain caption without any modifications.

Parameters
captionYour caption. This is the string that will be displayed in the window title.

Definition at line 516 of file KoDialog.cpp.

517{
518 if (QWidget *win = window()) {
519 win->setWindowTitle(caption);
520 }
521}

◆ showButton()

void KoDialog::showButton ( ButtonCode id,
bool state )

Hide or display a general action button.

Only buttons that have been created in the constructor can be displayed. This method will not create a new button.

Parameters
idButton identifier.
statetrue display the button(s).

Definition at line 630 of file KoDialog.cpp.

631{
632 QPushButton *button = this->button(id);
633 if (button) {
634 state ? button->show() : button->hide();
635 }
636}

References button().

◆ showButtonSeparator()

void KoDialog::showButtonSeparator ( bool state)

Hide or display the a separator line drawn between the action buttons an the main widget.

Definition at line 558 of file KoDialog.cpp.

559{
560 Q_D(KoDialog);
561 if ((d->mActionSeparator != 0) == state) {
562 return;
563 }
564 if (state) {
565 if (d->mActionSeparator) {
566 return;
567 }
568
569 d->mActionSeparator = new KSeparator(this);
570 d->mActionSeparator->setOrientation(d->mButtonOrientation);
571 } else {
572 delete d->mActionSeparator;
573 d->mActionSeparator = 0;
574 }
575
576 d->setupLayout();
577}

◆ showEvent()

void KoDialog::showEvent ( QShowEvent * e)
overrideprotected

Definition at line 447 of file KoDialog.cpp.

448{
449 QDialog::showEvent(e);
450 QTimer::singleShot(5, Qt::CoarseTimer, [&]() {
451 adjustPosition(parentWidget());
452 });
453}

◆ sizeHint()

QSize KoDialog::sizeHint ( ) const
override

Reimplemented from QDialog.

Definition at line 377 of file KoDialog.cpp.

378{
379 Q_D(const KoDialog);
380
381 if (!d->mMinSize.isEmpty()) {
382 return d->mMinSize.expandedTo(minimumSizeHint()) + d->mIncSize;
383 } else {
384 if (d->dirty) {
385 const_cast<KoDialogPrivate *>(d)->queuedLayoutUpdate();
386 }
387 return QDialog::sizeHint() + d->mIncSize;
388 }
389}
QSize minimumSizeHint() const override
Definition KoDialog.cpp:391

References minimumSizeHint().

◆ slotButtonClicked

void KoDialog::slotButtonClicked ( int button)
protectedvirtualslot

Activated when the button button is clicked

Sample that shows how to catch and handle button clicks within an own dialog;

class MyDialog : public KoDialog {
protected Q_SLOTS:
virtual void slotButtonClicked(int button) {
accept();
else
}
}
virtual void slotButtonClicked(int button)
Definition KoDialog.cpp:820
QString button(const QWheelEvent &ev)
Parameters
buttonis the type KoDialog::ButtonCode
Deprecated
since 5.0 use QDialogButtonBox and connect to the clicked signal

Definition at line 820 of file KoDialog.cpp.

821{
822 Q_D(KoDialog);
823 Q_EMIT buttonClicked(static_cast<KoDialog::ButtonCode>(button));
824
825 switch (button) {
826 case Ok:
827 Q_EMIT okClicked();
828 accept();
829 break;
830 case Apply:
831 Q_EMIT applyClicked();
832 break;
833 case Try:
834 Q_EMIT tryClicked();
835 break;
836 case User3:
837 Q_EMIT user3Clicked();
838 break;
839 case User2:
840 Q_EMIT user2Clicked();
841 break;
842 case User1:
843 Q_EMIT user1Clicked();
844 break;
845 case Yes:
846 Q_EMIT yesClicked();
847 done(Yes);
848 break;
849 case No:
850 Q_EMIT noClicked();
851 done(No);
852 break;
853 case Cancel:
854 Q_EMIT cancelClicked();
855 reject();
856 break;
857 case Close:
858 Q_EMIT closeClicked();
859 done(Close); // KDE5: call reject() instead; more QDialog-like.
860 break;
861 case Help:
862 Q_EMIT helpClicked();
863 if (!d->mAnchor.isEmpty() || !d->mHelpApp.isEmpty()) {
864 KHelpClient::invokeHelp(d->mAnchor, d->mHelpApp);
865 }
866 break;
867 case Default:
868 Q_EMIT defaultClicked();
869 break;
870 case Reset:
871 Q_EMIT resetClicked();
872 break;
873 case Details:
874 setDetailsWidgetVisible(!d->mDetailsVisible);
875 break;
876 }
877
878 // If we're here from the closeEvent, and auto-delete is on, well, auto-delete now.
879 if (d->mDeferredDelete) {
880 d->mDeferredDelete = false;
882 }
883}
void user1Clicked()
void user3Clicked()
void tryClicked()
void resetClicked()
void delayedDestruct()
Definition KoDialog.cpp:811
void yesClicked()
void defaultClicked()
void helpClicked()
void buttonClicked(KoDialog::ButtonCode button)
void user2Clicked()
void noClicked()
void cancelClicked()
void closeClicked()
KRITAWIDGETUTILS_EXPORT void invokeHelp(const QString &anchor=QString(), const QString &appname=QString())

References Apply, applyClicked(), button(), buttonClicked(), Cancel, cancelClicked(), Close, closeClicked(), Default, defaultClicked(), delayedDestruct(), Details, Help, helpClicked(), KHelpClient::invokeHelp(), No, noClicked(), Ok, okClicked(), Reset, resetClicked(), setDetailsWidgetVisible(), Try, tryClicked(), User1, user1Clicked(), User2, user2Clicked(), User3, user3Clicked(), Yes, and yesClicked().

◆ spacingHint()

int KoDialog::spacingHint ( )
static

Returns the number of pixels that should be used between widgets inside a dialog according to the KDE standard.

Deprecated
Use the style's layoutSpacing() function to query individual spacings. Different platforms may use different values depending on widget types and pairs.

Definition at line 460 of file KoDialog.cpp.

461{
462 return QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
463}

◆ tryClicked

void KoDialog::tryClicked ( )
signal

The Try button was pressed. This signal is only emitted if slotButtonClicked() is not replaced

◆ user1Clicked

void KoDialog::user1Clicked ( )
signal

The User1 button was pressed. This signal is only emitted if slotButtonClicked() is not replaced

◆ user2Clicked

void KoDialog::user2Clicked ( )
signal

The User2 button was pressed. This signal is only emitted if slotButtonClicked() is not replaced

◆ user3Clicked

void KoDialog::user3Clicked ( )
signal

The User3 button was pressed. This signal is only emitted if slotButtonClicked() is not replaced

◆ yesClicked

void KoDialog::yesClicked ( )
signal

The Yes button was pressed. This signal is only emitted if slotButtonClicked() is not replaced

Member Data Documentation

◆ d_ptr

KoDialogPrivate* const KoDialog::d_ptr
private

Definition at line 787 of file KoDialog.h.


The documentation for this class was generated from the following files: