Changeset View
Changeset View
Standalone View
Standalone View
src/noteedit.cpp
Show First 20 Lines • Show All 227 Lines • ▼ Show 20 Line(s) | 212 | { | |||
---|---|---|---|---|---|
228 | 228 | | |||
229 | // Not sure if the following comment is still true | 229 | // Not sure if the following comment is still true | ||
230 | // FIXME: Sometimes, the cursor flicker at ends before being positionned where clicked (because qApp->processEvents() I think) | 230 | // FIXME: Sometimes, the cursor flicker at ends before being positionned where clicked (because qApp->processEvents() I think) | ||
231 | textEdit->moveCursor(QTextCursor::End); | 231 | textEdit->moveCursor(QTextCursor::End); | ||
232 | textEdit->verticalScrollBar()->setCursor(Qt::ArrowCursor); | 232 | textEdit->verticalScrollBar()->setCursor(Qt::ArrowCursor); | ||
233 | setInlineEditor(textEdit); | 233 | setInlineEditor(textEdit); | ||
234 | connect(textEdit, SIGNAL(escapePressed()), this, SIGNAL(askValidation())); | 234 | connect(textEdit, SIGNAL(escapePressed()), this, SIGNAL(askValidation())); | ||
235 | connect(textEdit, SIGNAL(mouseEntered()), this, SIGNAL(mouseEnteredEditorWidget())); | 235 | connect(textEdit, SIGNAL(mouseEntered()), this, SIGNAL(mouseEnteredEditorWidget())); | ||
236 | | ||||
237 | connect(textEdit, SIGNAL(cursorPositionChanged()), textContent->note()->basket(), SLOT(editorCursorPositionChanged())); | | |||
238 | // In case it is a very big note, the top is displayed and Enter is pressed: the cursor is on bottom, we should enure it visible: | | |||
239 | QTimer::singleShot(0, textContent->note()->basket(), SLOT(editorCursorPositionChanged())); | | |||
240 | } | 236 | } | ||
241 | 237 | | |||
242 | TextEditor::~TextEditor() | 238 | TextEditor::~TextEditor() | ||
243 | { | 239 | { | ||
244 | delete graphicsWidget()->widget(); // TODO: delete that in validate(), so we can remove one method | 240 | delete graphicsWidget()->widget(); // TODO: delete that in validate(), so we can remove one method | ||
245 | } | 241 | } | ||
246 | 242 | | |||
247 | void TextEditor::autoSave(bool toFileToo) | 243 | void TextEditor::autoSave(bool toFileToo) | ||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | 287 | { | |||
339 | 335 | | |||
340 | connect(InlineEditors::instance()->richTextUndo, SIGNAL(triggered()), textEdit, SLOT(undo())); | 336 | connect(InlineEditors::instance()->richTextUndo, SIGNAL(triggered()), textEdit, SLOT(undo())); | ||
341 | connect(InlineEditors::instance()->richTextRedo, SIGNAL(triggered()), textEdit, SLOT(redo())); | 337 | connect(InlineEditors::instance()->richTextRedo, SIGNAL(triggered()), textEdit, SLOT(redo())); | ||
342 | connect(textEdit, SIGNAL(undoAvailable(bool)), InlineEditors::instance()->richTextUndo, SLOT(setEnabled(bool))); | 338 | connect(textEdit, SIGNAL(undoAvailable(bool)), InlineEditors::instance()->richTextUndo, SLOT(setEnabled(bool))); | ||
343 | connect(textEdit, SIGNAL(redoAvailable(bool)), InlineEditors::instance()->richTextRedo, SLOT(setEnabled(bool))); | 339 | connect(textEdit, SIGNAL(redoAvailable(bool)), InlineEditors::instance()->richTextRedo, SLOT(setEnabled(bool))); | ||
344 | connect(textEdit, SIGNAL(textChanged()), this, SLOT(editTextChanged())); | 340 | connect(textEdit, SIGNAL(textChanged()), this, SLOT(editTextChanged())); | ||
345 | InlineEditors::instance()->richTextUndo->setEnabled(false); | 341 | InlineEditors::instance()->richTextUndo->setEnabled(false); | ||
346 | InlineEditors::instance()->richTextRedo->setEnabled(false); | 342 | InlineEditors::instance()->richTextRedo->setEnabled(false); | ||
347 | | ||||
348 | connect(textEdit, SIGNAL(cursorPositionChanged()), htmlContent->note()->basket(), SLOT(editorCursorPositionChanged())); | | |||
349 | // In case it is a very big note, the top is displayed and Enter is pressed: the cursor is on bottom, we should enure it visible: | | |||
350 | QTimer::singleShot(0, htmlContent->note()->basket(), SLOT(editorCursorPositionChanged())); | | |||
351 | } | 343 | } | ||
352 | 344 | | |||
353 | void HtmlEditor::cursorPositionChanged() | 345 | void HtmlEditor::cursorPositionChanged() | ||
354 | { | 346 | { | ||
355 | InlineEditors::instance()->richTextFont->setCurrentFont(textEdit()->currentFont().family()); | 347 | InlineEditors::instance()->richTextFont->setCurrentFont(textEdit()->currentFont().family()); | ||
356 | if (InlineEditors::instance()->richTextColor->color() != textEdit()->textColor()) | 348 | if (InlineEditors::instance()->richTextColor->color() != textEdit()->textColor()) | ||
357 | InlineEditors::instance()->richTextColor->setColor(textEdit()->textColor()); | 349 | InlineEditors::instance()->richTextColor->setColor(textEdit()->textColor()); | ||
358 | InlineEditors::instance()->richTextBold->setChecked((textEdit()->fontWeight() >= QFont::Bold)); | 350 | InlineEditors::instance()->richTextBold->setChecked((textEdit()->fontWeight() >= QFont::Bold)); | ||
▲ Show 20 Lines • Show All 964 Lines • Show Last 20 Lines |