Hello,
Environment:
Win7, Qt 4.6.3, E51/E71/Samsung i8910
I have a window with multiple custom widgets in QGridLayout. Each widget consists of several fields (e.g. QLineEdit or QLabel) with FocusPolicy set to Qt::NoFocus. The parent widgets FocusPolicy is set to Qt::StrongFocus.
On Nokia E51 and E71 I'm able to select a widget by using the navigation button. However, if I click the widget nothing happens. I'm unable to catch the mousePressEvent. On the other hand, if I compile the code for Windows 7 or use phone with a touch screen the event is raised and everything works fine.
code example:
.h
.cppCode:class MyWidget : public QWidget { Q_OBJECT public: explicit MyWidget(QWidget *parent = 0); private: QLabel *m_Title; QLineEdit *m_Value; protected: void mousePressEvent(QMouseEvent *event); public slots: void OnClicked(); };
Is there any way to implement the mousePressEvent with StrongFocus on older devices?Code:MyWidget::MyWidget(QWidget *parent) : QWidget(parent) { m_Title = new QLabel("test", this); m_Value = new QLineEdit(this); Initialize(); } void MdSettingBox::Initialize() { // layout items QGridLayout *layout = new QGridLayout(this); // focus policy m_Value->setFocusPolicy(Qt::NoFocus); m_Title->setFocusPolicy(Qt::NoFocus); setFocusPolicy(Qt::StrongFocus); // add items to layout layout->addWidget(m_Title, 0, 0, Qt::AlignLeft); layout->addWidget(m_Value, 1, 0, Qt::AlignRight); } void MdSettingBox::mousePressEvent(QMouseEvent *event) { OnClicked(); }




