about dialog improved
authorAlexey Chernobaev <achernobaev@dev.rtsoft.ru>
Wed, 28 Mar 2018 14:59:14 +0000 (17:59 +0300)
committerAlexey Chernobaev <achernobaev@dev.rtsoft.ru>
Wed, 28 Mar 2018 14:59:14 +0000 (17:59 +0300)
src/analyze/gui/aboutdialog.cpp
src/analyze/gui/aboutdialog.ui

index 1f500fb9f589ade1e9964218f8e4c068b7e09153..7973d9c466a9ae73d9043151d946afe1aeee6f5f 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "aboutdata.h"
 
+#include <QFontMetrics>
+
 AboutDialog::AboutDialog(QWidget *parent) :
     QDialog(parent),
     ui(new Ui::AboutDialog)
@@ -12,8 +14,10 @@ AboutDialog::AboutDialog(QWidget *parent) :
 
     setWindowTitle("About " + AboutData::DisplayName);
 
-    ui->label->setText(QString(
-        "<h2>A visualizer for heaptrack data files.</h2>" \
+    ui->textEdit->viewport()->setAutoFillBackground(false);
+
+    ui->textEdit->setHtml(QString(
+        "<h2>A visualizer for heaptrack data files</h2>" \
         "<p>Copyright 2015, Milian Wolff " \
         "&lt;<a href=mailto:mail@milianw.de>mail@milianw.de</a>&gt;</p>" \
         "<p>GNU LESSER GENERAL PUBLIC LICENSE v.2.1</p>" \
@@ -25,6 +29,14 @@ AboutDialog::AboutDialog(QWidget *parent) :
         "(<a href=http://www.doublejdesign.co.uk>www.doublejdesign.co.uk</a>)</p>")
         .arg(AboutData::Organization)
     );
+
+    QFontMetrics fm(ui->textEdit->font());
+    QRect rect = fm.boundingRect("The application is based in part on the work of the Qwt project (qwt.sf.net)");
+    int m = ui->verticalLayout->margin();
+    int h = ui->buttonBox->height();
+    int textWidth = (int)round(rect.width() * 1.03);
+    int textHeight = (int)round(rect.height() * 1.03 * 14);
+    resize(std::max(420, 2 * m + textWidth), std::max(252, 2 * m + h + textHeight));
 }
 
 AboutDialog::~AboutDialog()
index 870ce4991acb13f5bcb6316dcf1215bdf8c7f375..8eea6e9a2f9be1fe6763f28c65bf7fe9ee2133ec 100644 (file)
@@ -12,8 +12,8 @@
   </property>
   <property name="minimumSize">
    <size>
-    <width>426</width>
-    <height>254</height>
+    <width>352</width>
+    <height>198</height>
    </size>
   </property>
   <property name="windowTitle">
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
-    <widget class="QLabel" name="label">
-     <property name="text">
-      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;See cpp-file&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-     </property>
-     <property name="alignment">
-      <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
-     </property>
-     <property name="wordWrap">
+    <widget class="QTextEdit" name="textEdit">
+     <property name="readOnly">
       <bool>true</bool>
      </property>
+     <property name="html">
+      <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+     </property>
     </widget>
    </item>
    <item>