File indexing completed on 2024-04-21 14:55:54
0001 /* This file is part of the KDE libraries 0002 Copyright (C) 2005 David Faure <faure@kde.org> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License version 2 as published by the Free Software Foundation. 0007 0008 This library is distributed in the hope that it will be useful, 0009 but WITHOUT ANY WARRANTY; without even the implied warranty of 0010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0011 Library General Public License for more details. 0012 0013 You should have received a copy of the GNU Library General Public License 0014 along with this library; see the file COPYING.LIB. If not, write to 0015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0016 Boston, MA 02110-1301, USA. 0017 */ 0018 0019 #ifndef KHBOX_H 0020 #define KHBOX_H 0021 0022 #include <kdelibs4support_export.h> 0023 0024 #include <QFrame> 0025 0026 class QChildEvent; 0027 0028 /** 0029 * A container widget which arranges its children horizontally. 0030 * When using a KHBox you don't need to create a layout nor 0031 * to add the child widgets to it. 0032 * 0033 * Both margin and spacing are initialized to 0. Use QHBoxLayout 0034 * if you need standard layout margins. 0035 * 0036 * \image html khbox.png "KDE Horizontal Box containing three buttons" 0037 * 0038 * @see KVBox 0039 */ 0040 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KHBox : public QFrame 0041 { 0042 Q_OBJECT 0043 0044 public: 0045 /** 0046 * Creates a new hbox. 0047 */ 0048 KDELIBS4SUPPORT_DEPRECATED explicit KHBox(QWidget *parent = nullptr); 0049 0050 /** 0051 * Destructor. 0052 */ 0053 ~KHBox() override; 0054 0055 /** 0056 * Sets the @p margin of the hbox. 0057 */ 0058 void setMargin(int margin); 0059 0060 /** 0061 * Sets the spacing between the child widgets to @p space. 0062 * 0063 * To get the default layout spacing, set @p space to -1. 0064 */ 0065 void setSpacing(int space); 0066 0067 /** 0068 * Sets the stretch factor of @p widget to @p stretch. 0069 */ 0070 void setStretchFactor(QWidget *widget, int stretch); 0071 0072 /** 0073 * Calculate the recommended size for this hbox. 0074 */ 0075 QSize sizeHint() const override; 0076 0077 /** 0078 * Calculate the recommended minimum size for this hbox. 0079 */ 0080 QSize minimumSizeHint() const override; 0081 0082 protected: 0083 /* 0084 * @internal 0085 */ 0086 KHBox(bool vertical, QWidget *parent); 0087 0088 void childEvent(QChildEvent *ev) override; 0089 0090 private: 0091 class Private; 0092 friend class Private; 0093 Private *const d; 0094 0095 Q_DISABLE_COPY(KHBox) 0096 }; 0097 0098 #endif