KDE TechBase
  • Page
  • Discussion
  • Edit
  • History
KDE TechBase is a Wiki - You can help! Please contribute! Questions?
Please ask development related questions in the KDE Community Forum.

Development/Tutorials/Sonnet/SonnetTutorial

< Development | Tutorials

TODO

[edit] Spellcheck action

yourkmainwindowrderivative.h:

#include <sonnet/dialog.h>
 
...
 
private slots:
...
void spellcheck();
//void spellcheckDone();
//void spellcheckShow(const QString&,int);
//void spellcheckReplace(const QString&,int,const QString&);
//void spellcheckStop();
//void spellcheckCancel();
...
private:
Sonnet::Dialog* m_sonnetDialog;

yourkmainwindowrderivative.cpp:

YourKMainWindowrDerivative::YourKMainWindowrDerivative(...)
: KMainWindow(...)
...
, m_sonnetDialog(0)
 
...
 
void YourKMainWindowrDerivative::setupActions()
{
...
KStandardAction::spelling(this,SLOT(spellcheck()),actionCollection());
...
}
 
...
 
void KAider::spellcheck()
{
if (!m_sonnetDialog)
{
m_sonnetDialog=new Sonnet::Dialog(
new Sonnet::BackgroundChecker( this ),
this );
//connect signals to slots:
connect(m_sonnetDialog,SIGNAL(misspelling(const QString&,int)),
this,SLOT(spellcheckShow(const QString&,int)));
//and so on:
...
}
 
if (!m_view->selection().isEmpty())
m_sonnetDialog->setBuffer( m_view->selection() );
else
m_sonnetDialog->setBuffer( m_view->toPlaintText());
 
m_sonnetDialog->show();
}
 
//other slots implemetation
...

see Sonnet::Dialog API and Sonnet namespace page

[edit] On-the-fly (inline) spellcheck

stub

Retrieved from "http://techbase.kde.org/Development/Tutorials/Sonnet/SonnetTutorial"

Navigation

  • Home
  • Help
  • Recent changes

Sections

  • Getting started
  • Development
  • Schedules
  • Policies
  • Contribute
  • Projects

Toolbox

  • What links here
  • Related changes
  • Special pages
  • Printable version
  • Permanent link

Personal tools

  • 38.107.191.97
  • Talk for this IP
  • Log in / create account
  • Login with OpenID
Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal