missing initialization of the buttonBox fixed
This commit is contained in:
parent
8a97403343
commit
c2ca7fd200
|
@ -56,7 +56,7 @@ void QskDialogSubWindow::addDialogAction( QskDialog::Action action )
|
||||||
if ( action != QskDialog::NoAction )
|
if ( action != QskDialog::NoAction )
|
||||||
{
|
{
|
||||||
if ( m_data->buttonBox == nullptr )
|
if ( m_data->buttonBox == nullptr )
|
||||||
m_data->buttonBox = createButtonBox();
|
initButtonBox();
|
||||||
|
|
||||||
if ( m_data->buttonBox )
|
if ( m_data->buttonBox )
|
||||||
m_data->buttonBox->addAction( action );
|
m_data->buttonBox->addAction( action );
|
||||||
|
@ -69,7 +69,7 @@ void QskDialogSubWindow::addDialogButton(
|
||||||
if ( button )
|
if ( button )
|
||||||
{
|
{
|
||||||
if ( m_data->buttonBox == nullptr )
|
if ( m_data->buttonBox == nullptr )
|
||||||
m_data->buttonBox = createButtonBox();
|
initButtonBox();
|
||||||
|
|
||||||
if ( m_data->buttonBox )
|
if ( m_data->buttonBox )
|
||||||
m_data->buttonBox->addButton( button, actionRole );
|
m_data->buttonBox->addButton( button, actionRole );
|
||||||
|
@ -100,27 +100,14 @@ void QskDialogSubWindow::setDialogActions( QskDialog::Actions actions )
|
||||||
this, &QskDialogSubWindow::reject );
|
this, &QskDialogSubWindow::reject );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_data->buttonBox = nullptr;
|
m_data->buttonBox = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( m_data->buttonBox == nullptr )
|
if ( m_data->buttonBox == nullptr )
|
||||||
{
|
{
|
||||||
m_data->buttonBox = createButtonBox();
|
initButtonBox();
|
||||||
|
|
||||||
if ( m_data->buttonBox )
|
|
||||||
{
|
|
||||||
m_data->buttonBox->setParentItem( this );
|
|
||||||
if ( m_data->buttonBox->parent() == nullptr )
|
|
||||||
m_data->buttonBox->setParent( this );
|
|
||||||
|
|
||||||
connect( m_data->buttonBox, &QskDialogButtonBox::accepted,
|
|
||||||
this, &QskDialogSubWindow::accept, Qt::UniqueConnection );
|
|
||||||
|
|
||||||
connect( m_data->buttonBox, &QskDialogButtonBox::rejected,
|
|
||||||
this, &QskDialogSubWindow::reject, Qt::UniqueConnection );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_data->buttonBox )
|
if ( m_data->buttonBox )
|
||||||
|
@ -192,7 +179,7 @@ QMarginsF QskDialogSubWindow::contentPadding() const
|
||||||
void QskDialogSubWindow::setDefaultDialogAction( QskDialog::Action action )
|
void QskDialogSubWindow::setDefaultDialogAction( QskDialog::Action action )
|
||||||
{
|
{
|
||||||
QskPushButton* button = nullptr;
|
QskPushButton* button = nullptr;
|
||||||
|
|
||||||
if ( m_data->buttonBox )
|
if ( m_data->buttonBox )
|
||||||
button = m_data->buttonBox->button( action );
|
button = m_data->buttonBox->button( action );
|
||||||
|
|
||||||
|
@ -223,12 +210,12 @@ QskPushButton* QskDialogSubWindow::defaultButton() const
|
||||||
QskDialogButtonBox* QskDialogSubWindow::buttonBox()
|
QskDialogButtonBox* QskDialogSubWindow::buttonBox()
|
||||||
{
|
{
|
||||||
return m_data->buttonBox;
|
return m_data->buttonBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QskDialogButtonBox* QskDialogSubWindow::buttonBox() const
|
const QskDialogButtonBox* QskDialogSubWindow::buttonBox() const
|
||||||
{
|
{
|
||||||
return m_data->buttonBox;
|
return m_data->buttonBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
QskDialog::Action QskDialogSubWindow::clickedAction() const
|
QskDialog::Action QskDialogSubWindow::clickedAction() const
|
||||||
{
|
{
|
||||||
|
@ -236,7 +223,7 @@ QskDialog::Action QskDialogSubWindow::clickedAction() const
|
||||||
return m_data->buttonBox->clickedAction();
|
return m_data->buttonBox->clickedAction();
|
||||||
|
|
||||||
return QskDialog::NoAction;
|
return QskDialog::NoAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskDialogSubWindow::setResult( QskDialog::DialogCode result )
|
void QskDialogSubWindow::setResult( QskDialog::DialogCode result )
|
||||||
{
|
{
|
||||||
|
@ -328,6 +315,25 @@ QskDialogButtonBox* QskDialogSubWindow::createButtonBox()
|
||||||
return new QskDialogButtonBox();
|
return new QskDialogButtonBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QskDialogSubWindow::initButtonBox()
|
||||||
|
{
|
||||||
|
m_data->buttonBox = createButtonBox();
|
||||||
|
|
||||||
|
if ( m_data->buttonBox )
|
||||||
|
{
|
||||||
|
m_data->buttonBox->setParentItem( this );
|
||||||
|
|
||||||
|
if ( m_data->buttonBox->parent() == nullptr )
|
||||||
|
m_data->buttonBox->setParent( this );
|
||||||
|
|
||||||
|
connect( m_data->buttonBox, &QskDialogButtonBox::accepted,
|
||||||
|
this, &QskDialogSubWindow::accept, Qt::UniqueConnection );
|
||||||
|
|
||||||
|
connect( m_data->buttonBox, &QskDialogButtonBox::rejected,
|
||||||
|
this, &QskDialogSubWindow::reject, Qt::UniqueConnection );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QskDialogSubWindow::aboutToShow()
|
void QskDialogSubWindow::aboutToShow()
|
||||||
{
|
{
|
||||||
if ( size().isEmpty() )
|
if ( size().isEmpty() )
|
||||||
|
|
|
@ -30,7 +30,7 @@ class QSK_EXPORT QskDialogSubWindow : public QskSubWindow
|
||||||
|
|
||||||
void addDialogAction( QskDialog::Action );
|
void addDialogAction( QskDialog::Action );
|
||||||
void addDialogButton( QskPushButton*, QskDialog::ActionRole );
|
void addDialogButton( QskPushButton*, QskDialog::ActionRole );
|
||||||
|
|
||||||
Q_INVOKABLE QskDialog::Action clickedAction() const;
|
Q_INVOKABLE QskDialog::Action clickedAction() const;
|
||||||
|
|
||||||
Q_INVOKABLE QskDialog::DialogCode result() const;
|
Q_INVOKABLE QskDialog::DialogCode result() const;
|
||||||
|
@ -48,7 +48,7 @@ class QSK_EXPORT QskDialogSubWindow : public QskSubWindow
|
||||||
QQuickItem* contentItem() const;
|
QQuickItem* contentItem() const;
|
||||||
|
|
||||||
// padding around the contentItem
|
// padding around the contentItem
|
||||||
void setContentPadding( const QMarginsF & );
|
void setContentPadding( const QMarginsF& );
|
||||||
QMarginsF contentPadding() const;
|
QMarginsF contentPadding() const;
|
||||||
|
|
||||||
qreal heightForWidth( qreal width ) const override;
|
qreal heightForWidth( qreal width ) const override;
|
||||||
|
@ -76,6 +76,8 @@ class QSK_EXPORT QskDialogSubWindow : public QskSubWindow
|
||||||
virtual QskDialogButtonBox* createButtonBox();
|
virtual QskDialogButtonBox* createButtonBox();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void initButtonBox();
|
||||||
|
|
||||||
class PrivateData;
|
class PrivateData;
|
||||||
std::unique_ptr< PrivateData > m_data;
|
std::unique_ptr< PrivateData > m_data;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue