// Устанавливается текст ссылки QTextCharFormat charFormat; charFormat.setAnchorHref(refereceUrl); // Если текст ссылки задан if(refereceUrl.length()>0) { charFormat.setAnchor(true); textArea->textCursor().mergeCharFormat(charFormat); } else { // Иначе текст ссылки пустой и ссылку надо убрать charFormat.setAnchor(false); textArea->textCursor().setCharFormat(charFormat); }
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Тут есть текст.</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Тут <a href="https://link.ru">есть</a> текст.</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Тут <a href="https://link.ru"><span style=" text-decoration: underline; color:#0000ff;">есть</span></a> текст.</p>
C++ (Qt)void FormattingToolbar::on_insertHyperlink_clicked(){ if ( !editor ) return; DialogInsertHyperlink dialog( this ); dialog.setTextHyperlink( editor->textCursor().selectedText() ); if ( !dialog.exec() ) return; const QString & hyperlink = dialog.getHyperlink(); const QString & text = dialog.getTextHyperlink(); editor->insertHtml( QString( "<a href=\"%1\">%2</a> " ).arg( hyperlink ).arg( text ) );}
charFormat.setForeground(QApplication::palette().color(QPalette::Link));charFormat.setFontUnderline(true);
./ui_page_notes.h:26:50: fatal error: NavigationPanel\datenavigationwidget.h: Нет такого файла или каталога #include "NavigationPanel\datenavigationwidget.h" ^compilation terminated.Makefile:1162: ошибка выполнения рецепта для цели «Manager.o»
RichTextNote.o: In function `RichTextNote::saveAs()':RichTextNote.cpp:(.text+0xca38): undefined reference to `JlCompress::compressDir(QString, QString, bool)'scriptsmanager.o: In function `ScriptsManager::on_actionRunScript_triggered()':scriptsmanager.cpp:(.text+0xf66): undefined reference to `QsciScintilla::text() const'scriptsmanager.o: In function `ScriptsManager::ScriptsManager(QWidget*)':scriptsmanager.cpp:(.text+0x15bb): undefined reference to `QsciLexerJavaScript::QsciLexerJavaScript(QObject*)'scriptsmanager.cpp:(.text+0x17d8): undefined reference to `QsciScintilla::setMatchedBraceBackgroundColor(QColor const&)'scriptsmanager.cpp:(.text+0x17f6): undefined reference to `QsciScintilla::setUnmatchedBraceForegroundColor(QColor const&)'scriptsmanager.o: In function `ScriptsManager::sl_ContentScriptChanged()':scriptsmanager.cpp:(.text+0x2369): undefined reference to `QsciScintilla::text() const'scriptsmanager.o: In function `Ui_ScriptsManager::setupUi(QMainWindow*)':scriptsmanager.cpp:(.text._ZN17Ui_ScriptsManager7setupUiEP11QMainWindow[_ZN17Ui_ScriptsManager7setupUiEP11QMainWindow]+0x885): undefined reference to `QsciScintilla::QsciScintilla(QWidget*)'main.o: In function `main':main.cpp:(.text.startup+0xf4): undefined reference to `QtSingleApplication::QtSingleApplication(int&, char**, bool)'main.cpp:(.text.startup+0x1b7): undefined reference to `QtSingleApplication::isRunning()'main.cpp:(.text.startup+0x1ed): undefined reference to `QtSingleApplication::sendMessage(QString const&, int)'main.cpp:(.text.startup+0x20d): undefined reference to `vtable for QtSingleApplication'main.cpp:(.text.startup+0xe9c): undefined reference to `vtable for QtSingleApplication'collect2: error: ld returned 1 exit statusMakefile:393: ошибка выполнения рецепта для цели «../bin/NotesManager»make: *** [../bin/NotesManager] Ошибка 1