Sonnet

dictionarycombobox.h
1 /*
2  * SPDX-FileCopyrightText: 2003 Ingo Kloecker <[email protected]>
3  * SPDX-FileCopyrightText: 2008 Tom Albers <[email protected]>
4  *
5  * SPDX-License-Identifier: LGPL-2.1-or-later
6  */
7 
8 #ifndef SONNET_DICTIONARYCOMBOBOX_H
9 #define SONNET_DICTIONARYCOMBOBOX_H
10 
11 #include "sonnetui_export.h"
12 
13 #include <QComboBox>
14 
15 namespace Sonnet
16 {
17 class DictionaryComboBoxPrivate;
18 /**
19  * @class Sonnet::DictionaryComboBox dictionarycombobox.h <Sonnet/DictionaryComboBox>
20  *
21  * @short A combo box for selecting the dictionary used for spell checking.
22  * @author Ingo Kloecker <[email protected]>
23  * @author Tom Albers <[email protected]>
24  * @since 4.2
25  **/
26 
27 class SONNETUI_EXPORT DictionaryComboBox : public QComboBox
28 {
29  Q_OBJECT
30 public:
31  /**
32  * Constructor
33  */
34  explicit DictionaryComboBox(QWidget *parent = nullptr);
35 
36  /**
37  * Destructor
38  */
39  ~DictionaryComboBox() override;
40 
41  /**
42  * Clears the widget and reloads the dictionaries from Sonnet.
43  * Remember to set the dictionary you want selected after calling this function.
44  */
45  void reloadCombo();
46 
47  /**
48  * Returns the current dictionary name, for example "German (Switzerland)"
49  */
50  QString currentDictionaryName() const;
51 
52  /**
53  * Returns the current dictionary, for example "de_CH"
54  */
55  QString currentDictionary() const;
56 
57  /**
58  * Sets the current dictionaryName to the given dictionaryName
59  */
60  void setCurrentByDictionaryName(const QString &dictionaryName);
61 
62  /**
63  * Sets the current dictionary to the given dictionary
64  * Return true if dictionary was found.
65  * @since 5.40
66  * TODO merge with previous method in kf6
67  */
68  bool assignByDictionnary(const QString &dictionary);
69 
70  /**
71  * Sets the current dictionaryName to the given dictionaryName
72  * Return true if dictionary was found.
73  * @since 5.40
74  * TODO merge with previous method in kf6
75  */
76  bool assignDictionnaryName(const QString &name);
77 
78  /**
79  * Sets the current dictionary to the given dictionary.
80  */
81  void setCurrentByDictionary(const QString &dictionary);
82 
83 Q_SIGNALS:
84  /**
85  * @em Emitted whenever the current dictionary changes. Either
86  * by user intervention or on setCurrentByDictionaryName() or on
87  * setCurrentByDictionary(). For example "de_CH".
88  */
89  void dictionaryChanged(const QString &dictionary);
90 
91  /**
92  * @em Emitted whenever the current dictionary changes. Either
93  * by user intervention or on setCurrentByDictionaryName() or on
94  * setCurrentByDictionary(). For example "German (Switzerland)".
95  */
96  void dictionaryNameChanged(const QString &dictionaryName);
97 
98 private:
99  DictionaryComboBoxPrivate *const d;
100  Q_PRIVATE_SLOT(d, void slotDictionaryChanged(int))
101 };
102 }
103 
104 #endif
A combo box for selecting the dictionary used for spell checking.
The sonnet namespace.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Sep 25 2022 04:14:52 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.