• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • kdeui
  • dialogs
kdialog.h
Go to the documentation of this file.
1/* This file is part of the KDE Libraries
2 * Copyright (C) 1998 Thomas Tanghus (tanghus@earthling.net)
3 * Additions 1999-2000 by Espen Sand (espen@kde.org)
4 * and Holger Freyther <freyther@kde.org>
5 * 2005-2009 Olivier Goffart <ogoffart @ kde.org>
6 * 2006 Tobias Koenig <tokoe@kde.org>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 */
23
24#ifndef KDIALOG_H
25#define KDIALOG_H
26
27class KPushButton;
28class QMenu;
29class KDialogPrivate;
30
31#include <kdeui_export.h>
32#include <kconfiggroup.h>
33#include <kguiitem.h>
34
35#include <QtGui/QDialog>
36
128class KDEUI_EXPORT KDialog : public QDialog //krazy:exclude=qclasses
129{
130 Q_OBJECT
131 Q_ENUMS(ButtonCode)
132 Q_DECLARE_PRIVATE(KDialog)
133
134 public:
135
136 enum ButtonCode
137 {
138 None = 0x00000000,
139 Help = 0x00000001,
140 Default = 0x00000002,
141 Ok = 0x00000004,
142 Apply = 0x00000008,
143 Try = 0x00000010,
144 Cancel = 0x00000020,
145 Close = 0x00000040,
146 No = 0x00000080,
147 Yes = 0x00000100,
148 Reset = 0x00000200,
149 Details = 0x00000400,
150 User1 = 0x00001000,
151 User2 = 0x00002000,
152 User3 = 0x00004000,
153 NoDefault = 0x00008000
154 };
155 // TODO KDE5: remove NoDefault and use the value None instead
156 Q_DECLARE_FLAGS(ButtonCodes, ButtonCode)
157
158 enum ButtonPopupMode
159 {
160 InstantPopup = 0,
161 DelayedPopup = 1
162 };
163 Q_DECLARE_FLAGS(ButtonPopupModes, ButtonPopupMode)
164
165 public:
172 explicit KDialog( QWidget *parent = 0, Qt::WindowFlags flags = 0 );
173
177 ~KDialog();
178
192 void setButtons( ButtonCodes buttonMask );
193
204 void setButtonsOrientation( Qt::Orientation orientation );
205
216 void setEscapeButton( ButtonCode id );
217
226 void setDefaultButton( ButtonCode id );
227
232 ButtonCode defaultButton() const;
233
238 void showButtonSeparator( bool state );
239
250 void showButton( ButtonCode id, bool state );
251
258 void setButtonText( ButtonCode id, const QString &text );
259
263 QString buttonText( ButtonCode id ) const;
264
271 void setButtonIcon( ButtonCode id, const KIcon &icon );
272
276 KIcon buttonIcon( ButtonCode id ) const;
277
284 void setButtonToolTip( ButtonCode id, const QString &text );
285
289 QString buttonToolTip( ButtonCode id ) const;
290
297 void setButtonWhatsThis( ButtonCode id, const QString &text );
298
302 QString buttonWhatsThis( ButtonCode id ) const;
303
313 void setButtonGuiItem( ButtonCode id, const KGuiItem &item );
314
322 void setButtonMenu( ButtonCode id, QMenu *menu, ButtonPopupMode popupmode=InstantPopup);
323
327 void setButtonFocus( ButtonCode id );
328
338 void setInitialSize( const QSize &size );
339
348 void incrementInitialSize( const QSize &size );
349
358 void restoreDialogSize( const KConfigGroup& config ) ;
359
369 void saveDialogSize( KConfigGroup& config, KConfigGroup::WriteConfigFlags options = KConfigGroup::Normal ) const;
370
383 QString helpLinkText() const;
384
388 bool isButtonEnabled( ButtonCode id ) const;
389
400 KPushButton* button( ButtonCode id ) const;
401
409 static int marginHint();
410
418 static int spacingHint();
419
426 static int groupSpacingHint();
427
440 enum CaptionFlag
441 {
442 NoCaptionFlags = 0,
443 AppNameCaption = 1,
444 ModifiedCaption = 2,
445 HIGCompliantCaption = AppNameCaption
446 };
447 Q_DECLARE_FLAGS(CaptionFlags, CaptionFlag)
448
449
469 static QString makeStandardCaption( const QString &userCaption,
470 QWidget* window = 0,
471 CaptionFlags flags = HIGCompliantCaption );
472
484 static void resizeLayout( QWidget *widget, int margin, int spacing );
485
497 static void resizeLayout( QLayout *lay, int margin, int spacing );
498
508 static void centerOnScreen( QWidget *widget, int screen = -1 );
509
518 static bool avoidArea( QWidget *widget, const QRect& area, int screen = -1 );
519
523 void setMainWidget( QWidget *widget );
524
533 QWidget *mainWidget();
534
538 virtual QSize sizeHint() const;
539
543 virtual QSize minimumSizeHint() const;
544
550 static void setAllowEmbeddingInGraphicsView( bool allowEmbedding );
551
552 public Q_SLOTS:
560 virtual void setCaption( const QString &caption );
561
571 virtual void setCaption( const QString &caption, bool modified );
572
579 virtual void setPlainCaption( const QString &caption );
580
587 void enableButton( ButtonCode id, bool state );
588
594 void enableButtonOk( bool state );
595
601 void enableButtonApply( bool state );
602
608 void enableButtonCancel( bool state );
609
619 void enableLinkedHelp( bool state );
620
633 void setHelpLinkText( const QString &text );
634
647 void setHelp( const QString &anchor, const QString &appname = QString() );
648
652 bool isDetailsWidgetVisible() const;
653
657 void setDetailsWidgetVisible( bool visible );
658
665 void setDetailsWidget( QWidget *detailsWidget );
666
673 void delayedDestruct();
674
675 Q_SIGNALS:
685 void layoutHintChanged();
686
691 void helpClicked();
692
697 void defaultClicked();
698
703 void resetClicked();
704
709 void user3Clicked();
710
715 void user2Clicked();
716
721 void user1Clicked();
722
727 void applyClicked();
728
733 void tryClicked();
734
739 void okClicked();
740
745 void yesClicked();
746
751 void noClicked();
752
757 void cancelClicked();
758
763 void closeClicked();
764
770 void buttonClicked( KDialog::ButtonCode button);
771
779 void hidden();
780
795 void finished();
796
801 void aboutToShowDetails();
802
803 protected:
808 virtual void hideEvent( QHideEvent * );
809
816 virtual void closeEvent( QCloseEvent *e );
817
821 virtual void keyPressEvent( QKeyEvent* );
822
823 protected Q_SLOTS:
843 virtual void slotButtonClicked(int button);
844
851 void updateGeometry();
852
853 protected:
854 KDialog(KDialogPrivate &dd, QWidget *parent, Qt::WindowFlags flags = 0);
855 KDialogPrivate *const d_ptr;
856
857 private:
858 Q_DISABLE_COPY(KDialog)
859 Q_PRIVATE_SLOT(d_ptr, void queuedLayoutUpdate())
860 Q_PRIVATE_SLOT(d_ptr, void helpLinkClicked())
861};
862
863Q_DECLARE_OPERATORS_FOR_FLAGS(KDialog::ButtonCodes)
864Q_DECLARE_OPERATORS_FOR_FLAGS(KDialog::CaptionFlags)
865
866#endif // KDIALOG_H
KConfigBase::Normal
Normal
KConfigGroup
KDialog
A dialog base class with standard buttons and predefined layouts.
Definition: kdialog.h:129
KDialog::ButtonPopupMode
ButtonPopupMode
Definition: kdialog.h:159
KDialog::defaultClicked
void defaultClicked()
The Default button was pressed.
KDialog::aboutToShowDetails
void aboutToShowDetails()
The detailsWidget is about to get shown.
KDialog::closeClicked
void closeClicked()
The Close button was pressed.
KDialog::user3Clicked
void user3Clicked()
The User3 button was pressed.
KDialog::tryClicked
void tryClicked()
The Try button was pressed.
KDialog::user2Clicked
void user2Clicked()
The User2 button was pressed.
KDialog::resetClicked
void resetClicked()
The Reset button was pressed.
KDialog::ButtonCode
ButtonCode
Definition: kdialog.h:137
KDialog::d_ptr
KDialogPrivate *const d_ptr
Definition: kdialog.h:855
KDialog::buttonClicked
void buttonClicked(KDialog::ButtonCode button)
A button has been pressed.
KDialog::yesClicked
void yesClicked()
The Yes button was pressed.
KDialog::okClicked
void okClicked()
The OK button was pressed.
KDialog::hidden
void hidden()
The dialog is about to be hidden.
KDialog::noClicked
void noClicked()
The No button was pressed.
KDialog::applyClicked
void applyClicked()
The Apply button was pressed.
KDialog::CaptionFlag
CaptionFlag
Definition: kdialog.h:441
KDialog::cancelClicked
void cancelClicked()
The Cancel button was pressed.
KDialog::helpClicked
void helpClicked()
The Help button was pressed.
KDialog::layoutHintChanged
void layoutHintChanged()
Emitted when the margin size and/or spacing size have changed.
KDialog::user1Clicked
void user1Clicked()
The User1 button was pressed.
KDialog::finished
void finished()
The dialog has finished.
KGuiItem
An abstract class for GUI data such as ToolTip and Icon.
Definition: kguiitem.h:37
KIcon
A wrapper around QIcon that provides KDE icon features.
Definition: kicon.h:41
KPushButton
A QPushButton with drag-support and KGuiItem support.
Definition: kpushbutton.h:47
QDialog
QMenu
QWidget
kconfiggroup.h
kdeui_export.h
kguiitem.h
None
None
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal