mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Fixed a bug in restoreStateFromXml function
The function accessed the objectName from the CentralWidget even if there is no cental widget
This commit is contained in:
parent
f543318232
commit
5fad43377b
@ -280,22 +280,25 @@ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int versi
|
||||
#endif
|
||||
ADS_PRINT(DockContainers);
|
||||
|
||||
const auto CentralWidgetAttribute = s.attributes().value("CentralWidget");
|
||||
// If we have a central widget but a state without central widget, then
|
||||
// something is wrong.
|
||||
if (CentralWidget && CentralWidgetAttribute.isEmpty())
|
||||
{
|
||||
qWarning() << "Dock manager has central widget but saved state does not have central widget.";
|
||||
return false;
|
||||
}
|
||||
if (CentralWidget)
|
||||
{
|
||||
const auto CentralWidgetAttribute = s.attributes().value("CentralWidget");
|
||||
// If we have a central widget but a state without central widget, then
|
||||
// something is wrong.
|
||||
if (CentralWidgetAttribute.isEmpty())
|
||||
{
|
||||
qWarning() << "Dock manager has central widget but saved state does not have central widget.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the object name of the central widget does not match the name of the
|
||||
// saved central widget, the something is wrong
|
||||
if (CentralWidget->objectName() != CentralWidgetAttribute.toString())
|
||||
{
|
||||
qWarning() << "Object name of central widget does not match name of central widget in saved state.";
|
||||
return false;
|
||||
}
|
||||
// If the object name of the central widget does not match the name of the
|
||||
// saved central widget, the something is wrong
|
||||
if (CentralWidget->objectName() != CentralWidgetAttribute.toString())
|
||||
{
|
||||
qWarning() << "Object name of central widget does not match name of central widget in saved state.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int DockContainerCount = 0;
|
||||
while (s.readNextStartElement())
|
||||
|
Loading…
Reference in New Issue
Block a user