Changeset View
Changeset View
Standalone View
Standalone View
src/editors/combobox.cpp
Show All 16 Lines | 1 | /* This file is part of the KDE project | |||
---|---|---|---|---|---|
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to | ||
18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | * Boston, MA 02110-1301, USA. | 19 | * Boston, MA 02110-1301, USA. | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #include "combobox.h" | 22 | #include "combobox.h" | ||
23 | #include "KPropertyEditorDataModel.h" | 23 | #include "KPropertyEditorDataModel.h" | ||
24 | #include "KPropertyEditorView.h" | 24 | #include "KPropertyEditorView.h" | ||
25 | #include "kproperty_debug.h" | 25 | #include "kpropertywidgets_debug.h" | ||
26 | #include "KPropertyWidgetsFactory.h" | ||||
26 | 27 | | |||
27 | #include <QCompleter> | 28 | #include <QCompleter> | ||
28 | #include <QGuiApplication> | 29 | #include <QGuiApplication> | ||
29 | 30 | | |||
30 | KPropertyComboBoxEditor::Options::Options() | 31 | KPropertyComboBoxEditor::Options::Options() | ||
31 | : iconProvider(0) | 32 | : iconProvider(0) | ||
32 | , extraValueAllowed(false) | 33 | , extraValueAllowed(false) | ||
33 | { | 34 | { | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | |||||
100 | 101 | | |||
101 | KPropertyComboBoxEditor::~KPropertyComboBoxEditor() | 102 | KPropertyComboBoxEditor::~KPropertyComboBoxEditor() | ||
102 | { | 103 | { | ||
103 | } | 104 | } | ||
104 | 105 | | |||
105 | bool KPropertyComboBoxEditor::listDataKeysAvailable() const | 106 | bool KPropertyComboBoxEditor::listDataKeysAvailable() const | ||
106 | { | 107 | { | ||
107 | if (m_listData.keys.isEmpty()) { | 108 | if (m_listData.keys.isEmpty()) { | ||
108 | kprWarning() << "property listData not available!"; | 109 | kprwWarning() << "property listData not available!"; | ||
staniek: For simplicity I propose to share the same area 'kpr' for both libs. In 99% of cases if we need… | |||||
109 | return false; | 110 | return false; | ||
110 | } | 111 | } | ||
111 | return true; | 112 | return true; | ||
112 | } | 113 | } | ||
113 | 114 | | |||
114 | QVariant KPropertyComboBoxEditor::value() const | 115 | QVariant KPropertyComboBoxEditor::value() const | ||
115 | { | 116 | { | ||
116 | if (!listDataKeysAvailable()) | 117 | if (!listDataKeysAvailable()) | ||
Show All 21 Lines | 138 | if (idx >= 0 && idx < count()) { | |||
138 | setCurrentIndex(idx); | 139 | setCurrentIndex(idx); | ||
139 | } | 140 | } | ||
140 | else { | 141 | else { | ||
141 | if (idx < 0) { | 142 | if (idx < 0) { | ||
142 | if (m_options.extraValueAllowed) { | 143 | if (m_options.extraValueAllowed) { | ||
143 | setCurrentIndex(-1); | 144 | setCurrentIndex(-1); | ||
144 | setEditText(value.toString()); | 145 | setEditText(value.toString()); | ||
145 | } | 146 | } | ||
146 | kprWarning() << "NO SUCH KEY:" << value.toString() | 147 | kprwWarning() << "NO SUCH KEY:" << value.toString() | ||
147 | << "property=" << objectName(); | 148 | << "property=" << objectName(); | ||
148 | } else { | 149 | } else { | ||
149 | QStringList list; | 150 | QStringList list; | ||
150 | for (int i = 0; i < count(); i++) | 151 | for (int i = 0; i < count(); i++) | ||
151 | list += itemText(i); | 152 | list += itemText(i); | ||
152 | kprWarning() << "NO SUCH INDEX WITHIN COMBOBOX:" << idx | 153 | kprwWarning() << "NO SUCH INDEX WITHIN COMBOBOX:" << idx | ||
153 | << "count=" << count() << "value=" << value.toString() | 154 | << "count=" << count() << "value=" << value.toString() | ||
154 | << "property=" << objectName() << "\nActual combobox contents" | 155 | << "property=" << objectName() << "\nActual combobox contents" | ||
155 | << list; | 156 | << list; | ||
156 | } | 157 | } | ||
157 | setItemText(currentIndex(), QString()); | 158 | setItemText(currentIndex(), QString()); | ||
158 | } | 159 | } | ||
159 | 160 | | |||
160 | if (value.isNull()) | 161 | if (value.isNull()) | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | |||||
213 | { | 214 | { | ||
214 | // emit valueChanged(this); | 215 | // emit valueChanged(this); | ||
215 | emit commitData( this ); | 216 | emit commitData( this ); | ||
216 | } | 217 | } | ||
217 | 218 | | |||
218 | void KPropertyComboBoxEditor::paintEvent( QPaintEvent * event ) | 219 | void KPropertyComboBoxEditor::paintEvent( QPaintEvent * event ) | ||
219 | { | 220 | { | ||
220 | QComboBox::paintEvent(event); | 221 | QComboBox::paintEvent(event); | ||
221 | KPropertyFactory::paintTopGridLine(this); | 222 | KPropertyWidgetsFactory::paintTopGridLine(this); | ||
222 | } | 223 | } | ||
223 | 224 | | |||
224 | /* | 225 | /* | ||
225 | void ComboBox::setReadOnlyInternal(bool readOnly) | 226 | void ComboBox::setReadOnlyInternal(bool readOnly) | ||
226 | { | 227 | { | ||
227 | setVisibleFlag(!readOnly); | 228 | setVisibleFlag(!readOnly); | ||
228 | }*/ | 229 | }*/ | ||
229 | 230 | | |||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |
For simplicity I propose to share the same area 'kpr' for both libs. In 99% of cases if we need debug we need it for the entire KProperty framework, right?