[Qt-interest] Fwd: widget promotion
ami guru
dosto.walla at gmail.com
Sat Dec 27 16:11:37 CET 2008
Hello Andreas,
Thanks for the help.
It did work.
But i need to clear up some confusion.
I have myClass as a subclass of QGraphicsView.
Now if i want to use myClass as a widget in the designer
then is that must i have to use QGraphicsView as a place-holder.
Lets try to analyze to the what you have suggested.
class H3DNodeView : public QGraphicsView
{
H3DNodeView(QWidget *parent) : QGraphicsView(parent)
{
}
};
I opended the ui_***.h file found as follows:
//my custimized class
H3DNodeView *graphicsView;
treeViewH3D = new QTreeView(centralwidget);
the constructor takes a pointer to the QWidget and
set that as the parent of the QGraphicsView and that makes sense.
Is there anything i missed in the concept?
Regards
Sajjad
---------- Forwarded message ----------
From: Andreas Pakulat <apaku at gmx.de>
Date: Sat, Dec 27, 2008 at 2:17 PM
Subject: Re: [Qt-interest] widget promotion
To: qt-interest at trolltech.com
On 27.12.08 14:05:44, ami guru wrote:
> I have customized class with QGaphicsView as a base class .
>
> In the designer i have a main window and dragged a QGraphicsView
> widget and placed that in the form to use that as the placeholder.
>
> Then i promoted that to my customized one.
>
> The customized class that i have has a constructor.
>
> What should be the defualt parameter in the constructor
>
> ********************************************************'
> class H3DNodeView : public QGraphicsView
> {
> H3DNodeView(QWidget *parent = 0);
> };
>
> ****************************************************************'
>
> In that case i have error
>
> H3DNodeView.cpp: In constructor 'H3DNodeView::H3DNodeView(QWidget*)':
> H3DNodeView.cpp:5: error: type 'QWidget' is not a direct base of
> 'H3DNodeView'
Your constructor implementation is wrong, apparently you're using
H3DNodeView::H3DNodeView( QWidget* parent )
: QWidget(parent)
But it should be QGraphicsView in the second line.
Andreas
--
You will soon forget this.
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20081227/ae83a185/attachment.html
More information about the Qt-interest-old
mailing list