Disable changing window size only after first.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-11-05 13:54:15 +02:00
parent 8b6d8aee70
commit f4aabbcf06
2 changed files with 25 additions and 4 deletions

View File

@ -58,7 +58,7 @@ const DialogLayoutSettings::FormatsVector DialogLayoutSettings::pageFormatNames
//---------------------------------------------------------------------------------------------------------------------
DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent, bool disableSettings)
: QDialog(parent), disableSettings(disableSettings), ui(new Ui::DialogLayoutSettings), oldPaperUnit(Unit::Mm),
oldLayoutUnit(Unit::Mm), generator(generator)
oldLayoutUnit(Unit::Mm), generator(generator), isInitialized(false)
{
ui->setupUi(this);
@ -100,9 +100,6 @@ DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget
QPushButton *bRestoreDefaults = ui->buttonBox->button(QDialogButtonBox::RestoreDefaults);
connect(bRestoreDefaults, &QPushButton::clicked, this, &DialogLayoutSettings::RestoreDefaults);
setMaximumSize(size());
setMinimumSize(size());
}
//---------------------------------------------------------------------------------------------------------------------
@ -334,6 +331,27 @@ QString DialogLayoutSettings::MakeGroupsHelp()
return tr("\n\tThree groups: big, middle, small = 0\n\tTwo groups: big, small = 1\n\tDescending area = 2\n");
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::showEvent(QShowEvent *event)
{
QDialog::showEvent( event );
if ( event->spontaneous() )
{
return;
}
if (isInitialized)
{
return;
}
// do your init stuff here
setMaximumSize(size());
setMinimumSize(size());
isInitialized = true;//first show windows are held
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::ConvertLayoutSize()
{

View File

@ -100,6 +100,8 @@ public:
qreal LayoutToPixels(qreal value) const;
qreal PageToPixels(qreal value) const;
static QString MakeGroupsHelp();
protected:
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
public slots:
void ConvertPaperSize();
void ConvertLayoutSize();
@ -123,6 +125,7 @@ private:
Unit oldPaperUnit;
Unit oldLayoutUnit;
VLayoutGenerator *generator;
bool isInitialized;
void InitPaperUnits();
void InitLayoutUnits();