summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicswidget.cpp
diff options
context:
space:
mode:
authorAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-08-31 14:03:34 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-08-31 14:14:48 (GMT)
commit46624cfb90986e1977a539d279516bd5ade3675f (patch)
tree2454b0c367d126940e6b4d1020d4b9816a50e44d /src/gui/graphicsview/qgraphicswidget.cpp
parent62ca28a96d200fe55ed5bc2d0d1df327ab44c97e (diff)
downloadQt-46624cfb90986e1977a539d279516bd5ade3675f.zip
Qt-46624cfb90986e1977a539d279516bd5ade3675f.tar.gz
Qt-46624cfb90986e1977a539d279516bd5ade3675f.tar.bz2
Add auto-activation on show/hide and setParentItem().
If you show a child panel of an active panel, the child will now be activated and the parent deactivated. Hiding the child panel will reactive the parent. If the parent is 0, no other panel is activated. Reparenting a panel onto an active panel will also activate the (new) child. Reparenting away does not affect activation in any way. This change also fixes QGraphicsWidget::isActiveWindow(), which returned true for all toplevel widgets (not in a panel/window). This is wrong; either the non-panel items are active, or a panel is active. The correct behavior is the same as calling QGraphicsItem::isActive(). Fixed the autotests (which wrongly tested that both a panel and a non-panel item were active at the same time). This change causes popups (QGraphics{Proxy,}Widget) to deactivate the parent widget. On the positive side this activates the popup, and ensures that the parent regains proper focus when the popup is closed. However it also means the parent widget is inactive while the popup is open, which (e.g.) causes editable combobox line edit cursors to stop blinking. This is to be fixed soon, but the fix is a bit big so we'll do that later. Autotests included. Reviewed-by: Brad
Diffstat (limited to 'src/gui/graphicsview/qgraphicswidget.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 9972223..afabf49 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -1665,11 +1665,7 @@ void QGraphicsWidget::setWindowFlags(Qt::WindowFlags wFlags)
*/
bool QGraphicsWidget::isActiveWindow() const
{
- Q_D(const QGraphicsWidget);
- if (!d->scene)
- return false;
- const QGraphicsWidget *w = window();
- return (!w && d->scene->isActive()) || (w && d->scene->activeWindow() == w);
+ return isActive();
}
/*!