forked from qt-creator/qt-creator
Increase category item spacing in settings dialog
This should give things a cleaner look.
This commit is contained in:
@@ -54,6 +54,7 @@
|
|||||||
#include <QtGui/QListView>
|
#include <QtGui/QListView>
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QGroupBox>
|
#include <QtGui/QGroupBox>
|
||||||
|
#include <QtGui/QStyledItemDelegate>
|
||||||
|
|
||||||
static const char categoryKeyC[] = "General/LastPreferenceCategory";
|
static const char categoryKeyC[] = "General/LastPreferenceCategory";
|
||||||
static const char pageKeyC[] = "General/LastPreferencePage";
|
static const char pageKeyC[] = "General/LastPreferencePage";
|
||||||
@@ -200,6 +201,19 @@ bool CategoryFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sou
|
|||||||
|
|
||||||
// ----------- Category list view
|
// ----------- Category list view
|
||||||
|
|
||||||
|
|
||||||
|
class CategoryListViewDelegate : public QStyledItemDelegate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CategoryListViewDelegate(QObject *parent) : QStyledItemDelegate(parent) {}
|
||||||
|
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
QSize size = QStyledItemDelegate::sizeHint(option, index);
|
||||||
|
size.setHeight(qMax(size.height(), 32));
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Special version of a QListView that has the width of the first column as
|
* Special version of a QListView that has the width of the first column as
|
||||||
* minimum size.
|
* minimum size.
|
||||||
@@ -210,6 +224,7 @@ public:
|
|||||||
CategoryListView(QWidget *parent = 0) : QListView(parent)
|
CategoryListView(QWidget *parent = 0) : QListView(parent)
|
||||||
{
|
{
|
||||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
|
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
|
||||||
|
setItemDelegate(new CategoryListViewDelegate(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual QSize sizeHint() const
|
virtual QSize sizeHint() const
|
||||||
|
|||||||
Reference in New Issue
Block a user