QT UI编程细节(待续)

来源:互联网 发布:javascript代码规范 编辑:程序博客网 时间:2024/03/29 23:34

1.  设置QTableView中只能选择单行

     setSelectionMode(QAbstractItemView::SingleSelection);

2. 设置以行做为选中的最小单位

    setSelectionBehavior(QAbstractItemView::SelectRows);

3.设置最后一行或最后一列拉伸

     horizontalHeader()->setStretchLastSection(true);

4. 设置行高

     verticalHeader()->setDefaultSectionSize(7);

5. 通过QSqlTableModel设置单元格数据

    model->setData(curIndex, dataValue);

6. 设置单元格进入编辑状态

    model->edit(curIndex);

7. 设置鼠标跟随

    setMouseTracking(true);

   

0 0