[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: QT casts
From: Espen Sand <espensa () online ! no>
Date: 2000-03-01 17:24:31
[Download RAW message or body]
On Wed, 01 Mar 2000, Federico David Sacerdoti wrote:
> Hi,
>
> I'm using qt-copy from CVS, my question is in the comment below:
>
> #include <klocale.h>
> #include <qlayout.h>
> #include <qwidget.h>
>
> QVBoxLayout *speakLayout = new QVBoxLayout(splitter, 6);
> QVBoxLayout *listenLayout = new QVBoxLayout(splitter, 6);
>
> //Why do I have to do all these casts?
> QLabel *label = new QLabel((const QString &) i18n("&Speak"),(QWidget*)speakLayout);
You don't have to do the "(const QString &) i18n("&Speak")" cast , and the
"(QWidget*)speakLayout" cast is wrong. QVBoxLayout is a layout, not a widget
The QLayout is not derived from QWidget.
You must do something like this:
QWidget *widget = new QWidget(splitter);
QVBoxLayout *speakLayout = new QVBoxLayout(widget, 6);
QWdget *label = new QLabel( i18n("&Speak"), widget );
speakLayout->addWidget( label );
--
Espen Sand
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic