Krita Source Code Documentation
Loading...
Searching...
No Matches
KDcrawIface::RHBox Class Reference

#include <rwidgetutils.h>

+ Inheritance diagram for KDcrawIface::RHBox:

Public Member Functions

QSize minimumSizeHint () const override
 
 RHBox (QWidget *const parent=0)
 
void setMargin (int margin)
 
void setSpacing (int space)
 
void setStretchFactor (QWidget *const widget, int stretch)
 
QSize sizeHint () const override
 
 ~RHBox () override
 

Protected Member Functions

void childEvent (QChildEvent *e) override
 
 RHBox (bool vertical, QWidget *const parent)
 

Detailed Description

An Horizontal widget to host children widgets

Definition at line 82 of file rwidgetutils.h.

Constructor & Destructor Documentation

◆ RHBox() [1/2]

KDcrawIface::RHBox::RHBox ( QWidget *const parent = 0)
explicit

Definition at line 117 of file rwidgetutils.cpp.

118 : QFrame(parent)
119{
120 QHBoxLayout* const layout = new QHBoxLayout(this);
121 layout->setSpacing(0);
122 layout->setContentsMargins(0, 0, 0, 0);
123}

◆ ~RHBox()

KDcrawIface::RHBox::~RHBox ( )
override

Definition at line 133 of file rwidgetutils.cpp.

134{
135}

◆ RHBox() [2/2]

KDcrawIface::RHBox::RHBox ( bool vertical,
QWidget *const parent )
protected

Definition at line 125 of file rwidgetutils.cpp.

126 : QFrame(parent)
127{
128 QVBoxLayout* const layout = new QVBoxLayout(this);
129 layout->setSpacing(0);
130 layout->setContentsMargins(0, 0, 0, 0);
131}

Member Function Documentation

◆ childEvent()

void KDcrawIface::RHBox::childEvent ( QChildEvent * e)
overrideprotected

Definition at line 137 of file rwidgetutils.cpp.

138{
139 switch (e->type())
140 {
141 case QEvent::ChildAdded:
142 {
143 QChildEvent* const ce = static_cast<QChildEvent*>(e);
144
145 if (ce->child()->isWidgetType())
146 {
147 QWidget* const w = static_cast<QWidget*>(ce->child());
148 static_cast<QBoxLayout*>(layout())->addWidget(w);
149 }
150
151 break;
152 }
153
154 case QEvent::ChildRemoved:
155 {
156 QChildEvent* const ce = static_cast<QChildEvent*>(e);
157
158 if (ce->child()->isWidgetType())
159 {
160 QWidget* const w = static_cast<QWidget*>(ce->child());
161 static_cast<QBoxLayout*>(layout())->removeWidget(w);
162 }
163
164 break;
165 }
166
167 default:
168 break;
169 }
170
171 QFrame::childEvent(e);
172}

◆ minimumSizeHint()

QSize KDcrawIface::RHBox::minimumSizeHint ( ) const
override

Definition at line 182 of file rwidgetutils.cpp.

183{
184 RHBox* const b = const_cast<RHBox*>(this);
185 QApplication::sendPostedEvents(b, QEvent::ChildAdded );
186
187 return QFrame::minimumSizeHint();
188}
RHBox(QWidget *const parent=0)

◆ setMargin()

void KDcrawIface::RHBox::setMargin ( int margin)

Definition at line 195 of file rwidgetutils.cpp.

196{
197 layout()->setContentsMargins(margin, margin, margin, margin);
198}

◆ setSpacing()

void KDcrawIface::RHBox::setSpacing ( int space)

Definition at line 190 of file rwidgetutils.cpp.

191{
192 layout()->setSpacing(spacing);
193}

◆ setStretchFactor()

void KDcrawIface::RHBox::setStretchFactor ( QWidget *const widget,
int stretch )

Definition at line 200 of file rwidgetutils.cpp.

201{
202 static_cast<QBoxLayout*>(layout())->setStretchFactor(widget, stretch);
203}
void setStretchFactor(QWidget *const widget, int stretch)

References setStretchFactor().

◆ sizeHint()

QSize KDcrawIface::RHBox::sizeHint ( ) const
override

Definition at line 174 of file rwidgetutils.cpp.

175{
176 RHBox* const b = const_cast<RHBox*>(this);
177 QApplication::sendPostedEvents(b, QEvent::ChildAdded);
178
179 return QFrame::sizeHint();
180}

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