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

KDEUI

  • sources
  • kde-4.14
  • kdelibs
  • 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 
27 #define HAVE_SHOWTABACTION 1
28 #define HAVE_AUTOCORRECTFEATURE 1
29 #define HAVE_FORCESPELLCHECKING 1
30 #define HAVE_MOUSEPOPUPMENUIMPLEMENTATION 1
31 
45 class KTextEditSpellInterface
46 {
47  public:
48 
52  virtual bool isSpellCheckingEnabled() const = 0;
53 
58  virtual void setSpellCheckingEnabled(bool enable) = 0;
59 
66  virtual bool shouldBlockBeSpellChecked(const QString& block) const = 0;
67 
68  virtual ~KTextEditSpellInterface() {}
69 };
70 
90 class KDEUI_EXPORT KTextEdit : public QTextEdit //krazy:exclude=qclasses
91 {
92  Q_OBJECT
93  Q_PROPERTY( QString clickMessage READ clickMessage WRITE setClickMessage )
94  Q_PROPERTY( bool checkSpellingEnabled READ checkSpellingEnabled WRITE setCheckSpellingEnabled )
95  Q_PROPERTY( QString spellCheckingLanguage READ spellCheckingLanguage WRITE setSpellCheckingLanguage )
96 
97  public:
102  explicit KTextEdit( const QString& text, QWidget *parent = 0 );
103 
108  explicit KTextEdit( QWidget *parent = 0 );
109 
113  ~KTextEdit();
114 
118  virtual void setReadOnly( bool readOnly );
119 
134  void setCheckSpellingEnabled( bool check );
135 
147  bool checkSpellingEnabled() const;
148 
157  void highlightWord( int length, int pos );
158 
172  void setSpellCheckingConfigFileName(const QString &fileName);
173 
188  virtual void createHighlighter();
189 
198  Sonnet::Highlighter* highlighter() const;
199 
213  void setHighlighter(Sonnet::Highlighter *_highLighter);
214 
219  QMenu *mousePopupMenu();
220 
225  void enableFindReplace( bool enabled);
226 
235  void setSpellInterface( KTextEditSpellInterface *spellInterface );
236 
243  const QString& spellCheckingLanguage() const;
244 
251  void setClickMessage(const QString &msg);
252 
257  QString clickMessage() const;
258 
259 
263  void showTabAction(bool show);
264 
268  void showAutoCorrectButton(bool show);
269 
275  void forceSpellChecking();
276 
277  Q_SIGNALS:
283  void checkSpellingChanged( bool );
284 
289  void spellCheckStatus(const QString &);
290 
298  void languageChanged(const QString &language);
299 
313  void aboutToShowContextMenu(QMenu* menu);
314 
318  void spellCheckerAutoCorrect(const QString& currentWord, const QString& autoCorrectWord);
319 
324  void spellCheckingFinished();
325 
330  void spellCheckingCanceled();
331 
332  public Q_SLOTS:
333 
342  void setSpellCheckingLanguage(const QString &language);
343 
348  void checkSpelling();
349 
364  void showSpellConfigDialog(const QString &configFileName,
365  const QString &windowIcon = QString());
366 
371  void replace();
372 
373 
379  void mousePopupMenuImplementation(const QPoint& pos);
380 
381  protected Q_SLOTS:
385  void slotDoReplace();
386  void slotReplaceNext();
387  void slotDoFind();
388  void slotFind();
392  void slotFindPrevious();
393  void slotFindNext();
394  void slotReplace();
398  void slotSpeakText();
399 
400  protected:
404  virtual bool event(QEvent*);
405 
409  virtual void paintEvent(QPaintEvent *);
410  virtual void focusOutEvent(QFocusEvent *);
411 
415  virtual void keyPressEvent( QKeyEvent* );
416 
421  virtual void focusInEvent( QFocusEvent* );
422 
427  virtual void wheelEvent( QWheelEvent* );
428 
433  virtual void deleteWordBack();
434 
439  virtual void deleteWordForward();
440 
445  virtual void contextMenuEvent( QContextMenuEvent* );
446 
447  // TODO: KDE5: get rid of these as soon as BIC changes are allowed, they
448  // should be folded back into the normal public version, which
449  // should be made virtual.
450  // These methods just provide a way for derived classes to call
451  // the base class version of the normal methods.
452 
458  void setCheckSpellingEnabledInternal(bool check);
459 
465  bool checkSpellingEnabledInternal() const;
466 
467  private:
468  class Private;
469  Private *const d;
470 
471  Q_PRIVATE_SLOT( d, void spellCheckerMisspelling( const QString&, int ) )
472  Q_PRIVATE_SLOT( d, void spellCheckerCorrected(const QString&, int,const QString&) )
473  Q_PRIVATE_SLOT( d, void spellCheckerCanceled())
474  Q_PRIVATE_SLOT( d, void spellCheckerAutoCorrect(const QString&,const QString&) )
475  Q_PRIVATE_SLOT( d, void spellCheckerFinished() )
476  Q_PRIVATE_SLOT( d, void undoableClear() )
477  Q_PRIVATE_SLOT( d, void toggleAutoSpellCheck() )
478  Q_PRIVATE_SLOT( d, void slotAllowTab() )
479  Q_PRIVATE_SLOT( d, void menuActivated( QAction* ) )
480  Q_PRIVATE_SLOT( d, void slotFindHighlight(const QString&, int, int))
481  Q_PRIVATE_SLOT( d, void slotReplaceText(const QString &, int, int, int))
482 };
483 
484 #endif // KTEXTEDIT_H
QEvent
QWidget
KStandardShortcut::deleteWordForward
const KShortcut & deleteWordForward()
Delete a word forward from mouse/cursor position.
Definition: kstandardshortcut.cpp:339
KTextEditSpellInterface
This interface is a workaround to keep binary compatibility in KDE4, because adding the virtual keywo...
Definition: ktextedit.h:45
QWheelEvent
QPoint
KTextEditSpellInterface::shouldBlockBeSpellChecked
virtual bool shouldBlockBeSpellChecked(const QString &block) const =0
Returns true if the given paragraph or block should be spellcheck.
KTextEditSpellInterface::setSpellCheckingEnabled
virtual void setSpellCheckingEnabled(bool enable)=0
Sets whether to enable spellchecking for the KTextEdit.
QContextMenuEvent
highlighter.h
QString
KTextEditSpellInterface::isSpellCheckingEnabled
virtual bool isSpellCheckingEnabled() const =0
KTextEditSpellInterface::~KTextEditSpellInterface
virtual ~KTextEditSpellInterface()
Definition: ktextedit.h:68
QMenu
KStandardAction::replace
KAction * replace(const QObject *recvr, const char *slot, QObject *parent)
Find and replace matches.
Definition: kstandardaction.cpp:344
QKeyEvent
KStandardShortcut::deleteWordBack
const KShortcut & deleteWordBack()
Delete a word back from mouse/cursor position.
Definition: kstandardshortcut.cpp:338
QAction
kdeui_export.h
QPaintEvent
QTextEdit
QFocusEvent
KTextEdit
A KDE'ified QTextEdit.
Definition: ktextedit.h:90
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:00 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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

Search



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