Skip to content
Permalink
Browse files

Fix color widget opens in wrong panel (fix #15705)

(cherry-picked from 721d3c5)
  • Loading branch information
nyalldawson committed Oct 17, 2016
1 parent 979d619 commit e15c93d0539476c52cdc42db6a4281e1bea2eb8e
Showing with 14 additions and 1 deletion.
  1. +7 −0 src/gui/qgspanelwidget.cpp
  2. +7 −1 tests/src/python/test_qgspanelwidget.py
@@ -55,6 +55,13 @@ QgsPanelWidget*QgsPanelWidget::findParentPanel( QWidget* widget )
if ( QgsPanelWidget* panel = qobject_cast< QgsPanelWidget* >( p ) )
return panel;

if ( p->window() == p )
{
// break on encountering a window - eg a dialog opened from a panel should not inline
// widgets inside the parent panel
return nullptr;
}

p = p->parentWidget();
}
return nullptr;
@@ -14,7 +14,7 @@

import qgis # NOQA

from qgis.PyQt.QtWidgets import QWidget
from qgis.PyQt.QtWidgets import QWidget, QDialog
from qgis.gui import QgsPanelWidget
from qgis.testing import start_app, unittest

@@ -49,6 +49,12 @@ def testFindParentPanel(self):
w5 = QWidget(w4)
self.assertEqual(QgsPanelWidget.findParentPanel(w5), w3)

# chain should be broken when a new window is encountered
n = QgsPanelWidget()
n2 = QDialog(n)
n3 = QWidget(n2)
self.assertFalse(QgsPanelWidget.findParentPanel(n3))


if __name__ == '__main__':
unittest.main()

0 comments on commit e15c93d

Please sign in to comment.
You can’t perform that action at this time.