summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/divelistview.cpp9
-rw-r--r--qt-ui/mainwindow.ui31
-rw-r--r--qt-ui/modeldelegates.cpp5
-rw-r--r--qt-ui/models.cpp4
-rw-r--r--subsurface.qrc2
5 files changed, 15 insertions, 36 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index 06b691c17..d77dd07aa 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -22,9 +22,18 @@
#include <QMenu>
#include <QFileDialog>
+class DiveListDelegate : public QStyledItemDelegate{
+public:
+ DiveListDelegate(){}
+ QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const {
+ return QSize(50,22);
+ }
+};
+
DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false),
sortColumn(0), currentOrder(Qt::DescendingOrder), searchBox(new QLineEdit(this))
{
+ setItemDelegate(new DiveListDelegate );
setUniformRowHeights(true);
setItemDelegateForColumn(DiveTripModel::RATING, new StarWidgetsDelegate());
QSortFilterProxyModel *model = new QSortFilterProxyModel(this);
diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui
index 2261b4d04..60aa787e4 100644
--- a/qt-ui/mainwindow.ui
+++ b/qt-ui/mainwindow.ui
@@ -95,37 +95,6 @@
<enum>Qt::Horizontal</enum>
</property>
<widget class="DiveListView" name="ListWidget">
- <property name="styleSheet">
- <string notr="true"> QTreeView {
- show-decoration-selected: 1;
- }
-
- QTreeView::item {
- border: 1px solid #d9d9d9;
- border-top-color: transparent;
- border-bottom-color: transparent;
- padding: 2px;
- }
-
- QTreeView::item:hover {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1);
- border: 1px solid #bfcde4;
- }
-
- QTreeView::item:selected {
- border: 1px solid #567dbc;
- }
-
- QTreeView::item:selected:active{
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6ea1f1, stop: 1 #567dbc);
- }
-
- QTreeView::item:selected:!active {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6b9be8, stop: 1 #577fbf);
- }
-
-</string>
- </property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp
index b4b24b266..6cb47945a 100644
--- a/qt-ui/modeldelegates.cpp
+++ b/qt-ui/modeldelegates.cpp
@@ -41,12 +41,13 @@ void StarWidgetsDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
return;
int rating = value.toInt();
+ int deltaY = option.rect.height()/2 - StarWidget::starActive().height() /2 ;
painter->save();
painter->setRenderHint(QPainter::Antialiasing, true);
for(int i = 0; i < rating; i++)
- painter->drawPixmap(option.rect.x() + i * IMG_SIZE + SPACING, option.rect.y(), StarWidget::starActive());
+ painter->drawPixmap(option.rect.x() + i * IMG_SIZE + SPACING, option.rect.y() + deltaY, StarWidget::starActive());
for(int i = rating; i < TOTALSTARS; i++)
- painter->drawPixmap(option.rect.x() + i * IMG_SIZE + SPACING, option.rect.y(), StarWidget::starInactive());
+ painter->drawPixmap(option.rect.x() + i * IMG_SIZE + SPACING, option.rect.y() + deltaY, StarWidget::starInactive());
painter->restore();
}
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index fffc79700..1faa46fb1 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -952,10 +952,10 @@ QVariant DiveItem::data(int column, int role) const
case DATE: /* fall through */
case SUIT: /* fall through */
case LOCATION:
- retVal = Qt::AlignLeft;
+ retVal = int(Qt::AlignLeft | Qt::AlignVCenter);
break;
default:
- retVal = Qt::AlignRight;
+ retVal = int(Qt::AlignRight | Qt::AlignVCenter);
break;
}
break;
diff --git a/subsurface.qrc b/subsurface.qrc
index eb87675c5..a454d9d3b 100644
--- a/subsurface.qrc
+++ b/subsurface.qrc
@@ -31,4 +31,4 @@
<file alias="plan_minus">icons/planner/minus.png</file>
<file alias="plan_plus">icons/planner/plus.png</file>
</qresource>
- </RCC>
+ </RCC> \ No newline at end of file