diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/QtDialog/QCMakeCacheView.cxx | 21 | ||||
-rw-r--r-- | Source/QtDialog/QCMakeCacheView.h | 1 |
2 files changed, 18 insertions, 4 deletions
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index b98ffd3..d9b63c1 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -24,6 +24,7 @@ #include <QKeyEvent> #include <QSortFilterProxyModel> #include <QMetaProperty> +#include <QApplication> #include "QCMakeWidgets.h" @@ -139,10 +140,9 @@ QCMakeCacheView::QCMakeCacheView(QWidget* p) QCMakeCacheModelDelegate* delegate = new QCMakeCacheModelDelegate(this); this->setItemDelegate(delegate); - this->setEditTriggers(QAbstractItemView::DoubleClicked | - QAbstractItemView::SelectedClicked | - QAbstractItemView::EditKeyPressed | - QAbstractItemView::AnyKeyPressed); + this->setUniformRowHeights(true); + + this->setEditTriggers(QAbstractItemView::AllEditTriggers); // tab, backtab doesn't step through items this->setTabKeyNavigation(false); @@ -664,6 +664,19 @@ void QCMakeCacheModelDelegate::setModelData(QWidget* editor, const_cast<QCMakeCacheModelDelegate*>(this)->recordChange(model, index); } +QSize QCMakeCacheModelDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const +{ + QSize sz = QItemDelegate::sizeHint(option, index); + QStyle *style = QApplication::style(); + + // increase to checkbox size + QStyleOptionButton opt; + opt.QStyleOption::operator=(option); + sz = sz.expandedTo(style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt, NULL).size()); + + return sz; +} + QSet<QCMakeProperty> QCMakeCacheModelDelegate::changes() const { return mChanges; diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h index d5005d0..431cab0 100644 --- a/Source/QtDialog/QCMakeCacheView.h +++ b/Source/QtDialog/QCMakeCacheView.h @@ -150,6 +150,7 @@ public: const QStyleOptionViewItem& option, const QModelIndex& index); bool eventFilter(QObject* object, QEvent* event); void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index ) const; + QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const; QSet<QCMakeProperty> changes() const; void clearChanges(); |