kdeui: format and indent khbox source and header files

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-12-09 04:53:13 +02:00
parent e7ae8c8351
commit 593dd8b8d3
3 changed files with 57 additions and 61 deletions

View file

@ -23,13 +23,12 @@
#include <kdeui_export.h>
#include <QtGui/QWidget>
#include <QDate>
#include "klocale.h"
class KCalendarSystem;
#include <QDate>
/**
* @short A date selection widget.
*

View file

@ -23,91 +23,88 @@
#include <QtGui/QHBoxLayout>
#include <QtGui/QVBoxLayout>
KHBox::KHBox( QWidget* parent )
: QFrame( parent ),
KHBox::KHBox(QWidget* parent)
: QFrame(parent),
d( 0 )
{
QHBoxLayout* layout = new QHBoxLayout( this );
layout->setSpacing( 0 );
layout->setMargin( 0 );
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
setLayout( layout );
setLayout(layout);
}
KHBox::KHBox( bool /*vertical*/, QWidget* parent )
: QFrame( parent ),
KHBox::KHBox(bool /*vertical*/, QWidget* parent)
: QFrame(parent),
d( 0 )
{
QVBoxLayout* layout = new QVBoxLayout( this );
layout->setSpacing( 0 );
layout->setMargin( 0 );
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
setLayout( layout );
setLayout(layout);
}
KHBox::~KHBox()
{
}
void KHBox::childEvent( QChildEvent* event )
void KHBox::childEvent(QChildEvent* event)
{
switch ( event->type() ) {
case QEvent::ChildAdded:
{
QChildEvent* childEvent = static_cast<QChildEvent *>( event );
if ( childEvent->child()->isWidgetType() ) {
QWidget* widget = static_cast<QWidget *>( childEvent->child() );
static_cast<QBoxLayout *>( layout() )->addWidget( widget );
}
break;
switch (event->type()) {
case QEvent::ChildAdded: {
QChildEvent* childEvent = static_cast<QChildEvent*>(event);
if (childEvent->child()->isWidgetType()) {
QWidget* widget = static_cast<QWidget*>(childEvent->child());
static_cast<QBoxLayout*>(layout())->addWidget(widget);
}
break;
}
case QEvent::ChildRemoved: {
QChildEvent* childEvent = static_cast<QChildEvent*>(event);
if (childEvent->child()->isWidgetType()) {
QWidget* widget = static_cast<QWidget *>(childEvent->child());
static_cast<QBoxLayout*>(layout())->removeWidget(widget);
}
break;
}
default: {
break;
}
}
case QEvent::ChildRemoved:
{
QChildEvent* childEvent = static_cast<QChildEvent *>( event );
if ( childEvent->child()->isWidgetType() ) {
QWidget* widget = static_cast<QWidget *>( childEvent->child() );
static_cast<QBoxLayout *>( layout() )->removeWidget( widget );
}
break;
}
default:
break;
}
QFrame::childEvent(event);
QFrame::childEvent(event);
}
QSize KHBox::sizeHint() const
{
KHBox* that = const_cast<KHBox *>( this );
QApplication::sendPostedEvents( that, QEvent::ChildAdded );
KHBox* that = const_cast<KHBox*>(this);
QApplication::sendPostedEvents(that, QEvent::ChildAdded);
return QFrame::sizeHint();
return QFrame::sizeHint();
}
QSize KHBox::minimumSizeHint() const
{
KHBox* that = const_cast<KHBox *>( this );
QApplication::sendPostedEvents( that, QEvent::ChildAdded );
KHBox* that = const_cast<KHBox *>( this );
QApplication::sendPostedEvents(that, QEvent::ChildAdded);
return QFrame::minimumSizeHint();
return QFrame::minimumSizeHint();
}
void KHBox::setSpacing( int spacing )
void KHBox::setSpacing(int spacing)
{
layout()->setSpacing( spacing );
layout()->setSpacing(spacing);
}
void KHBox::setStretchFactor( QWidget* widget, int stretch )
void KHBox::setStretchFactor(QWidget* widget, int stretch)
{
static_cast<QBoxLayout *>( layout() )->setStretchFactor( widget, stretch );
static_cast<QBoxLayout *>(layout())->setStretchFactor(widget, stretch);
}
void KHBox::setMargin( int margin )
void KHBox::setMargin(int margin)
{
layout()->setMargin( margin );
layout()->setMargin(margin);
}
#include "moc_khbox.cpp"

View file

@ -39,9 +39,9 @@
*/
class KDEUI_EXPORT KHBox : public QFrame
{
Q_OBJECT
Q_OBJECT
public:
public:
/**
* Creates a new hbox.
*/
@ -55,19 +55,19 @@ class KDEUI_EXPORT KHBox : public QFrame
/**
* Sets the @p margin of the hbox.
*/
void setMargin( int margin );
void setMargin(int margin);
/**
* Sets the spacing between the child widgets to @p space.
*
* To get the default layout spacing, set @p space to -1.
*/
void setSpacing( int space );
void setSpacing(int space);
/**
* Sets the stretch factor of @p widget to @p stretch.
*/
void setStretchFactor( QWidget* widget, int stretch );
void setStretchFactor(QWidget* widget, int stretch);
/**
* Calculate the recommended size for this hbox.
@ -79,19 +79,19 @@ class KDEUI_EXPORT KHBox : public QFrame
*/
virtual QSize minimumSizeHint() const;
protected:
protected:
/*
* @internal
*/
KHBox( bool vertical, QWidget* parent );
KHBox(bool vertical, QWidget* parent);
virtual void childEvent( QChildEvent* ev );
virtual void childEvent(QChildEvent* ev);
private:
private:
class Private;
friend class Private;
Private* const d;
Q_DISABLE_COPY(KHBox)
};