1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2025-01-05 12:56:52 +01:00

Use SetMinimumSize in about dialog

This commit is contained in:
Jonas Kvinge 2020-06-08 23:40:15 +02:00
parent dfa684cccc
commit 033d56a4b3
3 changed files with 27 additions and 21 deletions

View File

@ -95,24 +95,13 @@ About::About(QWidget *parent):QDialog(parent) {
ui_.label_title->setFont(title_font);
ui_.label_title->setText(Title);
ui_.label_title->adjustSize();
ui_.label_text->setText(MainHtml());
ui_.label_text->adjustSize();
ui_.text_contributors->setText(ContributorsHtml());
ui_.buttonBox->button(QDialogButtonBox::Close)->setShortcut(QKeySequence::Close);
}
void About::showEvent(QShowEvent*) {
setMinimumHeight(0);
setMaximumHeight(9000);
adjustSize();
setFixedHeight(height() + 40);
}
QString About::MainHtml() const {
QString ret;
@ -134,9 +123,9 @@ QString About::MainHtml() const {
ret += "</p>";
ret += "<p>";
ret += tr("If you like this Strawberry and can make use of it, consider sponsoring or donating.");
ret += tr("If you like Strawberry and can make use of it, consider sponsoring or donating.");
ret += "<br />";
ret += tr("You can sponsor the author on %1. You can also make a one-time payment through %2.").arg("<a href=\"https://github.com/sponsors/jonaski\">GitHub sponsors</a>.").arg("<a href=\"https://paypal.me/jonaskvinge\">paypal.me/jonaskvinge</a>");
ret += tr("You can sponsor the author on %1. You can also make a one-time payment through %2.").arg("<a href=\"https://github.com/sponsors/jonaski\">GitHub sponsors</a>").arg("<a href=\"https://paypal.me/jonaskvinge\">paypal.me/jonaskvinge</a>");
ret += "</p>";
return ret;

View File

@ -32,7 +32,6 @@
#include "ui_about.h"
class QWidget;
class QShowEvent;
class About : public QDialog {
Q_OBJECT
@ -40,9 +39,6 @@ class About : public QDialog {
public:
explicit About(QWidget *parent = nullptr);
protected:
void showEvent(QShowEvent*);
private:
struct Person {
Person(const QString &n, const QString &e = QString()) : name(n), email(e) {}

View File

@ -25,6 +25,9 @@
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="windowTitle">
<string>About</string>
</property>
<property name="windowIcon">
<iconset resource="../../data/icons.qrc">
<normaloff>:/icons/64x64/strawberry.png</normaloff>:/icons/64x64/strawberry.png</iconset>
@ -37,12 +40,15 @@
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="layout_about">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_logo">
<layout class="QVBoxLayout" name="layout_left">
<item>
<widget class="QLabel" name="label_icon">
<property name="pixmap">
@ -91,9 +97,18 @@
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_text">
<layout class="QVBoxLayout" name="layout_right">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QLabel" name="label_title">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
@ -107,6 +122,12 @@
</item>
<item>
<widget class="QLabel" name="label_text">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>