forked from qt-creator/qt-creator
VariableChooser: Create widgets before assigning models
With Qt 5.7 the currentChanged() callback is called immediately on QTreeView::setModel(), which leads to the label text being set. That crashes if the label hasn't been created, yet. Change-Id: I73763e1ac1c86215090a8f4b0118bc0cd286cf47 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -245,9 +245,9 @@ VariableChooserPrivate::VariableChooserPrivate(VariableChooser *parent)
|
||||
m_defaultDescription = VariableChooser::tr("Select a variable to insert.");
|
||||
|
||||
m_variableTree = new VariableTreeView(q, this);
|
||||
m_variableTree->setModel(&m_model);
|
||||
|
||||
m_variableDescription = new QLabel(q);
|
||||
|
||||
m_variableTree->setModel(&m_model);
|
||||
m_variableDescription->setText(m_defaultDescription);
|
||||
m_variableDescription->setMinimumSize(QSize(0, 60));
|
||||
m_variableDescription->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
||||
|
||||
Reference in New Issue
Block a user