Qt-interest Archive, June 2007
"setHidden" slot working with QTabWidet where as Not with QLabel etc in V 4.1.1
Message 1 in thread
Hi .
I m trying to use "setHidden" slot of the following widgets but to my surprise this SAME slot is working fine with QTabWidget and QToolButton but in NO way working with QTextEdit or QLabel. I have to comment those lines to remove the errors. Can anyone plzz give me what is the mistake that I am doing or is it that this slot is not permitted with these widgets??
Thanks n Regards
Ritesh
I m enclosing the relevent code. Here userPicLabel (QLabel), stickyNote (QTextEdit) and topRightLayout (QVBoxLayout )are not working (so have to keep them in comment) while tabWidget, letters, chatWindow and slideButton (QToolButton) are working fine with this "setHidden" slot.
WidgetGallery::WidgetGallery(const QString &fileName, QWidget *parent)
: QDialog(parent)
{
.
.
tabWidget = new QTabWidget;
.
.
letters = new QTabWidget;
chatWindow = new QTabWidget;
.
.
QTextEdit *stickyNote = new QTextEdit;
.
.
QLabel *userPicLabel = new QLabel;
userPicLabel->setPixmap(QPixmap("./images/musicboysmall.jpg"));
.
.
slideButton = new QToolButton(this);
connect(slideButton, SIGNAL(clicked()), this, SLOT(slide()));
.
.
QVBoxLayout *topRightLayout = new QVBoxLayout;
topRightLayout->addWidget(userPicLabel);
topRightLayout->addWidget(letters);
topRightLayout->addWidget(chatWindow);
topRightLayout->addWidget(stickyNote);
.
.
}
void WidgetGallery::slide()
{
letters->setHidden(true);
chatWindow->setHidden(true);
// userPicLabel->setHidden(true);
slideButton->setHidden(true);
// stickyNote->setHidden(true);
// topRightLayout->setHidden(true);
tabWidget->setMinimumSize(720, 530);
}
---------------------------------
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.
Message 2 in thread
Raja Raja schrieb:
> I m trying to use "setHidden" slot of the following widgets but to my
> surprise this SAME slot is working fine with QTabWidget and QToolButton
> but in NO way working with QTextEdit or QLabel. I have to comment those
> lines to remove the errors. Can anyone plzz give me what is the mistake
> that I am doing or is it that this slot is not permitted with these
> widgets??
Take a closer look at the class hierarchy and the inherited methods of
the classes you use. setHidden() is declared by QWidget, but QLabel is a
QFrame child, and QTextEdit is QAbstractScrollArea -> QFrame, too.
However, they all provide the hide() and show() methods.
The link to "List of all members, including inherited members" in every
classes doc is very useful for this :-)
BTW, you didn't provide the errors you got. Including these could be
useful for helping you. I guess they're simply saying "setHidden() not a
member of class X", which is appropriate indeed...
Martin
--
[ signature omitted ]
Message 3 in thread
> Take a closer look at the class hierarchy and the inherited methods of
> the classes you use. setHidden() is declared by QWidget, but QLabel is a
> QFrame child, and QTextEdit is QAbstractScrollArea -> QFrame, too.
> However, they all provide the hide() and show() methods.
Okay, okay, QFrame is a child of QWidget, too. I just noticed. Still,
try hide() instead. And provide the error messages to get more detailed
help.
Martin "good night, I'm already in weekend"
--
[ signature omitted ]
Message 4 in thread
Hi Martin
Thanx a lot 4 ur support. I got it working. Got a seperate support from Ms Bindu. I just had to remove the second time declaration of the variables in the constructer and it worked.
Thanx again
Martin Gebert <Martin.Gebert@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Take a closer look at the class hierarchy and the inherited methods of
> the classes you use. setHidden() is declared by QWidget, but QLabel is a
> QFrame child, and QTextEdit is QAbstractScrollArea -> QFrame, too.
> However, they all provide the hide() and show() methods.
Okay, okay, QFrame is a child of QWidget, too. I just noticed. Still,
try hide() instead. And provide the error messages to get more detailed
help.
Martin "good night, I'm already in weekend"
--
[ signature omitted ]