[prev in list] [next in list] [prev in thread] [next in thread]
List: calligra-devel
Subject: Re: Ownership of a widget.
From: Cyrille Berger Skott <cberger () cberger ! net>
Date: 2013-02-09 20:06:10
Message-ID: 201302092106.10268.cberger () cberger ! net
[Download RAW message or body]
On Saturday 09 Feb 2013, Inge Wallin, Lysator wrote:
> But who should own the widget? Can the docker continue to own the widget
> even though it physically resides inside the statusbar? somebody must
> control the widget when it moves from one location to the other and I
> don't think it's obvious who that somebody is.
Nope. A QWidget is owned by its parent, and when you have a widget that need
to be shown inside an other widget, then it has to be owned by that widget.
From Qt's documentation:
"Top-Level and Child Widgets
A widget without a parent widget is always an independent window (top-level
widget). For these widgets, setWindowTitle() and setWindowIcon() set the title
bar and icon respectively.
Non-window widgets are child widgets, displayed within their parent widgets.
Most widgets in Qt are mainly useful as child widgets. For example, it is
possible to display a button as a top-level window, but most people prefer to
put their buttons inside other widgets, such as QDialog.
"
> Does anybody have an idea? I can give more details but my train leaves now
> so I need to go now.
Euh yea, have two instance of your widget, one for the docker and one for the
status bar. Having a widget that "jumps" between parents is a call for
breakage, maintenance nightmare, bugs and crashes.
--
Cyrille Berger Skott
_______________________________________________
calligra-devel mailing list
calligra-devel@kde.org
https://mail.kde.org/mailman/listinfo/calligra-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic