Reply to topic

kdialog - usage description with HTML-Markup

fgotsis
Registered Member
Posts
2
Karma
0
Hello,
as I still cannot find any description of how to use HTML-Markup in kdialog I want to shortly describe its use and add a few examples (simple GUI dialogs in Qt to use in skripts). My hope is that the description eventually finds it way into the tutorial for kdialog.

kdailog hat its tutorial at https://techbase.kde.org/Development/Tutorials/Shell_Scripting_with_KDE_Dialogs#Introduction_and_Scope

The examples given there use standard text without any markup. But in nearly all dialogs HTML-Markup can be quite extensively used, which allows to add design to dialogs used in skripts (perl, bash, ...).

I start with the msgbox: Suppose you want to add a title to your box and pring important facts in bold characters (oder any other easy to spot markup).

Here is an example using bash
#!/bin/bash
title="Some important dialog"
message="<h1>This is the main header of the dialog.</h1>"
message+="<h2>Here comes a subheader and afterwards a numbered list </h2>"
message+="<ol> <li>Source: &gt;some source value&lt; </li>"
message+="<li>target: &gt; some target directory &lt; </li> </ol>"
message+="<p> you can also add simple paragraphs with some letters in <strong>bold</strong> or <i>italics </i> </p>"
kdialog --title "$title" --yesno "$message"

and it works with the --inputbox dialog as well
#!/bin/bash
title="Some important dialog"
message="<h1>This is the main header of the dialog.</h1>"
message+="<h2>Here comes a subheader and afterwards a numbered list </h2>"
message+="<ol> <li>Source: &gt;some source value&lt; </li>"
message+="<li>target: &gt; some target directory &lt; </li> </ol>"
message+="<p> you can also add simple paragraphs with some letters in <strong>bold</strong> or <i>italics </i> </p>"
kdialog --title "$title" --inputbox "$message" "default value"

This kind of markup works with almost all dialogs of the kdialog set.

The usable tags can be found in the documentation of QT (used by kdialog):
https://doc.qt.io/qt-5/richtext-html-subset.html

kind regards
Franz

Reply to topic

Bookmarks



Who is online

Registered users: ab, Baidu [Spider], Bing [Bot], claydoh, cmb, DeMus, frantesta, Google [Bot], hagdervriese, KayshiAri, koffeinfriedhof, Marius82, shmu26, Sogou [Bot], Yahoo [Bot]