Disable changing window size only after first show.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-11-05 15:01:33 +02:00
parent 7f065cac89
commit 912d1f91f6
44 changed files with 188 additions and 97 deletions

View File

@ -34,13 +34,15 @@
#include <QDate>
#include <QDesktopServices>
#include <QMessageBox>
#include <QShowEvent>
#include <QUrl>
#include <QtDebug>
//---------------------------------------------------------------------------------------------------------------------
DialogAboutTape::DialogAboutTape(QWidget *parent)
:QDialog(parent),
ui(new Ui::DialogAboutTape)
ui(new Ui::DialogAboutTape),
isInitialized(false)
{
ui->setupUi(this);
@ -54,10 +56,6 @@ DialogAboutTape::DialogAboutTape(QWidget *parent)
FontPointSize(ui->label_Legal_Stuff, 11);
FontPointSize(ui->label_Tape_Built, 11);
FontPointSize(ui->label_QT_Version, 11);
adjustSize();
setMaximumSize(size());
setMinimumSize(size());
}
//---------------------------------------------------------------------------------------------------------------------
@ -80,6 +78,27 @@ void DialogAboutTape::changeEvent(QEvent *event)
QDialog::changeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogAboutTape::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 DialogAboutTape::WebButtonClicked()
{

View File

@ -45,6 +45,7 @@ public:
protected:
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
private slots:
void WebButtonClicked();
@ -52,6 +53,7 @@ private slots:
private:
Q_DISABLE_COPY(DialogAboutTape)
Ui::DialogAboutTape *ui;
bool isInitialized;
void FontPointSize(QWidget *w, int pointSize);

View File

@ -31,10 +31,13 @@
#include "../vpatterndb/variables/vmeasurement.h"
#include <QShowEvent>
//---------------------------------------------------------------------------------------------------------------------
DialogNewMeasurements::DialogNewMeasurements(QWidget *parent)
:QDialog(parent),
ui(new Ui::DialogNewMeasurements)
ui(new Ui::DialogNewMeasurements),
isInitialized(false)
{
ui->setupUi(this);
@ -48,10 +51,6 @@ DialogNewMeasurements::DialogNewMeasurements(QWidget *parent)
connect(ui->comboBoxUnit, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogNewMeasurements::CurrentUnitChanged);
adjustSize();
setMaximumSize(size());
setMinimumSize(size());
}
//---------------------------------------------------------------------------------------------------------------------
@ -100,6 +99,27 @@ void DialogNewMeasurements::changeEvent(QEvent *event)
QDialog::changeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogNewMeasurements::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 DialogNewMeasurements::CurrentTypeChanged(int index)
{

View File

@ -53,6 +53,7 @@ public:
protected:
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
private slots:
void CurrentTypeChanged(int index);
@ -61,6 +62,7 @@ private slots:
private:
Q_DISABLE_COPY(DialogNewMeasurements)
Ui::DialogNewMeasurements *ui;
bool isInitialized;
void InitMTypes();
void InitHeightsList();

View File

@ -39,7 +39,8 @@
//---------------------------------------------------------------------------------------------------------------------
DialogAboutApp::DialogAboutApp(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogAboutApp)
ui(new Ui::DialogAboutApp),
isInitialized(false)
{
ui->setupUi(this);
@ -66,9 +67,6 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
FontPointSize(ui->label_contrib_label, 11);
FontPointSize(ui->label_Valentina_Built, 11);
FontPointSize(ui->label_QT_Version, 11);
setMaximumSize(size());
setMinimumSize(size());
}
//---------------------------------------------------------------------------------------------------------------------
@ -77,6 +75,27 @@ DialogAboutApp::~DialogAboutApp()
delete ui;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogAboutApp::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 DialogAboutApp::FontPointSize(QWidget *w, int pointSize)
{

View File

@ -44,8 +44,12 @@ public:
explicit DialogAboutApp(QWidget *parent = 0);
~DialogAboutApp();
protected:
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
private:
Ui::DialogAboutApp *ui;
bool isInitialized;
Q_DISABLE_COPY(DialogAboutApp)
void FontPointSize(QWidget *w, int pointSize);

View File

@ -38,7 +38,7 @@
//---------------------------------------------------------------------------------------------------------------------
DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent)
:QDialog(parent), ui(new Ui::DialogLayoutProgress), maxCount(count), movie(nullptr)
:QDialog(parent), ui(new Ui::DialogLayoutProgress), maxCount(count), movie(nullptr), isInitialized(false)
{
ui->setupUi(this);
@ -59,9 +59,6 @@ DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent)
setModal(true);
this->setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
setMaximumSize(size());
setMinimumSize(size());
}
//---------------------------------------------------------------------------------------------------------------------
@ -117,3 +114,24 @@ void DialogLayoutProgress::StopWorking()
{
emit Abort();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutProgress::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
}

View File

@ -56,11 +56,15 @@ public slots:
void Finished();
void StopWorking();
protected:
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(DialogLayoutProgress)
Ui::DialogLayoutProgress *ui;
const int maxCount;
QMovie *movie;
bool isInitialized;
};
#endif // DIALOGLAYOUTPROGRESS_H

View File

@ -41,7 +41,7 @@
//---------------------------------------------------------------------------------------------------------------------
DialogNewPattern::DialogNewPattern(VContainer *data, const QString &patternPieceName, QWidget *parent)
:QDialog(parent), ui(new Ui::DialogNewPattern), data(data)
:QDialog(parent), ui(new Ui::DialogNewPattern), data(data), isInitialized(false)
{
ui->setupUi(this);
@ -56,9 +56,6 @@ DialogNewPattern::DialogNewPattern(VContainer *data, const QString &patternPiece
InitUnits();
CheckState();
connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogNewPattern::CheckState);
setMaximumSize(size());
setMinimumSize(size());
}
//---------------------------------------------------------------------------------------------------------------------
@ -88,6 +85,27 @@ void DialogNewPattern::CheckState()
bOk->setEnabled(flagName);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogNewPattern::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 DialogNewPattern::InitUnits()
{

View File

@ -50,10 +50,13 @@ public:
Unit PatternUnit() const;
public slots:
void CheckState();
protected:
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(DialogNewPattern)
Ui::DialogNewPattern *ui;
VContainer *data;
bool isInitialized;
void InitUnits();
};

View File

@ -39,7 +39,7 @@
DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent) :
QDialog(parent), ui(new Ui::DialogPatternProperties), doc(doc), heightsChecked(MAX_HEIGHTS),
sizesChecked(MAX_SIZES), heights (QMap<GHeights, bool>()), sizes(QMap<GSizes, bool>()),
data(QMap<QCheckBox *, int>()), descriptionChanged(false), gradationChanged(false)
data(QMap<QCheckBox *, int>()), descriptionChanged(false), gradationChanged(false), isInitialized(false)
{
ui->setupUi(this);
@ -80,9 +80,6 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent)
SetOptions(sizes);
gradationChanged = false;//Set to default value after initialization
setMaximumSize(size());
setMinimumSize(size());
}
//---------------------------------------------------------------------------------------------------------------------
@ -254,6 +251,27 @@ void DialogPatternProperties::DescEdited()
descriptionChanged = true;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogPatternProperties::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 DialogPatternProperties::SetHeightsChecked(bool enabled)
{

View File

@ -56,6 +56,8 @@ public slots:
void CheckStateHeight(int state);
void CheckStateSize(int state);
void DescEdited();
protected:
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(DialogPatternProperties)
Ui::DialogPatternProperties *ui;
@ -67,6 +69,7 @@ private:
QMap<QCheckBox *, int> data;
bool descriptionChanged;
bool gradationChanged;
bool isInitialized;
void SetHeightsChecked(bool enabled);
void SetSizesChecked(bool enabled);

View File

@ -46,7 +46,7 @@ bool DialogSaveLayout::tested = false;
//---------------------------------------------------------------------------------------------------------------------
DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *parent)
:QDialog(parent), ui(new Ui::DialogSaveLAyout), count(count), availFormats(InitAvailFormats())
:QDialog(parent), ui(new Ui::DialogSaveLAyout), count(count), isInitialized(false), availFormats(InitAvailFormats())
{
ui->setupUi(this);
@ -93,9 +93,6 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *
ui->lineEditPath->setText(qApp->ValentinaSettings()->GetPathLayout());
ShowExample();//Show example for current format.
setMaximumSize(size());
setMinimumSize(size());
}
//---------------------------------------------------------------------------------------------------------------------
@ -246,6 +243,27 @@ void DialogSaveLayout::PathChanged(const QString &text)
ui->lineEditPath->setPalette(palette);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveLayout::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
}
//---------------------------------------------------------------------------------------------------------------------
bool DialogSaveLayout::SupportPSTest()
{

View File

@ -62,11 +62,13 @@ public slots:
void ShowExample();
void Browse();
void PathChanged(const QString &text);
protected:
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(DialogSaveLayout)
Ui::DialogSaveLAyout *ui;
int count;
bool isInitialized;
// Note. We can't make availFormats static because MSVC doesn't support C++11 list initialization
QVector<std::pair<QString, QString>> availFormats;
static bool havePdf;

View File

@ -76,8 +76,6 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId,
// Call after initialization vis!!!!
SetTypeLine(TypeLineNone);//By default don't show line
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -90,8 +90,6 @@ DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *par
connect(ui->pushButtonGrowLengthF2, &QPushButton::clicked, this, &DialogArc::DeployF2TextEdit);
vis = new VisToolArc(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -85,8 +85,6 @@ DialogArcWithLength::DialogArcWithLength(const VContainer *data, const quint32 &
connect(ui->pushButtonGrowLengthArcLength, &QPushButton::clicked, this, &DialogArcWithLength::DeployLengthTextEdit);
vis = new VisToolArcWithLength(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -75,8 +75,6 @@ DialogBisector::DialogBisector(const VContainer *data, const quint32 &toolId, QW
this, &DialogBisector::PointNameChanged);
vis = new VisToolBisector(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -68,8 +68,6 @@ DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, const
connect(timerFormula, &QTimer::timeout, this, &DialogCurveIntersectAxis::EvalAngle);
vis = new VisToolCurveIntersectAxis(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -66,8 +66,6 @@ DialogCutArc::DialogCutArc(const VContainer *data, const quint32 &toolId, QWidge
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutArc::DeployFormulaTextEdit);
vis = new VisToolCutArc(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -65,8 +65,6 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, const quint32 &toolId,
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutSpline::DeployFormulaTextEdit);
vis = new VisToolCutSpline(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -65,8 +65,6 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, const quint32 &
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogCutSplinePath::DeployFormulaTextEdit);
vis = new VisToolCutSplinePath(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -78,8 +78,6 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge
connect(ui.lineEditNameDetail, &QLineEdit::textChanged, this, &DialogDetail::NamePointChanged);
connect(ui.toolButtonDelete, &QToolButton::clicked, this, &DialogDetail::DeleteItem);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------
@ -256,7 +254,7 @@ void DialogDetail::setDetail(const VDetail &value)
ui.listWidget->clear();
for (int i = 0; i < detail.CountNode(); ++i)
{
const VNodeDetail &node = detail.at(i);
const VNodeDetail &node = detail.at(i);
NewItem(node.getId(), node.getTypeTool(), node.getTypeNode(), node.getMx(),
node.getMy(), node.getReverse());
}

View File

@ -80,8 +80,6 @@ DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWid
connect(timerFormula, &QTimer::timeout, this, &DialogEndLine::EvalAngle);
vis = new VisToolEndLine(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -65,8 +65,6 @@ DialogHeight::DialogHeight(const VContainer *data, const quint32 &toolId, QWidge
this, &DialogHeight::PointNameChanged);
vis = new VisToolHeight(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -63,8 +63,6 @@ DialogLine::DialogLine(const VContainer *data, const quint32 &toolId, QWidget *p
this, &DialogLine::PointNameChanged);
vis = new VisToolLine(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -65,8 +65,6 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, const quint32 &
this, &DialogLineIntersect::PointNameChanged);
vis = new VisToolLineIntersect(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -76,8 +76,6 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const q
this, &DialogLineIntersectAxis::PointNameChanged);
vis = new VisToolLineIntersectAxis(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -71,8 +71,6 @@ DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidge
this, &DialogNormal::PointNameChanged);
vis = new VisToolNormal(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -54,8 +54,6 @@ DialogPointFromArcAndTangent::DialogPointFromArcAndTangent(const VContainer *dat
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointFromArcAndTangent::NamePointChanged);
vis = new VisToolPointFromArcAndTangent(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -79,8 +79,6 @@ DialogPointFromCircleAndTangent::DialogPointFromCircleAndTangent(const VContaine
&DialogPointFromCircleAndTangent::DeployCircleRadiusTextEdit);
vis = new VisToolPointFromCircleAndTangent(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -71,8 +71,6 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, const quint32
this, &DialogPointOfContact::PointNameChanged);
vis = new VisToolPointOfContact(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -61,8 +61,6 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, con
vis = new VisToolPointOfIntersection(data);
vis->VisualMode(NULL_ID);//Show vertical axis
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -57,8 +57,6 @@ DialogPointOfIntersectionArcs::DialogPointOfIntersectionArcs(const VContainer *d
this, &DialogPointOfIntersectionArcs::ArcChanged);
vis = new VisToolPointOfIntersectionArcs(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -95,8 +95,6 @@ DialogPointOfIntersectionCircles::DialogPointOfIntersectionCircles(const VContai
&DialogPointOfIntersectionCircles::DeployCircle2RadiusTextEdit);
vis = new VisToolPointOfIntersectionCircles(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -76,8 +76,6 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, const quint32 &
this, &DialogShoulderPoint::PointNameChanged);
vis = new VisToolShoulderPoint(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -48,8 +48,6 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, const quint32 &tool
CheckState();
connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogTool::NamePointChanged);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -57,8 +57,6 @@ DialogSpline::DialogSpline(const VContainer *data, const quint32 &toolId, QWidge
this, &DialogSpline::PointNameChanged);
vis = new VisToolSpline(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -61,8 +61,6 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, const quint32 &toolId
this, &DialogSplinePath::KAsm2Changed);
vis = new VisToolSplinePath(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------
@ -84,7 +82,7 @@ void DialogSplinePath::SetPath(const VSplinePath &value)
ui->listWidget->clear();
for (qint32 i = 0; i < path.CountPoint(); ++i)
{
const VSplinePoint &point = path.at(i);
const VSplinePoint &point = path.at(i);
NewItem(point.P().id(), point.KAsm1(), point.Angle1(), point.KAsm2(), point.Angle2());
}
ui->listWidget->setFocus(Qt::OtherFocusReason);

View File

@ -106,6 +106,11 @@ void DialogTool::showEvent(QShowEvent *event)
{
return;
}
// do your init stuff here
setMaximumSize(size());
setMinimumSize(size());
isInitialized = true;//first show windows are held
ShowVisualization();
}
@ -281,13 +286,6 @@ bool DialogTool::eventFilter(QObject *object, QEvent *event)
return false;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FixateSize()
{
setMaximumSize(size());
setMinimumSize(size());
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ValFormulaChanged handle change formula

View File

@ -251,7 +251,6 @@ protected:
virtual void SaveData() {}
void MoveCursorToEnd(QPlainTextEdit *plainTextEdit);
bool eventFilter(QObject *object, QEvent *event);
void FixateSize();
private:
void FillList(QComboBox *box, const QMap<QString, quint32> &list)const;

View File

@ -65,8 +65,6 @@ DialogTriangle::DialogTriangle(const VContainer *data, const quint32 &toolId, QW
this, &DialogTriangle::PointNameChanged);
vis = new VisToolTriangle(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -69,8 +69,6 @@ DialogTrueDarts::DialogTrueDarts(const VContainer *data, const quint32 &toolId,
this, &DialogTrueDarts::PointNameChanged);
vis = new VisToolTrueDarts(data);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -43,8 +43,6 @@ DialogUnionDetails::DialogUnionDetails(const VContainer *data, const quint32 &to
{
ui->setupUi(this);
InitOkCancel(ui);
FixateSize();
}
//---------------------------------------------------------------------------------------------------------------------