KDEGames

kgthemeselector.h
1 /*
2  SPDX-FileCopyrightText: 2012 Stefan Majewsky <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-only
5 */
6 
7 #ifndef KGTHEMESELECTOR_H
8 #define KGTHEMESELECTOR_H
9 
10 // own
11 #include "kgthemeprovider.h"
12 #include <libkdegames_export.h>
13 // Qt
14 #include <QWidget>
15 // Std
16 #include <memory>
17 
18 /**
19  * @class KgThemeSelector kgthemeselector.h <KgThemeSelector>
20  * @brief Theme selection widget.
21  *
22  * This widget allows the user to change the theme selection of a
23  * KgThemeProvider. Selections are immediately applied to allow the user
24  * to quickly preview themes. In simple cases, the widget can be used
25  * standalone with the showAsDialog() method.
26  *
27  * @code
28  * K_GLOBAL_STATIC_WITH_ARGS(KgThemeSelector, selector, (provider))
29  * ...
30  * selector->showAsDialog();
31  * @endcode
32  */
33 class KDEGAMES_EXPORT KgThemeSelector : public QWidget
34 {
35  Q_OBJECT
37  public:
38  ///Flags which control the behavior of KgThemeSelector.
39  enum Option {
40  DefaultBehavior = 0,
41  ///Enable downloading of additional themes with KNewStuff3.
42  ///This requires a KNS3 config file to be installed for this app.
43  EnableNewStuffDownload = 1 << 0
44  };
45  Q_DECLARE_FLAGS(Options, Option)
46 
47  explicit KgThemeSelector(KgThemeProvider* provider, Options options = DefaultBehavior, QWidget* parent = nullptr);
48  ~KgThemeSelector() override;
49  public Q_SLOTS:
50  ///Create and show a non-modal dialog which displays this selector.
51  ///The dialog will be automatically cleaned up when it's closed, but it
52  ///is ensured that the selector is not deleted.
53  ///
54  ///This method does nothing if the selector widget is already visible.
55  void showAsDialog(const QString& caption = QString());
56  private:
57  class Dialog;
58  std::unique_ptr<class KgThemeSelectorPrivate> const d;
59 };
60 
61 Q_DECLARE_OPERATORS_FOR_FLAGS(KgThemeSelector::Options)
62 
63 #endif // KGTHEMESELECTOR_H
A theme provider manages KgTheme instances, and maintains a selection of the currentTheme().
Theme selection widget.
Q_DISABLE_COPY(Class)
Option
Flags which control the behavior of KgThemeSelector.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Dec 7 2021 22:34:15 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.