File indexing completed on 2024-05-12 16:02:13

0001 /* This file is part of the KDE libraries
0002    SPDX-FileCopyrightText: 2005 David Faure <faure@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-only
0005 */
0006 
0007 #ifndef KoVBOX_H
0008 #define KoVBOX_H
0009 
0010 #include <kritawidgets_export.h>
0011 
0012 #include <QFrame>
0013 
0014 class QChildEvent;
0015 
0016 /**
0017  * A container widget which arranges its children vertically.
0018  * 
0019  * When using a KoVBox you don't need to create a layout nor
0020  * to add the child widgets to it.
0021  *
0022  * Both margin and spacing are initialized to 0. Use QHBoxLayout
0023  * if you need standard layout margins.
0024  *
0025  * @see KVBox
0026  */
0027 class KRITAWIDGETS_EXPORT KoVBox : public QFrame
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032     /**
0033      * Creates a new hbox.
0034      */
0035     explicit KoVBox(QWidget *parent = 0);
0036 
0037     /**
0038      * Destructor.
0039      */
0040     ~KoVBox() override;
0041 
0042     /**
0043      * Sets the @p margin of the hbox.
0044      */
0045     void setMargin(int margin);
0046 
0047     /**
0048      * Sets the spacing between the child widgets to @p space.
0049      *
0050      * To get the default layout spacing, set @p space to -1.
0051      */
0052     void setSpacing(int space);
0053 
0054     /**
0055      * Sets the stretch factor of @p widget to @p stretch.
0056      */
0057     void setStretchFactor(QWidget *widget, int stretch);
0058 
0059     /**
0060      * Calculate the recommended size for this hbox.
0061      */
0062     QSize sizeHint() const override;
0063 
0064     /**
0065      * Calculate the recommended minimum size for this hbox.
0066      */
0067     QSize minimumSizeHint() const override;
0068 
0069 protected:
0070 
0071     void childEvent(QChildEvent *ev) override;
0072 
0073 private:
0074     class Private;
0075     friend class Private;
0076     Private *const d;
0077 
0078     Q_DISABLE_COPY(KoVBox)
0079 };
0080 
0081 #endif