Qt-interest Archive, May 2008
Facing a strange problem with QTreeWidget
Message 1 in thread
Hello All
Greetings!!
Actually I am trying to create a simple tree widget inside a window which is
derived from QWidget class. But it is not getting displayed.
Can some body tell me what is the problem in the code below !!
Thanks a lot
Rohit
/***************************************************************************
*
**
***************************************************************************/
#include "componentstree.h"
ComponentsTree::ComponentsTree(QWidget *parent)
{
addComponents();
}
ComponentsTree::~ComponentsTree ()
{
}
void ComponentsTree::addComponents()
{
QVBoxLayout *vLayout = new QVBoxLayout(this);
QHBoxLayout *hLayout = new QHBoxLayout();
treeWidget = new QTreeWidget(this);
treeWidget->setColumnCount(1);
vLayout->addLayout(hLayout);
vLayout->addWidget(treeWidget);
boolControl = new QTreeWidgetItem(treeWidget);
boolControl->setText(0,tr("Bool Control"));
setLayout(vLayout);
}
/////////////////////////////////////////////////////////////
"componentstree.h "file
////////////////////////////////////////////////////////////////////////////
/////////////
#ifndef COMPONENTSTREE_H
#define COMPONENTSTREE_H
#include "QTreeWidget"
#include "QWidget"
#include "QVBoxLayout"
#include "QHBoxLayout"
class ComponentsTree : public QWidget
{
public:
ComponentsTree(QWidget *parent = 0);
~ComponentsTree();
private :
void addComponents();
QTreeWidgetItem *boolControl;
QTreeWidget *treeWidget;
};
#endif
Message 2 in thread
Rohit wrote:
> Hello All
> Greetings!!
> Actually I am trying to create a simple tree widget inside a window
> which is derived from QWidget class. But it is not getting displayed.
> Can some body tell me what is the problem in the code below !!
> Thanks a lot
> Rohit
[...]
Try calling treeWidget->show() in your main() function, perhaps?
--
[ signature omitted ]
Message 3 in thread
Kavindra Palaraja wrote:
> Rohit wrote:
>> Hello All
>> Greetings!!
>> Actually I am trying to create a simple tree widget inside a window
>> which is derived from QWidget class. But it is not getting displayed.
>> Can some body tell me what is the problem in the code below !!
>> Thanks a lot
>> Rohit
> [...]
>
> Try calling treeWidget->show() in your main() function, perhaps?
>
On second thoughts,
add "treeWidget->show()" after this line:
setLayout(vLayout);
--
[ signature omitted ]
Message 4 in thread
Thanks for the reply Kavindra,
But it is still not working with show();......
-----Original Message-----
From: Kavindra Palaraja [mailto:kdpalara@xxxxxxxxxxxxx]
Sent: Friday, May 30, 2008 5:10 PM
To: Qt-interest
Subject: Re: Facing a strange problem with QTreeWidget
Kavindra Palaraja wrote:
> Rohit wrote:
>> Hello All
>> Greetings!!
>> Actually I am trying to create a simple tree widget inside a window
>> which is derived from QWidget class. But it is not getting displayed.
>> Can some body tell me what is the problem in the code below !!
>> Thanks a lot
>> Rohit
> [...]
>
> Try calling treeWidget->show() in your main() function, perhaps?
>
On second thoughts,
add "treeWidget->show()" after this line:
setLayout(vLayout);
--
[ signature omitted ]
Message 5 in thread
Rohit wrote:
> Thanks for the reply Kavindra,
>
> But it is still not working with show();......
>
Could I have a look at your main() function?
--
[ signature omitted ]
Message 6 in thread
Try calling show() in addComponents() after the call
setLayout(vLayout), as below:
void ComponentsTree::addComponents()
{
.........
...............
setLayout(vLayout);
show();
}
On 30-May-08, at 5:33 PM, Rohit wrote:
> Thanks for the reply Kavindra,
>
> But it is still not working with show();......
>
> -----Original Message-----
> From: Kavindra Palaraja [mailto:kdpalara@xxxxxxxxxxxxx]
> Sent: Friday, May 30, 2008 5:10 PM
> To: Qt-interest
> Subject: Re: Facing a strange problem with QTreeWidget
>
> Kavindra Palaraja wrote:
>> Rohit wrote:
>>> Hello All
>>> Greetings!!
>>> Actually I am trying to create a simple tree widget inside a window
>>> which is derived from QWidget class. But it is not getting
>>> displayed.
>>> Can some body tell me what is the problem in the code below !!
>>> Thanks a lot
>>> Rohit
>> [...]
>>
>> Try calling treeWidget->show() in your main() function, perhaps?
>>
>
> On second thoughts,
>
> add "treeWidget->show()" after this line:
> setLayout(vLayout);
>
> --
> Kavindra Palaraja - kdpalara at trolltech.com
> Trolltech ASA - Sandakerveien 116, NO-0484 Oslo, Norway
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
DISCLAIMER
âThe information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you"