mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-10-31 15:47:10 -04:00
04046b9415
Qt makes sure a widget's window is displayed on a display if the display configuration changes while it is running. If the display configuration changes while the application is not running then only QWidget::saveGeometry() and QWidget::restoreGeometry() will ensure that the widget's window is correctly displayed if the original display is no longer present. Merged from ^/branches/wsjtx. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx-1.6@6259 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
46 lines
992 B
C++
46 lines
992 B
C++
#include "messageaveraging.h"
|
|
#include <QSettings>
|
|
#include "ui_messageaveraging.h"
|
|
#include "commons.h"
|
|
#include "moc_messageaveraging.cpp"
|
|
|
|
MessageAveraging::MessageAveraging(QSettings * settings, QWidget *parent) :
|
|
QWidget(parent),
|
|
settings_ {settings},
|
|
ui(new Ui::MessageAveraging)
|
|
{
|
|
ui->setupUi(this);
|
|
read_settings ();
|
|
}
|
|
|
|
MessageAveraging::~MessageAveraging()
|
|
{
|
|
if (isVisible ()) write_settings ();
|
|
delete ui;
|
|
}
|
|
|
|
void MessageAveraging::closeEvent (QCloseEvent * e)
|
|
{
|
|
write_settings ();
|
|
QWidget::closeEvent (e);
|
|
}
|
|
|
|
void MessageAveraging::read_settings ()
|
|
{
|
|
settings_->beginGroup ("MessageAveraging");
|
|
restoreGeometry (settings_->value ("window/geometry").toByteArray ());
|
|
settings_->endGroup ();
|
|
}
|
|
|
|
void MessageAveraging::write_settings ()
|
|
{
|
|
settings_->beginGroup ("MessageAveraging");
|
|
settings_->setValue ("window/geometry", saveGeometry ());
|
|
settings_->endGroup ();
|
|
}
|
|
|
|
void MessageAveraging::displayAvg(QString t)
|
|
{
|
|
ui->msgAvgTextBrowser->setText(t);
|
|
}
|