• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.8.5 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • kdeui
  • widgets
ktextedit.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef KTEXTEDIT_H
21 #define KTEXTEDIT_H
22 
23 #include <kdeui_export.h>
24 #include <sonnet/highlighter.h>
25 #include <QtGui/QTextEdit>
26 
41 class KTextEditSpellInterface
42 {
43  public:
44 
48  virtual bool isSpellCheckingEnabled() const = 0;
49 
54  virtual void setSpellCheckingEnabled(bool enable) = 0;
55 
62  virtual bool shouldBlockBeSpellChecked(const QString& block) const = 0;
63 
64  virtual ~KTextEditSpellInterface() {}
65 };
66 
86 class KDEUI_EXPORT KTextEdit : public QTextEdit //krazy:exclude=qclasses
87 {
88  Q_OBJECT
89  Q_PROPERTY( QString clickMessage READ clickMessage WRITE setClickMessage )
90  Q_PROPERTY( bool checkSpellingEnabled READ checkSpellingEnabled WRITE setCheckSpellingEnabled )
91  Q_PROPERTY( QString spellCheckingLanguage READ spellCheckingLanguage WRITE setSpellCheckingLanguage )
92 
93  public:
98  explicit KTextEdit( const QString& text, QWidget *parent = 0 );
99 
104  explicit KTextEdit( QWidget *parent = 0 );
105 
109  ~KTextEdit();
110 
114  virtual void setReadOnly( bool readOnly );
115 
130  void setCheckSpellingEnabled( bool check );
131 
143  bool checkSpellingEnabled() const;
144 
153  void highlightWord( int length, int pos );
154 
168  void setSpellCheckingConfigFileName(const QString &fileName);
169 
184  virtual void createHighlighter();
185 
194  Sonnet::Highlighter* highlighter() const;
195 
209  void setHighlighter(Sonnet::Highlighter *_highLighter);
210 
215  QMenu *mousePopupMenu();
216 
221  void enableFindReplace( bool enabled);
222 
231  void setSpellInterface( KTextEditSpellInterface *spellInterface );
232 
239  const QString& spellCheckingLanguage() const;
240 
247  void setClickMessage(const QString &msg);
248 
253  QString clickMessage() const;
254 
255  Q_SIGNALS:
261  void checkSpellingChanged( bool );
262 
267  void spellCheckStatus(const QString &);
268 
276  void languageChanged(const QString &language);
277 
291  void aboutToShowContextMenu(QMenu* menu);
292 
293  public Q_SLOTS:
294 
303  void setSpellCheckingLanguage(const QString &language);
304 
309  void checkSpelling();
310 
325  void showSpellConfigDialog(const QString &configFileName,
326  const QString &windowIcon = QString());
327 
332  void replace();
333 
334  protected Q_SLOTS:
338  void slotDoReplace();
339  void slotReplaceNext();
340  void slotDoFind();
341  void slotFind();
342  void slotFindNext();
343  void slotReplace();
347  void slotSpeakText();
348 
349  protected:
353  virtual bool event(QEvent*);
354 
358  virtual void paintEvent(QPaintEvent *);
359  virtual void focusOutEvent(QFocusEvent *);
360 
364  virtual void keyPressEvent( QKeyEvent* );
365 
370  virtual void focusInEvent( QFocusEvent* );
371 
376  virtual void wheelEvent( QWheelEvent* );
377 
382  virtual void deleteWordBack();
383 
388  virtual void deleteWordForward();
389 
394  virtual void contextMenuEvent( QContextMenuEvent* );
395 
396  // TODO: KDE5: get rid of these as soon as BIC changes are allowed, they
397  // should be folded back into the normal public version, which
398  // should be made virtual.
399  // These methods just provide a way for derived classes to call
400  // the base class version of the normal methods.
401 
407  void setCheckSpellingEnabledInternal(bool check);
408 
414  bool checkSpellingEnabledInternal() const;
415 
416  private:
417  class Private;
418  Private *const d;
419 
420  Q_PRIVATE_SLOT( d, void spellCheckerMisspelling( const QString&, int ) )
421  Q_PRIVATE_SLOT( d, void spellCheckerCorrected(const QString&, int,const QString&) )
422  Q_PRIVATE_SLOT( d, void spellCheckerCanceled())
423  Q_PRIVATE_SLOT( d, void spellCheckerAutoCorrect(const QString&,const QString&) )
424  Q_PRIVATE_SLOT( d, void spellCheckerFinished() )
425  Q_PRIVATE_SLOT( d, void undoableClear() )
426  Q_PRIVATE_SLOT( d, void toggleAutoSpellCheck() )
427  Q_PRIVATE_SLOT( d, void slotAllowTab() )
428  Q_PRIVATE_SLOT( d, void menuActivated( QAction* ) )
429  Q_PRIVATE_SLOT( d, void slotFindHighlight(const QString&, int, int))
430  Q_PRIVATE_SLOT( d, void slotReplaceText(const QString &, int, int, int))
431 };
432 
433 #endif // KTEXTEDIT_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Thu Feb 21 2013 11:06:56 by doxygen 1.8.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.8.5 API Reference

Skip menu "kdelibs-4.8.5 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal