Changeset View
Changeset View
Standalone View
Standalone View
ui/formwidgets.h
Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Line(s) | 162 | protected: | |||
---|---|---|---|---|---|
165 | FormWidgetsController * m_controller; | 165 | FormWidgetsController * m_controller; | ||
166 | Okular::FormField * m_ff; | 166 | Okular::FormField * m_ff; | ||
167 | 167 | | |||
168 | private: | 168 | private: | ||
169 | QWidget * m_widget; | 169 | QWidget * m_widget; | ||
170 | PageViewItem * m_pageItem; | 170 | PageViewItem * m_pageItem; | ||
171 | }; | 171 | }; | ||
172 | 172 | | |||
173 | #define DECLARE_ADDITIONAL_ACTIONS \ | ||||
174 | protected: \ | ||||
175 | virtual void mousePressEvent( QMouseEvent *event ) override; \ | ||||
176 | virtual void mouseReleaseEvent( QMouseEvent *event ) override; \ | ||||
177 | virtual void focusInEvent( QFocusEvent *event ) override; \ | ||||
178 | virtual void focusOutEvent( QFocusEvent *event ) override; \ | ||||
179 | virtual void leaveEvent( QEvent *event ) override; \ | ||||
180 | virtual void enterEvent( QEvent *event ) override; | ||||
173 | 181 | | |||
174 | class PushButtonEdit : public QPushButton, public FormWidgetIface | 182 | class PushButtonEdit : public QPushButton, public FormWidgetIface | ||
175 | { | 183 | { | ||
176 | Q_OBJECT | 184 | Q_OBJECT | ||
177 | 185 | | |||
178 | public: | 186 | public: | ||
179 | explicit PushButtonEdit( Okular::FormFieldButton * button, QWidget * parent = nullptr ); | 187 | explicit PushButtonEdit( Okular::FormFieldButton * button, QWidget * parent = nullptr ); | ||
180 | 188 | | |||
181 | private Q_SLOTS: | 189 | DECLARE_ADDITIONAL_ACTIONS | ||
182 | void slotClicked(); | | |||
183 | }; | 190 | }; | ||
184 | 191 | | |||
185 | class CheckBoxEdit : public QCheckBox, public FormWidgetIface | 192 | class CheckBoxEdit : public QCheckBox, public FormWidgetIface | ||
186 | { | 193 | { | ||
187 | Q_OBJECT | 194 | Q_OBJECT | ||
188 | 195 | | |||
189 | public: | 196 | public: | ||
190 | explicit CheckBoxEdit( Okular::FormFieldButton * button, QWidget * parent = nullptr ); | 197 | explicit CheckBoxEdit( Okular::FormFieldButton * button, QWidget * parent = nullptr ); | ||
191 | 198 | | |||
192 | // reimplemented from FormWidgetIface | 199 | // reimplemented from FormWidgetIface | ||
193 | void setFormWidgetsController( FormWidgetsController *controller ) override; | 200 | void setFormWidgetsController( FormWidgetsController *controller ) override; | ||
194 | 201 | | |||
195 | void doActivateAction(); | 202 | void doActivateAction(); | ||
196 | 203 | | |||
197 | protected: | 204 | protected: | ||
198 | void slotRefresh( Okular::FormField *form ) override; | 205 | void slotRefresh( Okular::FormField *form ) override; | ||
206 | DECLARE_ADDITIONAL_ACTIONS | ||||
199 | }; | 207 | }; | ||
200 | 208 | | |||
201 | class RadioButtonEdit : public QRadioButton, public FormWidgetIface | 209 | class RadioButtonEdit : public QRadioButton, public FormWidgetIface | ||
202 | { | 210 | { | ||
203 | Q_OBJECT | 211 | Q_OBJECT | ||
204 | 212 | | |||
205 | public: | 213 | public: | ||
206 | explicit RadioButtonEdit( Okular::FormFieldButton * button, QWidget * parent = nullptr ); | 214 | explicit RadioButtonEdit( Okular::FormFieldButton * button, QWidget * parent = nullptr ); | ||
207 | 215 | | |||
208 | // reimplemented from FormWidgetIface | 216 | // reimplemented from FormWidgetIface | ||
209 | void setFormWidgetsController( FormWidgetsController *controller ) override; | 217 | void setFormWidgetsController( FormWidgetsController *controller ) override; | ||
218 | DECLARE_ADDITIONAL_ACTIONS | ||||
210 | }; | 219 | }; | ||
211 | 220 | | |||
212 | class FormLineEdit : public QLineEdit, public FormWidgetIface | 221 | class FormLineEdit : public QLineEdit, public FormWidgetIface | ||
213 | { | 222 | { | ||
214 | Q_OBJECT | 223 | Q_OBJECT | ||
215 | 224 | | |||
216 | public: | 225 | public: | ||
217 | explicit FormLineEdit( Okular::FormFieldText * text, QWidget * parent = nullptr ); | 226 | explicit FormLineEdit( Okular::FormFieldText * text, QWidget * parent = nullptr ); | ||
Show All 12 Lines | 238 | private Q_SLOTS: | |||
230 | void slotChanged(); | 239 | void slotChanged(); | ||
231 | 240 | | |||
232 | protected: | 241 | protected: | ||
233 | void slotRefresh( Okular::FormField* form ) override; | 242 | void slotRefresh( Okular::FormField* form ) override; | ||
234 | 243 | | |||
235 | private: | 244 | private: | ||
236 | int m_prevCursorPos; | 245 | int m_prevCursorPos; | ||
237 | int m_prevAnchorPos; | 246 | int m_prevAnchorPos; | ||
247 | DECLARE_ADDITIONAL_ACTIONS | ||||
238 | }; | 248 | }; | ||
239 | 249 | | |||
240 | class TextAreaEdit : public KTextEdit, public FormWidgetIface | 250 | class TextAreaEdit : public KTextEdit, public FormWidgetIface | ||
241 | { | 251 | { | ||
242 | Q_OBJECT | 252 | Q_OBJECT | ||
243 | 253 | | |||
244 | public: | 254 | public: | ||
245 | explicit TextAreaEdit( Okular::FormFieldText * text, QWidget * parent = nullptr ); | 255 | explicit TextAreaEdit( Okular::FormFieldText * text, QWidget * parent = nullptr ); | ||
Show All 13 Lines | 268 | private Q_SLOTS: | |||
259 | void slotChanged(); | 269 | void slotChanged(); | ||
260 | 270 | | |||
261 | protected: | 271 | protected: | ||
262 | void slotRefresh( Okular::FormField* form ) override; | 272 | void slotRefresh( Okular::FormField* form ) override; | ||
263 | 273 | | |||
264 | private: | 274 | private: | ||
265 | int m_prevCursorPos; | 275 | int m_prevCursorPos; | ||
266 | int m_prevAnchorPos; | 276 | int m_prevAnchorPos; | ||
277 | DECLARE_ADDITIONAL_ACTIONS | ||||
267 | }; | 278 | }; | ||
268 | 279 | | |||
269 | 280 | | |||
270 | class FileEdit : public KUrlRequester, public FormWidgetIface | 281 | class FileEdit : public KUrlRequester, public FormWidgetIface | ||
271 | { | 282 | { | ||
272 | Q_OBJECT | 283 | Q_OBJECT | ||
273 | 284 | | |||
274 | public: | 285 | public: | ||
Show All 9 Lines | 293 | private Q_SLOTS: | |||
284 | void slotHandleFileChangedByUndoRedo( int pageNumber, | 295 | void slotHandleFileChangedByUndoRedo( int pageNumber, | ||
285 | Okular::FormFieldText * form, | 296 | Okular::FormFieldText * form, | ||
286 | const QString & contents, | 297 | const QString & contents, | ||
287 | int cursorPos, | 298 | int cursorPos, | ||
288 | int anchorPos ); | 299 | int anchorPos ); | ||
289 | private: | 300 | private: | ||
290 | int m_prevCursorPos; | 301 | int m_prevCursorPos; | ||
291 | int m_prevAnchorPos; | 302 | int m_prevAnchorPos; | ||
303 | DECLARE_ADDITIONAL_ACTIONS | ||||
292 | }; | 304 | }; | ||
293 | 305 | | |||
294 | 306 | | |||
295 | class ListEdit : public QListWidget, public FormWidgetIface | 307 | class ListEdit : public QListWidget, public FormWidgetIface | ||
296 | { | 308 | { | ||
297 | Q_OBJECT | 309 | Q_OBJECT | ||
298 | 310 | | |||
299 | public: | 311 | public: | ||
300 | explicit ListEdit( Okular::FormFieldChoice * choice, QWidget * parent = nullptr ); | 312 | explicit ListEdit( Okular::FormFieldChoice * choice, QWidget * parent = nullptr ); | ||
301 | void setFormWidgetsController( FormWidgetsController *controller ) override; | 313 | void setFormWidgetsController( FormWidgetsController *controller ) override; | ||
302 | 314 | | |||
303 | private Q_SLOTS: | 315 | private Q_SLOTS: | ||
304 | void slotSelectionChanged(); | 316 | void slotSelectionChanged(); | ||
305 | void slotHandleFormListChangedByUndoRedo( int pageNumber, | 317 | void slotHandleFormListChangedByUndoRedo( int pageNumber, | ||
306 | Okular::FormFieldChoice * listForm, | 318 | Okular::FormFieldChoice * listForm, | ||
307 | const QList< int > & choices ); | 319 | const QList< int > & choices ); | ||
320 | DECLARE_ADDITIONAL_ACTIONS | ||||
308 | }; | 321 | }; | ||
309 | 322 | | |||
310 | 323 | | |||
311 | class ComboEdit : public QComboBox, public FormWidgetIface | 324 | class ComboEdit : public QComboBox, public FormWidgetIface | ||
312 | { | 325 | { | ||
313 | Q_OBJECT | 326 | Q_OBJECT | ||
314 | 327 | | |||
315 | public: | 328 | public: | ||
Show All 9 Lines | 336 | void slotHandleFormComboChangedByUndoRedo( int pageNumber, | |||
325 | const QString & text, | 338 | const QString & text, | ||
326 | int cursorPos, | 339 | int cursorPos, | ||
327 | int anchorPos | 340 | int anchorPos | ||
328 | ); | 341 | ); | ||
329 | 342 | | |||
330 | private: | 343 | private: | ||
331 | int m_prevCursorPos; | 344 | int m_prevCursorPos; | ||
332 | int m_prevAnchorPos; | 345 | int m_prevAnchorPos; | ||
346 | DECLARE_ADDITIONAL_ACTIONS | ||||
333 | }; | 347 | }; | ||
334 | 348 | | |||
349 | #undef DECLARE_ADDITIONAL_ACTIONS | ||||
350 | | ||||
335 | #endif | 351 | #endif |