QTextBrowser hyperlink "spreading" to other text rows
-
Hi,
I am trying to have hyperlink in my QTextBrowser that open file location when it is clicked. It works fine, but there is bug that causes hyperlink to spread other text rows. Other rows are valid hyperlinks to actual links filepath.
QTextBrowser looks like that. Those <CollectMission> lines are not supposed to be hyperlinks.Hyperlink is written using function:
void MainWindow::WriteHyperLink(QStringList text, QString URL ){ QString hyperLink = QString("<a href=%1>%2</a>%3").arg(URL, text.at(0), text.at(1)); ui->textBrowser->append(hyperLink); }where text.at(0) is path to folder and text.at(1) is filename (int this case "/annotation_test_with_grip_pose_estimation.json")
Text is written using following function:
void MainWindow::WriteText(QString message, QString parentName) { QString textToWrite; if (parentName != ""){ textToWrite = QStringLiteral("<%1> %2").arg(parentName, message); } else { textToWrite = str; } ui->textBrowser->append(textToWrite); }Any ideas how to fix this?
-
Hi,
I am trying to have hyperlink in my QTextBrowser that open file location when it is clicked. It works fine, but there is bug that causes hyperlink to spread other text rows. Other rows are valid hyperlinks to actual links filepath.
QTextBrowser looks like that. Those <CollectMission> lines are not supposed to be hyperlinks.Hyperlink is written using function:
void MainWindow::WriteHyperLink(QStringList text, QString URL ){ QString hyperLink = QString("<a href=%1>%2</a>%3").arg(URL, text.at(0), text.at(1)); ui->textBrowser->append(hyperLink); }where text.at(0) is path to folder and text.at(1) is filename (int this case "/annotation_test_with_grip_pose_estimation.json")
Text is written using following function:
void MainWindow::WriteText(QString message, QString parentName) { QString textToWrite; if (parentName != ""){ textToWrite = QStringLiteral("<%1> %2").arg(parentName, message); } else { textToWrite = str; } ui->textBrowser->append(textToWrite); }Any ideas how to fix this?
@Tantsa said in QTextBrowser hyperlink "spreading" to other text rows:
"<a href=%1>%2</a>%3"
Shouldn't it be
"<a href=\"%1\">%2</a>%3"?
-
Hi,
I am trying to have hyperlink in my QTextBrowser that open file location when it is clicked. It works fine, but there is bug that causes hyperlink to spread other text rows. Other rows are valid hyperlinks to actual links filepath.
QTextBrowser looks like that. Those <CollectMission> lines are not supposed to be hyperlinks.Hyperlink is written using function:
void MainWindow::WriteHyperLink(QStringList text, QString URL ){ QString hyperLink = QString("<a href=%1>%2</a>%3").arg(URL, text.at(0), text.at(1)); ui->textBrowser->append(hyperLink); }where text.at(0) is path to folder and text.at(1) is filename (int this case "/annotation_test_with_grip_pose_estimation.json")
Text is written using following function:
void MainWindow::WriteText(QString message, QString parentName) { QString textToWrite; if (parentName != ""){ textToWrite = QStringLiteral("<%1> %2").arg(parentName, message); } else { textToWrite = str; } ui->textBrowser->append(textToWrite); }Any ideas how to fix this?
-
@jsulm
No, there is one hyperlink added using WriteHyperLink() function and then added normal text using WriteText() function.
However text written using WriteText() appears as hyperlink too, when it is supposed to be plain text.If you take careful look to image hyperlink is only "C:/Users/ [...] /json/annotation_test_with_grip", because that is path to folder that is supposed to open. Filename with extension (.json) is not part of hyperlink.
Now every new line to added to QTextBrowser becomes to hyperlink that have same location as original hyperlink, but different text.
-
Hi,
I am trying to have hyperlink in my QTextBrowser that open file location when it is clicked. It works fine, but there is bug that causes hyperlink to spread other text rows. Other rows are valid hyperlinks to actual links filepath.
QTextBrowser looks like that. Those <CollectMission> lines are not supposed to be hyperlinks.Hyperlink is written using function:
void MainWindow::WriteHyperLink(QStringList text, QString URL ){ QString hyperLink = QString("<a href=%1>%2</a>%3").arg(URL, text.at(0), text.at(1)); ui->textBrowser->append(hyperLink); }where text.at(0) is path to folder and text.at(1) is filename (int this case "/annotation_test_with_grip_pose_estimation.json")
Text is written using following function:
void MainWindow::WriteText(QString message, QString parentName) { QString textToWrite; if (parentName != ""){ textToWrite = QStringLiteral("<%1> %2").arg(parentName, message); } else { textToWrite = str; } ui->textBrowser->append(textToWrite); }Any ideas how to fix this?
@Tantsa said in QTextBrowser hyperlink "spreading" to other text rows:
"<a href=%1>%2</a>%3"
Shouldn't it be
"<a href=\"%1\">%2</a>%3"?
-
@Tantsa said in QTextBrowser hyperlink "spreading" to other text rows:
"<a href=%1>%2</a>%3"
Shouldn't it be
"<a href=\"%1\">%2</a>%3"?
@jsulm said in QTextBrowser hyperlink "spreading" to other text rows:
@Tantsa said in QTextBrowser hyperlink "spreading" to other text rows:
"<a href=%1>%2</a>%3"
Shouldn't it be
"<a href=\"%1\">%2</a>%3"?
Thank you, this solved problem.