Source Code (Use browser search to find items of interest.)

Class Index

kdelibs'KDialog (./kdelibs/kdeui/kdialog.h:47)

class KDialog : public QDialog
{
  Q_OBJECT

  public:

    /**
     * Constructor. 
     *
     * Takes the same arguments as @ref QDialog.
     */
    KDialog(QWidget *parent = 0, const char *name = 0, 
	    bool modal = false, WFlags f = 0);

    /**
     * Return the number of pixels you shall use between a 
     * dialog edge and the outermost widget(s) according to the KDE standard.
     **/
    static int marginHint();

    /**
     * Return the number of pixels you shall use between 
     * widgets inside a dialog according to the KDE standard.
     */
    static int spacingHint();

    /**
     * Resize every layout manager used in @p widget and its nested children.
     *
     * @param margin The new layout margin.
     * @param margin The new layout spacing.
     */
    static void resizeLayout( QWidget *widget, int margin, int spacing );

    /**
     * Reszie every layout associated with @p lay and its children. 
     *
     * @param margin The new layout margin
     * @param margin The new layout spacing
     */
    static void resizeLayout( QLayoutItem *lay, int margin, int spacing );

  public slots:
    /**
     * Make a KDE compliant caption.
     * 
     * @param caption Your caption. @bf Do @bf not include the application name
     * in this string. It will be added automatically according to the KDE
     * standard.
     */
    virtual void setCaption( const QString &caption );

    /**
     * Make a plain caption without any modifications.
     * 
     * @param caption Your caption. This is the string that will be 
     * displayed in the window title.
     */
    virtual void setPlainCaption( const QString &caption );


  protected:
    /**
     * @internal
     */
    virtual void keyPressEvent(QKeyEvent*);


   signals:
    /**
     * This signal is emitted when the margin size and/or spacing size 
     * have changed. Use @ref #marginHint and  @ref #spacingHint in your slot
     * to get the new values.
     */
    void layoutHintChanged();

  private:
    static int mMarginSize;
    static int mSpacingSize;

    class KDialogPrivate;
    KDialogPrivate *d;

};

kdelibs'KDialog::KDialog() (./kdelibs/kdeui/kdialog.cpp:32)

KDialog::KDialog(QWidget *parent, const char *name, bool modal, WFlags f)
  : QDialog(parent, name, modal, f)
{
  setFocusPolicy(QWidget::StrongFocus);
}





//
// Grab QDialogs keypresses if non-modal.
//

kdelibs'KDialog::keyPressEvent() (./kdelibs/kdeui/kdialog.cpp:45)

void KDialog::keyPressEvent(QKeyEvent *e)
{
  if ( e->state() == 0 )
  {
    switch ( e->key() )
    {
      case Key_Escape:
      case Key_Enter:
      case Key_Return:
      {
        if(testWFlags(WType_Modal))
	{
          QDialog::keyPressEvent(e);
	}
        else
        {
   	  e->ignore();
        }
      }
      break;
      default:
	e->ignore();
	return;
    }
  }
  else
  {
    e->ignore();
  }
}




kdelibs'KDialog::marginHint() (./kdelibs/kdeui/kdialog.cpp:78)

int KDialog::marginHint()
{
  return( mMarginSize );
}



kdelibs'KDialog::spacingHint() (./kdelibs/kdeui/kdialog.cpp:84)

int KDialog::spacingHint()
{
  return( mSpacingSize );
}



kdelibs'KDialog::setCaption() (./kdelibs/kdeui/kdialog.cpp:90)

void KDialog::setCaption( const QString &caption )
{
  QDialog::setCaption( kapp->makeStdCaption( caption ) );
}



kdelibs'KDialog::setPlainCaption() (./kdelibs/kdeui/kdialog.cpp:96)

void KDialog::setPlainCaption( const QString &caption )
{
  QDialog::setCaption( caption );
}



kdelibs'KDialog::resizeLayout() (./kdelibs/kdeui/kdialog.cpp:102)

void KDialog::resizeLayout( QWidget *w, int margin, int spacing )
{
  if( w->layout() )
  {
    resizeLayout( w->layout(), margin, spacing );
  }

  if( w->children() )
  {
    QObjectList *l = (QObjectList*)w->children(); // silence please
    for( uint i=0; i < l->count(); i++ )
    {
      QObject *o = l->at(i);
      if( o->isWidgetType() )
      {
	resizeLayout( (QWidget*)o, margin, spacing );
      }
    }
  }
}



kdelibs'KDialog::resizeLayout() (./kdelibs/kdeui/kdialog.cpp:124)

void KDialog::resizeLayout( QLayoutItem *lay, int margin, int spacing )
{
  QLayoutIterator it = lay->iterator();
  QLayoutItem *child;
  while ( (child = it.current() ) ) 
  {
    resizeLayout( child, margin, spacing );
    ++it;
  }
  if( lay->layout() != 0 )
  {
    lay->layout()->setMargin( margin );
    lay->layout()->setSpacing( spacing );
  }
}