KontactInterface

summary.h
1/*
2 This file is part of the KDE Kontact Plugin Interface Library.
3
4 SPDX-FileCopyrightText: 2003 Cornelius Schumacher <schumacher@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8#pragma once
9
10#include "kontactinterface_export.h"
11
12#include <QWidget>
13
14class QMouseEvent;
15class QDragEnterEvent;
16class QDropEvent;
17
18namespace KontactInterface
19{
20/**
21 * @short Base class for summary widgets in Kontact.
22 *
23 * This class should be used as base class when creating new
24 * summary widgets for the Summary View plugin in Kontact.
25 */
26class KONTACTINTERFACE_EXPORT Summary : public QWidget
27{
28 Q_OBJECT
29
30public:
31 /**
32 * Creates a new summary widget.
33 *
34 * @param parent The parent widget.
35 */
36 explicit Summary(QWidget *parent);
37
38 /**
39 * Destroys the summary widget.
40 */
41 ~Summary() override;
42
43 /**
44 * Returns the logical height of summary widget.
45 *
46 * This is used to calculate how much vertical space relative
47 * to other summary widgets this widget will use in the summary view.
48 */
49 [[nodiscard]] virtual int summaryHeight() const;
50
51 /**
52 * Creates a heading for a typical summary view with an icon and a heading.
53 *
54 * @param parent The parent widget.
55 * @param icon The name of the icon.
56 * @param heading The text of the header.
57 */
58 [[nodiscard]] QWidget *createHeader(QWidget *parent, const QString &icon, const QString &heading);
59
60 /**
61 * Returns a list of names identifying configuration modules for this summary widget.
62 *
63 * @note The names have to be suitable for being passed to KCMultiDialog::addModule().
64 */
65 [[nodiscard]] virtual QStringList configModules() const;
66
67public Q_SLOTS:
68 /**
69 * This method is called whenever the configuration has been changed.
70 */
71 virtual void configChanged();
72
73 /**
74 * This method is called if the displayed information should be updated.
75 *
76 * @param force true if the update was requested by the user
77 */
78 virtual void updateSummary(bool force = false);
79
80Q_SIGNALS:
81 /**
82 * This signal can be emitted to signaling that an action is going on.
83 * The @p message will be shown in the status bar.
84 */
85 void message(const QString &message);
86
87 /**
88 * @internal
89 *
90 * This signal is emitted whenever a summary widget has been dropped on
91 * this summary widget.
92 */
93 void summaryWidgetDropped(QWidget *target, QObject *object, int alignment);
94
95protected:
96 void mousePressEvent(QMouseEvent *) override;
97 void mouseMoveEvent(QMouseEvent *) override;
98 void dragEnterEvent(QDragEnterEvent *) override;
99 void dropEvent(QDropEvent *) override;
100
101private:
102 //@cond PRIVATE
103 class SummaryPrivate;
104 std::unique_ptr<SummaryPrivate> const d;
105 //@endcond
106};
107
108}
Base class for summary widgets in Kontact.
Definition summary.h:27
void message(const QString &message)
This signal can be emitted to signaling that an action is going on.
~Summary() override
Destroys the summary widget.
void summaryWidgetDropped(QWidget *target, QObject *object, int alignment)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:21:21 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.