[Qt-interest] why is this not allowed?
Gabriele Kahlout
gabriele at mysimpatico.com
Tue May 11 07:21:12 CEST 2010
2010/5/11 Malyushytsky, Alex <alex at wai.com>
> It is up to your design your code to avoid to duplication.
>
> It has nothing to do with ability to copy QObject derived class.
>
> If you have sets of the controls which you use more than one time you can
> always derive from QWidget and add them there in layout you want , etc.
>
> Once you do it, instead of creating set of controls, create the widget.
>
> This way no code is duplicated.
>
>
>
Could you provide a more concrete example? In the code attached I had
created a Qwidget that contains others (related to login) but then as said
earlier this didn't solve very much passing it by reference to another
window, since when closed it may destroy it, destroying it for others.
Copying it was not an option too.
Copying would not solve your problem of reusing either.
>
> It is possible to reparent QWidget before its parent destroyed , or need
> to be shown, but it also means that you will not be able to have
>
> 2 widgets using your custom widget simultaneously. This way you might save
> time on the instantiating the object, but will complicate the design and
> limit functionality.
>
> So unless you really don’t have very time consuming initialization don’t do
> it.
>
>
>
> Regards,
>
> Alex
>
>
>
>
>
> *From:* qt-interest-bounces at trolltech.com [mailto:
> qt-interest-bounces at trolltech.com] *On Behalf Of *Gabriele Kahlout
> *Sent:* Monday, May 10, 2010 3:30 PM
> *To:* Ross Bencina
> *Cc:* qt-interest at trolltech.com
> *Subject:* Re: [Qt-interest] why is this not allowed?
>
>
>
> it's more challenging than that!
>
> I've tried your version, then extended it into a class, then passed a
> reference to the layout, then a copy ... Nothing achieves what I want.
>
> The issue is that I prefer not to return a reference so that windows that
> use it and close, don't destroy it, as seems to be the case. However I don't
> want a deep copy too =). I just want a shall one! Pointers to the widgets of
> the layout, but a copy of the layout?
>
> It's seems i'll just resort (no better solution) to duplicating these lines
> of code.
>
> I've attached a qt project illustrating the problem, should someone be
> interested in demonstrating a good solution.
>
> 2010/5/8 Ross Bencina <rossb-lists at audiomulch.com>
>
> QGridLayout *createLoginLayout() { /* create the layout and add the widgets
> */ }
>
>
>
>
> --
> Regards,
> K. Gabriele
>
> --- unchanged since 25/1/10 ---
> P.S. Unless a notification (LON), please reply either with an answer OR
> with " ACK" appended to this subject within 48 hours. Otherwise, I might
> resend.
> In(LON, this) ∨ In(48h, TimeNow) ∨ ∃x. In(x, MyInbox) ∧ IsAnswerTo(x,
> this) ∨ (In(subject(this), subject(x)) ∧ In(ACK, subject(x)) ∧¬IsAnswerTo(x,this))
> ⇒ ¬IResend(this).
>
> Also note that correspondence may be received only from specified a priori
> senders, or if the subject of this email ends with a code, eg. -LICHT01X,
> then also from senders whose reply contains it.
> ∀x. In(x, MyInbox) ⇒ In(senderAddress(x), MySafeSenderList) ∨ (∃y. In(y,
> subject(this) ) ∧ In(y,x) ∧ isCodeLike(y, -LICHT01X) ).
>
>
>
> ---------------------------------------------------------------------------------------------------
> Weidlinger Associates, Inc. made the following annotations.
>
> “This message and any attachments are solely for the intended recipient and
> may contain confidential or privileged information. If you are not the
> intended recipient, any disclosure, copying, use, or distribution of the
> information included in this message and any attachments is prohibited. If
> you have received this communication in error, please notify us by reply
> e-mail and immediately and permanently delete this message and any
> attachments. Thank you.”
>
> “Please consider our environment before printing this email.”
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
--
Regards,
K. Gabriele
--- unchanged since 25/1/10 ---
P.S. Unless a notification (LON), please reply either with an answer OR with
" ACK" appended to this subject within 48 hours. Otherwise, I might resend.
In(LON, this) ∨ In(48h, TimeNow) ∨ ∃x. In(x, MyInbox) ∧ IsAnswerTo(x, this)
∨ (In(subject(this), subject(x)) ∧ In(ACK, subject(x)) ∧
¬IsAnswerTo(x,this)) ⇒ ¬IResend(this).
Also note that correspondence may be received only from specified a priori
senders, or if the subject of this email ends with a code, eg. -LICHT01X,
then also from senders whose reply contains it.
∀x. In(x, MyInbox) ⇒ In(senderAddress(x), MySafeSenderList) ∨ (∃y. In(y,
subject(this) ) ∧ In(y,x) ∧ isCodeLike(y, -LICHT01X) ).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100511/ac59897c/attachment.html
More information about the Qt-interest-old
mailing list