summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-12-11 21:44:05 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-12 03:26:39 +0100
commit0b5f9512efb8d861b3d935278f22d0cc5d6b8d4a (patch)
tree8d0a08e2411e45519eb9a6aed707c3b2db5300dd /qt-ui
parentc5c44e3a829d25227f623bd0e6211a4ff5d91b69 (diff)
downloadsubsurface-0b5f9512efb8d861b3d935278f22d0cc5d6b8d4a.tar.gz
Fix TableWidget ( equipment ones ) on dark scheme.
This patch uses the class created by the previous patch to get rid of the CSS and be really desktop native. it fixes a lot of stuff in non-blue-styles and throws a lot of code away. <3 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/css/tableviews.css28
-rw-r--r--qt-ui/divelistview.cpp8
-rw-r--r--qt-ui/modeldelegates.cpp5
-rw-r--r--qt-ui/modeldelegates.h6
-rw-r--r--qt-ui/tableview.cpp7
5 files changed, 13 insertions, 41 deletions
diff --git a/qt-ui/css/tableviews.css b/qt-ui/css/tableviews.css
index 4e8396886..e69de29bb 100644
--- a/qt-ui/css/tableviews.css
+++ b/qt-ui/css/tableviews.css
@@ -1,28 +0,0 @@
- QTableView {
- show-decoration-selected: 1;
- }
-
- QTableView::item {
- border: 1px solid #d9d9d9;
- border-top-color: transparent;
- border-bottom-color: transparent;
- padding: 2px;
- }
-
- QTableView::item:hover {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1);
- border: 1px solid #bfcde4;
- }
-
- QTableView::item:selected {
- border: 1px solid #567dbc;
- }
-
- QTableView::item:selected:active{
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6ea1f1, stop: 1 #567dbc);
- }
-
- QTableView::item:selected:!active {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6b9be8, stop: 1 #577fbf);
- }
-
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index d77dd07aa..ef1817fbe 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -22,14 +22,6 @@
#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))
{
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp
index 6cb47945a..c3324ed72 100644
--- a/qt-ui/modeldelegates.cpp
+++ b/qt-ui/modeldelegates.cpp
@@ -19,6 +19,11 @@
#include <QStringListModel>
#include <QApplication>
+QSize DiveListDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
+{
+ return QSize(50,22);
+}
+
// Gets the index of the model in the currentRow and column.
// currCombo is defined below.
#define IDX( XX ) mymodel->index(currCombo.currRow, XX)
diff --git a/qt-ui/modeldelegates.h b/qt-ui/modeldelegates.h
index 1aedf1bbf..013a1c17a 100644
--- a/qt-ui/modeldelegates.h
+++ b/qt-ui/modeldelegates.h
@@ -5,6 +5,12 @@
class QComboBox;
class QPainter;
+class DiveListDelegate : public QStyledItemDelegate{
+public:
+ DiveListDelegate(){}
+ QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const;
+};
+
class StarWidgetsDelegate : public QStyledItemDelegate {
Q_OBJECT
public:
diff --git a/qt-ui/tableview.cpp b/qt-ui/tableview.cpp
index c79a23491..7c72b4bce 100644
--- a/qt-ui/tableview.cpp
+++ b/qt-ui/tableview.cpp
@@ -1,5 +1,6 @@
#include "tableview.h"
#include "models.h"
+#include "modeldelegates.h"
#include <QPushButton>
#include <QLayout>
@@ -10,11 +11,7 @@
TableView::TableView(QWidget *parent) : QWidget(parent)
{
ui.setupUi(this);
- QFile cssFile(":table-css");
- cssFile.open(QIODevice::ReadOnly);
- QTextStream reader(&cssFile);
- QString css = reader.readAll();
- ui.tableView->setStyleSheet(css);
+ ui.tableView->setItemDelegate(new DiveListDelegate);
/* There`s mostly a need for a Mac fix here too. */
if (qApp->style()->objectName() == "gtk+")
ui.groupBox->layout()->setContentsMargins(0, 9, 0, 0);