Implement viewOptions logic in QTableViewPrivate.
This is similar to the patch 05aa8c6c12
which was applied to QListView.
Task-number: QTBUG-26548
Change-Id: I38ff07230673a93a32b01a7f1951d0378d94185b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
parent
1550c46179
commit
92c739cf50
@ -1290,14 +1290,20 @@ void QTableView::scrollContentsBy(int dx, int dy)
|
||||
}
|
||||
}
|
||||
|
||||
QStyleOptionViewItem QTableViewPrivate::viewOptions() const
|
||||
{
|
||||
QStyleOptionViewItem option = QAbstractItemViewPrivate::viewOptions();
|
||||
option.showDecorationSelected = true;
|
||||
return option;
|
||||
}
|
||||
|
||||
/*!
|
||||
\reimp
|
||||
*/
|
||||
QStyleOptionViewItem QTableView::viewOptions() const
|
||||
{
|
||||
QStyleOptionViewItem option = QAbstractItemView::viewOptions();
|
||||
option.showDecorationSelected = true;
|
||||
return option;
|
||||
Q_D(const QTableView);
|
||||
return d->viewOptions();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -150,6 +150,8 @@ public:
|
||||
void init();
|
||||
void trimHiddenSelections(QItemSelectionRange *range) const;
|
||||
|
||||
QStyleOptionViewItem viewOptions() const;
|
||||
|
||||
inline bool isHidden(int row, int col) const {
|
||||
return verticalHeader->isSectionHidden(row)
|
||||
|| horizontalHeader->isSectionHidden(col);
|
||||
|
@ -199,6 +199,7 @@ private slots:
|
||||
void task234926_setHeaderSorting();
|
||||
|
||||
void changeHeaderData();
|
||||
void viewOptions();
|
||||
};
|
||||
|
||||
// Testing get/set functions
|
||||
@ -477,6 +478,10 @@ public:
|
||||
return QTableView::sizeHintForRow(row);
|
||||
}
|
||||
|
||||
QStyleOptionViewItem viewOptions() const {
|
||||
return QTableView::viewOptions();
|
||||
}
|
||||
|
||||
bool checkSignalOrder;
|
||||
public slots:
|
||||
void currentChanged(QModelIndex , QModelIndex ) {
|
||||
@ -4074,5 +4079,12 @@ void tst_QTableView::taskQTBUG_10169_sizeHintForRow()
|
||||
QCOMPARE(orderedHeight, reorderedHeight);
|
||||
}
|
||||
|
||||
void tst_QTableView::viewOptions()
|
||||
{
|
||||
QtTestTableView view;
|
||||
QStyleOptionViewItem options = view.viewOptions();
|
||||
QVERIFY(options.showDecorationSelected);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QTableView)
|
||||
#include "tst_qtableview.moc"
|
||||
|
Loading…
Reference in New Issue
Block a user