Fix the minimum size of help text windows to the content size

This could make  help text windows bigger than the  screen, if we want
to  go there  then  using  a QLabel  sub-class  will  need to  change,
probably  by using  a  read-only QTextEdit  instead  as that  provides
scroll bars. Maybe  consider a multi-column table for  the contents as
an alternative to scroll bars.
This commit is contained in:
Bill Somerville 2020-05-15 14:37:14 +01:00
parent c97a127c68
commit c9977e2a9c
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F

View File

@ -22,10 +22,11 @@ HelpTextWindow::HelpTextWindow (QString const& title, QString const& file_name,
, tr ("Error: %1").arg (source.errorString ())); , tr ("Error: %1").arg (source.errorString ()));
return; return;
} }
setText (QTextStream {&source}.readAll ());
setWindowTitle(QApplication::applicationName () + " - " + title); setWindowTitle(QApplication::applicationName () + " - " + title);
setMargin (10); setMargin (10);
setBackgroundRole (QPalette::Base); setBackgroundRole (QPalette::Base);
setAutoFillBackground (true); setAutoFillBackground (true);
setStyleSheet (font_as_stylesheet (font)); setStyleSheet (font_as_stylesheet (font));
setText (QTextStream {&source}.readAll ());
setMinimumSize (sizeHint ());
} }