a1rltt
a1rltt

Reputation: 3

How can i open HTML file on a specific header in QT?

I use help button (from QDialog) to open an HTML file, but i want it to open on specific header (<h1>, <h2>, etc.), depending on from which window i use help button.

This is how i open HTML:

QDesktopServices::openUrl(QUrl(QCoreApplication::applicationDirPath() + "/HELP.html"));

How can i do it?

Upvotes: 0

Views: 180

Answers (1)

Peter Kraume
Peter Kraume

Reputation: 3747

When you add id attributes to your headlines, you can use anchor links:

<h1 id="somename">my headline</h1>

Your link can then look like this:

QDesktopServices::openUrl(QUrl(QCoreApplication::applicationDirPath() + "/HELP.html#somename"));

Upvotes: 0

Related Questions