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

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-11-18 11:03:19 +02:00
parent 0473db2947
commit 9ce9f45cd3
2 changed files with 25 additions and 3 deletions

View File

@ -44,10 +44,9 @@ TapeConfigDialog::TapeConfigDialog(QWidget *parent)
pathPage(nullptr), pathPage(nullptr),
applyButton(nullptr), applyButton(nullptr),
canselButton(nullptr), canselButton(nullptr),
okButton(nullptr) okButton(nullptr),
isInitialized(false)
{ {
this->setMaximumHeight(300);
contentsWidget = new QListWidget; contentsWidget = new QListWidget;
contentsWidget->setViewMode(QListView::IconMode); contentsWidget->setViewMode(QListView::IconMode);
contentsWidget->setIconSize(QSize(96, 84)); contentsWidget->setIconSize(QSize(96, 84));
@ -133,6 +132,27 @@ void TapeConfigDialog::changeEvent(QEvent *event)
QDialog::changeEvent(event); QDialog::changeEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void TapeConfigDialog::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 TapeConfigDialog::createIcons() void TapeConfigDialog::createIcons()
{ {

View File

@ -49,6 +49,7 @@ signals:
protected: protected:
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE; virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
private: private:
Q_DISABLE_COPY(TapeConfigDialog) Q_DISABLE_COPY(TapeConfigDialog)
QListWidget *contentsWidget; QListWidget *contentsWidget;
@ -58,6 +59,7 @@ private:
QPushButton *applyButton; QPushButton *applyButton;
QPushButton *canselButton; QPushButton *canselButton;
QPushButton *okButton; QPushButton *okButton;
bool isInitialized;
void createIcons(); void createIcons();
void createIcon(const QString &icon, const QString &text); void createIcon(const QString &icon, const QString &text);