Development/Tutorials/Sonnet/SonnetTutorial: Difference between revisions
< Development | Tutorials
No edit summary |
Shaforostoff (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
TODO | |||
==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 ), | |||
0 ); | |||
//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 [http://api.kde.org/4.0-api/kdelibs-apidocs/kdeui/html/classSonnet_1_1Dialog.html Sonnet::Dialog API] and [http://api.kde.org/4.0-api/kdelibs-apidocs/kdecore/html/namespaceSonnet.html Sonnet namespace page] | |||
==On-the-fly (inline) spellcheck== | |||
stub |
Revision as of 15:48, 6 July 2007
TODO
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 ), 0 ); //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
On-the-fly (inline) spellcheck
stub