[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Composed widget
From: Gábor_Lehel <illissius () gmail ! com>
Date: 2006-01-29 16:32:28
Message-ID: 9cfeadb80601290832s17e900f8yaa7a6362bbe0d192 () mail ! gmail ! com
[Download RAW message or body]
On 1/29/06, Thomas Baumgart <ipwizard@users.sourceforge.net> wrote:
> Hi all,
>
> within our KDE application (KMyMoney) we have a special widget
> (KMyMoneyEdit) that is composed of a KLineEdit and KPushButton widget.
> They are arranged as follows:
>
> +-HBox-------------+
> |+-KLEdit---++-PB-+|
> || || ||
> |+----------++----+|
> +------------------+
>
> Currently, we have the KMyMoneyEdit widget being a derivative of QHBox and
> create the KLineEdit and KPushButton within the constructor. This has the
> disadvantage, that the interface of our widget is not based on KLineEdit
> but rather on QHBox. It would make much more sense, that KMyMoneyEdit has
> the same interface as KLineEdit.
>
> Is there an easy way to derive KMyMoneyEdit from KLineEdit with the above
> mentioned layout? How would that be coded?
Perhaps something like:
class MyWidget: public KLineEdit
{
MyWidget( QWidget *parent = 0, const char *name = 0 )
: KLineEdit( new QHBox( parent ), name )
{
new KPushButton( parent() );
}
};
Note that I haven't actually tried this, and there may be a cleaner solution.
(Such as just providing KLineEdit *lineEdit() const { return
m_lineEdit; } in a class derived from QHBox.)
--
Work is punishment for failing to procrastinate effectively.
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic