Made the TableViews share a bit of code, code cleanup.

Made the tableviews share a bit of code, and code cleanup.
The tableviews for Cylinders, Weigth and Dive Planner Points
now shares the CSS and I also implemented the save / load
methods for the dive planner points, so the functionality
is mostly done on the vieualization side. - since we are
now using three tables maybe it's a better idea to create
one class SubSurfaceTable that knows how to handle saving
/ loading of the columns... TODO for the future. ;)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-08-28 07:48:46 -03:00
parent cfd17116eb
commit bb59202812
5 changed files with 57 additions and 62 deletions

View file

@ -18,6 +18,8 @@
#include <QCompleter>
#include <QDebug>
#include <QSet>
#include <QTextStream>
#include <QFile>
#include <QSettings>
MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
@ -85,7 +87,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
connect(ui->weights, SIGNAL(clicked(QModelIndex)), this, SLOT(editWeigthWidget(QModelIndex)));
QFontMetrics metrics(defaultModelFont());
QFontMetrics metrics2(font());
ui->cylinders->horizontalHeader()->setResizeMode(CylindersModel::REMOVE, QHeaderView::Fixed);
ui->cylinders->verticalHeader()->setDefaultSectionSize( metrics.height() +8 );
@ -106,6 +107,13 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui->location->setCompleter(completers.location);
ui->suit->setCompleter(completers.suit);
QFile cssFile(":table-css");
cssFile.open(QIODevice::ReadOnly);
QTextStream reader(&cssFile);
QString css = reader.readAll();
ui->cylinders->setStyleSheet(css);
ui->weights->setStyleSheet(css);
initialUiSetup();
}