M
M
Mercury132016-02-17 16:33:11
Qt
Mercury13, 2016-02-17 16:33:11

QLabel: What's the best way to style hyperlinks?

At the moment we have many such places. Qlabel component.

<a href='action:start' style='color:yellow; text-decoration:none'>текст ссылки</a>

The place is clumsy: these are duplicates, and here there is more technical text than real. I tried to tweak the property stylesheet, I did not achieve any effect.
Qt's, tell me how you do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mercury13, 2016-02-18
@Mercury13

So far the best solution is...

static const QString someCss = "<style>...</style>";

lbLabel->setText(someCss + MSG_LINK)

The MSG_LINK construction comes out simple enough for the translator to process it easily, and someCss is a single place for styles.

J
Jacob E, 2016-02-17
@Zifix

Click a macro or add a method in a QLabel descendant and use it if you don't like looking at technical text.
It will be something like:
or
lbLabel->setLink("action:start", "текст ссылки");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question