diff --git a/src/GUI/popup.cpp b/src/GUI/popup.cpp index 43c2e69c..e85c4c81 100644 --- a/src/GUI/popup.cpp +++ b/src/GUI/popup.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) #include @@ -93,21 +94,29 @@ void PopupFrame::createLayout(const ToolTip &content) } if (!content.list().isEmpty()) { - QString html = ""; - for (int i = 0; i < content.list().count(); i++) - html += ""; - html += "
" + content.list().at(i).key() - + ": " + content.list().at(i).value() - + "
"; + QFormLayout *textLayout = new QFormLayout(); + textLayout->setLabelAlignment(Qt::AlignRight); + textLayout->setHorizontalSpacing(5); + textLayout->setVerticalSpacing(2); - QLabel *label = new QLabel(html); - label->setAlignment(Qt::AlignLeft); - label->setIndent(1); - label->setTextInteractionFlags(Qt::TextBrowserInteraction); - label->setOpenExternalLinks(true); - label->setWordWrap(true); + for (int i = 0; i < content.list().count(); i++) { + QLabel *key = new QLabel(content.list().at(i).key() + ":"); + key->setTextFormat(Qt::PlainText); + key->setAlignment(Qt::AlignTop); + key->setStyleSheet("font-weight: bold"); + QLabel *value = new QLabel(content.list().at(i).value()); + value->setSizePolicy(QSizePolicy::MinimumExpanding, + QSizePolicy::Preferred); + value->setTextFormat(Qt::RichText); + value->setAlignment(Qt::AlignTop); + value->setTextInteractionFlags(Qt::TextBrowserInteraction); + value->setOpenExternalLinks(true); + value->setWordWrap(true); - layout->addWidget(label); + textLayout->addRow(key, value); + } + + layout->addLayout(textLayout); } setLayout(layout);