Source Code (Use browser search to find items of interest.)
Class Index
kdelibs'KDialogBaseTile (./kdelibs/kdeui/kdialogbase.h:64)
class KDialogBaseTile : public QObject
{
Q_OBJECT
public:
KDialogBaseTile( QObject *parent=0, const char *name=0 );
~KDialogBaseTile();
void set( const QPixmap *pix );
const QPixmap *get() const;
public slots:
void cleanup();
signals:
void pixmapChanged();
private:
QPixmap *mPixmap;
class KDialogBaseTilePrivate;
KDialogBaseTilePrivate *d;
};
/**
* This base class 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 ability to define at most three configurable buttons. You
* can define a main widget which contains your specific dialog layout or use
* a predefined layout. Currently, TreeList/Paged, Tabbed, Plain, Swallow
* and IconList mode layouts (faces) are available.
*
* 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.
*
* You can set a background tile (pixmap) for parts of the dialog. The
* tile you select is shared by all instances of this class in your
* application so that they all get the same look and feel.
*
* There is a tutorial available on http://developer.kde.org/ (NOT YET)
* that contains
* copy/paste examples as well a screenshots on how to use this class.
*
* @sect 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, User1 and User3. You must specify the text of the UserN
* buttons. Each button has a virtual slot so you can overload the method
* when required. The default slots emit a signal as well, so you can choose
* to connect a signal instead of overriding the slot.
* The default implementation of @ref slotHelp() will automatically enable the
* help system if you have provided a path to the help text. @ref slotCancel()
* and @ref slotClose() will run @ref QDialog::reject() while @ref slotOk()
* will run @ref QDialog::accept(). You define a default button in the
* constructor.
*
* @sect Dialog shapes:
*
* You can either use one of the prebuilt, easy to use, faces or
* define your own main widget. The dialog provides ready to use
* TreeList, Tabbed, Plain, Swallow and IconList faces. For the first
* two you then add pages with @ref addPage(). If you want complete
* control of how the dialog contents should look, then you can define
* a main widget by using @ref setMainWidget(). You only need to set
* the minimum size of that widget and the dialog will resize itself
* to fit this minimum size. The dialog is resizeable, but can not be
* made smaller than its minimum
* size.
*
* @sect Layout:
*
* The dialog consists of a help area on top (becomes visible if you define
* a help path and use @ref enableLinkedHelp()), the built-in dialog face or
* your own widget in the middle, and the button row at the bottom. You can
* also specify a separator to be shown above the button row.
*
* @sect Standard compliance:
*
* The class is derived form @ref KDialog(), so you get automatic access to
* the @ref KDialog::marginHint(), @ref KDialog::spacingHint() and the
* extended @ref KDialog::setCaption() method. NOTE: The main widget you
* use will be positioned inside the dialog using a margin (or border)
* equal to @ref KDialog::marginHint(). You shall not add a margin yourself.
* The example below (from kedit) shows how you use the top level widget
* and its layout. The second argument (the border) to <tt>QVBoxLayout</tt>
* is 0. This situation is valid for @ref addPage , @ref addVBoxPage ,
* @ref addHBoxPage , @ref addGridPage , @ref makeMainWidget,
* @ref makeVBoxMainWidget , @ref makeHBoxMainWidget and
* @ref makeGridMainWidget as well.
*
* <pre>
* UrlDlg::UrlDlg( QWidget *parent, const QString& caption,
* const QString& urltext)
* : KDialogBase( parent, "urldialog", true, caption, Ok|Cancel, Ok, true )
* {
* QWidget *page = new QWidget( this );
* setMainWidget(page);
* QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
*
* QLabel *label = new QLabel( caption, page, "caption" );
* topLayout->addWidget( label );
*
* lineedit = new QLineEdit( urltext, page, "lineedit" );
* lineedit->setMinimumWidth(fontMetrics().maxWidth()*20);
* topLayout->addWidget( lineedit );
*
* topLayout->addStretch(10);
* }
* </pre>
*
* If you use @ref makeVBoxMainWidget , then the dialog above can be made
* simpler but you loose the ability to add a stretchable area.
*
* <pre>
* UrlDlg::UrlDlg( QWidget *parent, const QString& caption,
* const QString& urltext)
* : KDialogBase( parent, "urldialog", true, caption, Ok|Cancel, Ok, true )
* {
* QVBox *page = makeVBoxMainWidget();
* QLabel *label = new QLabel( caption, page, "caption" );
*
* lineedit = new QLineEdit( urltext, page, "lineedit" );
* lineedit->setMinimumWidth(fontMetrics().maxWidth()*20);
* }
* </pre>
*
* @short A dialog base class which standard buttons and predefined layouts.
* @author Mirko Sucker (mirko@kde.org) and Espen Sand (espen@kde.org)
*/
kdelibs'KDialogBaseTile::KDialogBaseTile() (./kdelibs/kdeui/kdialogbase.cpp:1191)
KDialogBaseTile::KDialogBaseTile( QObject *parent, const char *name )
: QObject( parent, name )
{
mPixmap = 0;
}
kdelibs'KDialogBaseTile::~KDialogBaseTile() (./kdelibs/kdeui/kdialogbase.cpp:1198)
KDialogBaseTile::~KDialogBaseTile()
{
cleanup();
}
kdelibs'KDialogBaseTile::set() (./kdelibs/kdeui/kdialogbase.cpp:1204)
void KDialogBaseTile::set( const QPixmap *pix )
{
if( pix == 0 )
{
cleanup();
}
else
{
if( mPixmap == 0 )
{
mPixmap = new QPixmap(*pix);
}
else
{
*mPixmap = *pix;
}
}
emit pixmapChanged();
}
kdelibs'KDialogBaseTile::get() (./kdelibs/kdeui/kdialogbase.cpp:1226)
const QPixmap *KDialogBaseTile::get() const
{
return( mPixmap );
}
kdelibs'KDialogBaseTile::cleanup() (./kdelibs/kdeui/kdialogbase.cpp:1232)
void KDialogBaseTile::cleanup()
{
delete mPixmap; mPixmap = 0;
}