File indexing completed on 2024-04-28 16:26:34

0001 /**************************************************************************************
0002     Copyright (C) 2016-2019 by Michel Ludwig (michel.ludwig@kdemail.net)
0003  **************************************************************************************/
0004 
0005 /***************************************************************************
0006  *                                                                         *
0007  *   This program is free software; you can redistribute it and/or modify  *
0008  *   it under the terms of the GNU General Public License as published by  *
0009  *   the Free Software Foundation; either version 2 of the License, or     *
0010  *   (at your option) any later version.                                   *
0011  *                                                                         *
0012  ***************************************************************************/
0013 
0014 #ifndef SCROLLWIDGET_H
0015 #define SCROLLWIDGET_H
0016 
0017 #include <QScrollArea>
0018 #include <QSize>
0019 
0020 namespace KileWidget {
0021 
0022 class ScrollWidget : public QScrollArea
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     explicit ScrollWidget(QWidget *parent = Q_NULLPTR);
0028     virtual ~ScrollWidget();
0029 
0030     /**
0031      * Returns the preferred size if it has been set, otherwise the widget's size hint
0032      **/
0033     virtual QSize sizeHint() const override;
0034 
0035     /**
0036      * Set the preferred size of this widget, which will be returned by 'sizeHint'
0037      **/
0038     QSize getPreferredSize() const;
0039     void setPreferredSize(const QSize& size);
0040 
0041 protected:
0042     QSize m_preferredSize;
0043 };
0044 
0045 }
0046 
0047 #endif