私のプログラムでは、about セクションで QMessageBox を実行しており、html ファイルをインポートして上記のボックスのレイアウトを設定しています。
// Program.cpp
QMessageBox about;
about.setWindowTitle(tr("About"));
// Enable the HTML format.
about.setTextFormat(Qt::RichText);
// Getting the HTML from the file
std::ifstream file("html/about.html");
std::string html, line;
if (file.is_open())
{
while (std::getline(file, line))
html += line;
}
about.setText(html.c_str());
about.exec();
about.html は次のようになります。
<!-- about.html -->
<div>
<h1>The Program</h1>
<p> Presentation </p>
<p> Version : 0.1.2 </p>
<p> <a href="www.wipsea.com">User Manual</a> </p>
<h4>Licence Agreement</h4>
<p style="border: 1px solid black; overflow: y;">
Law thingy, bla and also bla, etc ...
</p>
</div>
問題は、何が可能で何が不可能なのかわからないことです。
たとえば、境界線とオーバーフローのあるテキストエリアに使用許諾契約を入れたいとします。h1 と h4 は機能しますが、使用許諾契約のスタイルは機能しません。
したがって、使用許諾契約は単なるテキストです。
QMessageBox で html のスタイルを設定する方法はありますか?