[Qt-interest] QTableWidget messing up tab navigation
Malyushytsky, Alex
alex at wai.com
Tue Oct 18 00:30:15 CEST 2011
If you set cell widget to cell it may break navigation, cause such widget may handle keyPressEvent and such event will be ignored by the cell.
Similarly when such widgets gets the focus (for example by mouse click) currentCell will not be set.
If not mistaken I had similar problems a while ago and handled it by installing an event handler which in case focus In event
called table->setCurrentCell for appropriate cell and changed behavior for the buttons depending on the cell widget.
An alternative is to write subclasses of the widgets you want to work in the QTableWidget so they do not break navigation or ( I would recommend) subclass QTablWidgetItem.
In the same event handler you can decide what happens for the specific key ( "key insert a new row when I press that at the end of the row in last row").
Regards,
Alex
From: qt-interest-bounces+alex=wai.com at qt.nokia.com [mailto:qt-interest-bounces+alex=wai.com at qt.nokia.com] On Behalf Of Daniel França
Sent: Monday, October 17, 2011 6:11 AM
To: qt-interest
Subject: Re: [Qt-interest] QTableWidget messing up tab navigation
anyone?
2011/10/13 Daniel França <daniel.franca at gmail.com<mailto:daniel.franca at gmail.com>>
More details:
I'm using some widgets in cells like QTimeEdit, QLine and QCheckBox.
Now I'd tried to set focus proxy for the widget of each cell, no success yet.
2011/10/13 Daniel França <daniel.franca at gmail.com<mailto:daniel.franca at gmail.com>>
Hi all,
I'm trying to use QTableWidget, but I got some problems.
first, I need that click change the tab navigation sequence.
For example, I'm editing a cell then I click at another cell, and then I do press TAB, I expect that tab go to the next field after the cell I just clicked, bu no, it's going to the next of the previous cell I was editing.
I tried to setFocusPolicy for Qt::StrongFocus both for QTableWidget and for each of the items, but with no success.
another thing, I wanna that TAB key insert a new row when I press that at the end of the row in last row.
but there's no signal like 'KeypressEvent', the only solutions I found was to create a class that inherits from QTableWidget (what I think is so much for so little) or to handle the EditingFinished signal, what is a workaround and may be not work as expect alll the time.
Thanks in advance,
Daniel França
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."
"Please consider our environment before printing this email."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111017/edc7ef21/attachment.html
More information about the Qt-interest-old
mailing list