Libkleo

adjustingscrollarea.h
1/* -*- mode: c++; c-basic-offset:4 -*-
2 ui/adjustingscrollarea.h
3
4 This file is part of Kleopatra, the KDE keymanager
5 SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
6 SPDX-FileCopyrightText: 2022 g10 Code GmbH
7 SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
8
9 SPDX-License-Identifier: GPL-2.0-or-later
10*/
11
12#pragma once
13
14#include <QScrollArea>
15
16namespace Kleo
17{
18
19/**
20 * This class improves a few aspects of QScrollArea for usage by us, in
21 * particular, for vertically scrollable widgets.
22 *
23 * If sizeAdjustPolicy is set to QAbstractScrollArea::AdjustToContents,
24 * then the scroll area will (try to) adjust its size to the widget to avoid
25 * scroll bars as much as possible.
26 */
28{
30
31public:
32 /**
33 * Creates a scroll area with a QWidget with QVBoxLayout that is flagged
34 * as resizable.
35 */
36 explicit AdjustingScrollArea(QWidget *parent = nullptr);
37 ~AdjustingScrollArea() override;
38
39 /**
40 * Reimplemented to add the minimum size hint of the widget.
41 */
42 QSize minimumSizeHint() const override;
43
44 /**
45 * Reimplemented to remove the caching of the size/size hint of the
46 * widget and to add the horizontal size hint of the vertical scroll bar
47 * unless it is explicitly turned off.
48 */
49 QSize sizeHint() const override;
50
51private:
52 void adjustSizeOfWindowBy(const QSize &extent);
53 bool eventFilter(QObject *obj, QEvent *ev) override;
54};
55
56}
This class improves a few aspects of QScrollArea for usage by us, in particular, for vertically scrol...
QSize sizeHint() const override
Reimplemented to remove the caching of the size/size hint of the widget and to add the horizontal siz...
AdjustingScrollArea(QWidget *parent=nullptr)
Creates a scroll area with a QWidget with QVBoxLayout that is flagged as resizable.
QSize minimumSizeHint() const override
Reimplemented to add the minimum size hint of the widget.
Q_OBJECTQ_OBJECT
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:12 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.