197 void task259308_scrollVerticalHeaderSwappedSections(); |
197 void task259308_scrollVerticalHeaderSwappedSections(); |
198 void task191545_dragSelectRows(); |
198 void task191545_dragSelectRows(); |
199 void taskQTBUG_5062_spansInconsistency(); |
199 void taskQTBUG_5062_spansInconsistency(); |
200 void taskQTBUG_4516_clickOnRichTextLabel(); |
200 void taskQTBUG_4516_clickOnRichTextLabel(); |
201 void taskQTBUG_5237_wheelEventOnHeader(); |
201 void taskQTBUG_5237_wheelEventOnHeader(); |
|
202 void taskQTBUG_8585_crashForNoGoodReason(); |
|
203 void taskQTBUG_7774_RtoLVisualRegionForSelection(); |
|
204 void taskQTBUG_8777_scrollToSpans(); |
202 |
205 |
203 void mouseWheel_data(); |
206 void mouseWheel_data(); |
204 void mouseWheel(); |
207 void mouseWheel(); |
205 |
208 |
206 void addColumnWhileEditing(); |
209 void addColumnWhileEditing(); |
3946 QApplication::sendEvent(header->viewport(), &wheelEvent); |
3949 QApplication::sendEvent(header->viewport(), &wheelEvent); |
3947 int sbValueAfter = view.verticalScrollBar()->value(); |
3950 int sbValueAfter = view.verticalScrollBar()->value(); |
3948 QVERIFY(sbValueBefore != sbValueAfter); |
3951 QVERIFY(sbValueBefore != sbValueAfter); |
3949 } |
3952 } |
3950 |
3953 |
|
3954 class TestTableView : public QTableView { |
|
3955 Q_OBJECT |
|
3956 public: |
|
3957 TestTableView(QWidget *parent = 0) : QTableView(parent) |
|
3958 { |
|
3959 connect(this, SIGNAL(entered(const QModelIndex&)), this, SLOT(openEditor(const QModelIndex&))); |
|
3960 } |
|
3961 ~TestTableView(){} |
|
3962 public slots: |
|
3963 void onDataChanged() |
|
3964 { |
|
3965 for (int i = 0; i < model()->rowCount(); i++) { |
|
3966 setRowHidden(i, model()->data(model()->index(i, 0)).toBool()); |
|
3967 } |
|
3968 } |
|
3969 |
|
3970 void openEditor(const QModelIndex& index) |
|
3971 { openPersistentEditor(index); } |
|
3972 }; |
|
3973 |
|
3974 |
|
3975 void tst_QTableView::taskQTBUG_8585_crashForNoGoodReason() |
|
3976 { |
|
3977 QStandardItemModel model; |
|
3978 model.insertColumn(0, QModelIndex()); |
|
3979 for(int i = 0; i < 20; i++) |
|
3980 { |
|
3981 model.insertRow(i); |
|
3982 } |
|
3983 |
|
3984 TestTableView w; |
|
3985 w.setMouseTracking(true); |
|
3986 w.setModel(&model); |
|
3987 connect(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), &w, SLOT(onDataChanged())); |
|
3988 w.show(); |
|
3989 QTest::qWaitForWindowShown(&w); |
|
3990 for (int i = 0; i < 10; i++) |
|
3991 { |
|
3992 QTest::mouseMove(w.viewport(), QPoint(50, 20)); |
|
3993 w.model()->setData(w.indexAt(QPoint(50, 20)), true); |
|
3994 QTest::mouseMove(w.viewport(), QPoint(50, 25)); |
|
3995 } |
|
3996 } |
|
3997 |
|
3998 class TableView7774 : public QTableView |
|
3999 { |
|
4000 public: |
|
4001 QRegion visualRegionForSelection(const QItemSelection &selection) const |
|
4002 { |
|
4003 return QTableView::visualRegionForSelection(selection); |
|
4004 } |
|
4005 }; |
|
4006 |
|
4007 void tst_QTableView::taskQTBUG_7774_RtoLVisualRegionForSelection() |
|
4008 { |
|
4009 TableView7774 view; |
|
4010 QStandardItemModel model(5,5); |
|
4011 view.setModel(&model); |
|
4012 view.setLayoutDirection(Qt::RightToLeft); |
|
4013 view.show(); |
|
4014 QTest::qWaitForWindowShown(&view); |
|
4015 |
|
4016 QItemSelectionRange range(model.index(2, 0), model.index(2, model.columnCount() - 1)); |
|
4017 QItemSelection selection; |
|
4018 selection << range; |
|
4019 QRegion region = view.visualRegionForSelection(selection); |
|
4020 QCOMPARE(region.rects().at(0), view.visualRect(range.topLeft()) | view.visualRect(range.bottomRight())); |
|
4021 } |
|
4022 |
|
4023 void tst_QTableView::taskQTBUG_8777_scrollToSpans() |
|
4024 { |
|
4025 QTableWidget table(75,5); |
|
4026 for (int i=0; i<50; i++) |
|
4027 table.setSpan(2+i, 0, 1, 5); |
|
4028 table.setCurrentCell(0,2); |
|
4029 table.show(); |
|
4030 |
|
4031 for (int i = 0; i < 45; ++i) |
|
4032 QTest::keyClick(&table, Qt::Key_Down); |
|
4033 |
|
4034 QVERIFY(table.verticalScrollBar()->value() > 10); |
|
4035 } |
|
4036 |
3951 QTEST_MAIN(tst_QTableView) |
4037 QTEST_MAIN(tst_QTableView) |
3952 #include "tst_qtableview.moc" |
4038 #include "tst_qtableview.moc" |