summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1d3537d)
When building against Qt5 and WITH_KDE enabled, the input widget
now is a KTextEdit again, making use of features like spell check.
Note that we'll add support for a stand-alone Sonnet framework to have
spell checking without KDE integration later on.
+ find_package(KF5TextWidgets QUIET)
+ set_package_properties(KF5TextWidgets PROPERTIES TYPE REQUIRED
+ URL "http://inqlude.org/libraries/ktextwidgets.html"
+ DESCRIPTION "framework providing an assortment of widgets for displaying and editing text"
+ PURPOSE "Allows to use extra features provided by KDE Frameworks in input widgets"
+ )
UiSettings s("InputWidget");
UiSettings s("InputWidget");
s.notify("EnableSpellCheck", this, SLOT(setEnableSpellCheck(QVariant)));
setEnableSpellCheck(s.value("EnableSpellCheck", false));
#endif
s.notify("EnableSpellCheck", this, SLOT(setEnableSpellCheck(QVariant)));
setEnableSpellCheck(s.value("EnableSpellCheck", false));
#endif
fmt.clearBackground();
inputLine()->setCurrentCharFormat(fmt);
fmt.clearBackground();
inputLine()->setCurrentCharFormat(fmt);
// Set highlighter back to active in case it was deactivated by too many errors.
if (ui.inputEdit->highlighter())
ui.inputEdit->highlighter()->setActive(true);
// Set highlighter back to active in case it was deactivated by too many errors.
if (ui.inputEdit->highlighter())
ui.inputEdit->highlighter()->setActive(true);
target_link_libraries(mod_uisupport ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY})
endif()
target_link_libraries(mod_uisupport ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY})
endif()
+if (WITH_KF5)
+ target_link_libraries(mod_uisupport KF5::TextWidgets)
+endif()
_emacsMode(false),
_lastDocumentHeight(-1)
{
_emacsMode(false),
_lastDocumentHeight(-1)
{
-#if QT_VERSION >= 0x040500
- document()->setDocumentMargin(0); // new in Qt 4.5 and we really don't want it here
-#endif
+ document()->setDocumentMargin(0);
setAcceptRichText(false);
setAcceptRichText(false);
enableFindReplace(false);
#endif
enableFindReplace(false);
#endif
void MultiLineEdit::setSpellCheckEnabled(bool enable)
{
void MultiLineEdit::setSpellCheckEnabled(bool enable)
{
setCheckSpellingEnabled(enable);
#else
Q_UNUSED(enable)
setCheckSpellingEnabled(enable);
#else
Q_UNUSED(enable)
void MultiLineEdit::keyPressEvent(QKeyEvent *event)
{
void MultiLineEdit::keyPressEvent(QKeyEvent *event)
{
- // Workaround the fact that Qt < 4.5 doesn't know InsertLineSeparator yet
-#if QT_VERSION >= 0x040500
if (event == QKeySequence::InsertLineSeparator) {
if (event == QKeySequence::InsertLineSeparator) {
-#else
-
-# ifdef Q_OS_MAC
- if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && event->modifiers() & Qt::META) {
-# else
- if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && event->modifiers() & Qt::SHIFT) {
-# endif
-#endif
-
if (_mode == SingleLine) {
event->accept();
on_returnPressed();
if (_mode == SingleLine) {
event->accept();
on_returnPressed();
KTextEdit::keyPressEvent(event);
#else
QTextEdit::keyPressEvent(event);
KTextEdit::keyPressEvent(event);
#else
QTextEdit::keyPressEvent(event);
#ifdef HAVE_KDE4
# include <KDE/KTextEdit>
# define MultiLineEditParent KTextEdit
#ifdef HAVE_KDE4
# include <KDE/KTextEdit>
# define MultiLineEditParent KTextEdit
+#elif defined HAVE_KF5
+# include <KTextWidgets/KTextEdit>
+# define MultiLineEditParent KTextEdit
#else
# include <QTextEdit>
# define MultiLineEditParent QTextEdit
#else
# include <QTextEdit>
# define MultiLineEditParent QTextEdit