Fixate size of the 'Config dialog' only after first show.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-11-17 12:54:18 +02:00
parent ab526a54b4
commit 974a074ffd
2 changed files with 24 additions and 2 deletions

View file

@ -38,7 +38,7 @@
//---------------------------------------------------------------------------------------------------------------------
ConfigDialog::ConfigDialog(QWidget *parent) :
QDialog(parent), contentsWidget(nullptr), pagesWidget(nullptr), configurationPage(nullptr), patternPage(nullptr),
communityPage(nullptr), pathPage(nullptr)
communityPage(nullptr), pathPage(nullptr), isInitialized(false)
{
contentsWidget = new QListWidget;
contentsWidget->setViewMode(QListView::IconMode);
@ -92,7 +92,6 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
setWindowTitle(tr("Config Dialog"));
this->setFixedSize(QSize(750, 565));
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
}
@ -116,6 +115,27 @@ void ConfigDialog::closeEvent(QCloseEvent *event)
event->accept();
}
//---------------------------------------------------------------------------------------------------------------------
void ConfigDialog::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 ConfigDialog::createIcons()
{

View file

@ -47,6 +47,7 @@ signals:
void UpdateProperties();
protected:
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(ConfigDialog)
QListWidget *contentsWidget;
@ -55,6 +56,7 @@ private:
PatternPage *patternPage;
CommunityPage *communityPage;
PathPage *pathPage;
bool isInitialized;
void createIcons();
void createIcon(const QString &icon, const QString &text);
void Apply();