想取消qtableview获取焦点的功能,查了qt4.1.0文档,仔细看了下,用setFocusPolicy设置
tableView->setFocusPolicy(Qt::NoFocus)
其中qt4.1.0文档关于enum Qt::FocusPolicy说明如下:
This enum type defines the various policies a widget can have with respect to acquiring keyboard focus.
Constant | Value | Description |
---|---|---|
Qt::TabFocus | 0x1 | the widget accepts focus by tabbing. |
Qt::ClickFocus | 0x2 | the widget accepts focus by clicking. |
Qt::StrongFocus | TabFocus | ClickFocus | 0x8 | the widget accepts focus by both tabbing and clicking. On Mac OS X this will also be indicate that the widget accepts tab focus when in 'Text/List focus mo |