PDA

View Full Version : Problem in setValue for QAccessibleWidget



Rakesh_Kumar
29th January 2009, 09:36
Hi,

I need to set value for the accessibility support to a QLabel. so I am trying it in the following way but it's not working for me. Could anyone please help me to resolve the problem.

I am creating the AccessibleLabel class as below:

class AccessibleLabel : public QLabel, public QAccessibleWidget
{

public:
AccessibleLabel(QLabel *q):QAccessibleWidget(q,QAccessible::StaticText)
{
}

void SetValueDerived(const QString &value)
{
setValue(value);
}

~AccessibleLabel()
{
}
};

Then I am creating the label as below:

m_pLabel = new QLabel();
m_pLabel->setFrameStyle(QFrame::Panel | QFrame::Plain);
m_pLabel->setAccessibleName(p_AccesibleName);
m_pLabel->setAccessibleDescription(p_AccesibleDescription);
m_pLabel->setAlignment(Qt::AlignJustify | Qt::AlignHCenter);
m_pLabel->setMouseTracking(true);
m_pLabel->setAttribute(Qt::WA_Hover);
m_pLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum);


Then I am setting the value like below:

m_pAccLabel = new AccessibleLabel(m_pLabel);
m_pAccLabel->SetValueDerived(QString(QLatin1String("Week")));


But it's not giving me the value.

Please help me to resolve the issue.

Thanks in advance.

Regards
Rakesh