[PATCH] Fixed layout of yearly statistics model

Heena Mahour heena393 at gmail.com
Thu Mar 6 05:29:52 PST 2014


>From aacfca96716bbb82f6bb9b14e32e590c0c11ec7c Mon Sep 17 00:00:00 2001
From: heena mahour <heena393 at gmail.com>
Date: Thu, 6 Mar 2014 18:52:36 +0530
Subject: [PATCH 4/4] Signed-off-by: heena mahour <heena393 at gmail.com>

Yearly Statistics model
#This is my first patch
Changes in the layout of the tree view ,set the pixel size, stretch,
bold of the font ,fixed the layout
---
 qt-ui/models.cpp | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index a149488..ab0f3c4 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -1224,19 +1224,19 @@ QVariant DiveTripModel::headerData(int section,
Qt::Orientation orientation, int
  case Qt::DisplayRole :
  switch (section) {
  case NR: ret = tr("#"); break;
- case DATE: ret = tr("date"); break;
+ case DATE: ret = tr("Date"); break;
  case RATING: ret = UTF8_BLACKSTAR; break;
  case DEPTH: ret = (get_units()->length == units::METERS) ? tr("m") :
tr("ft"); break;
  case DURATION: ret = tr("min"); break;
  case TEMPERATURE:ret =
QString("%1%2").arg(UTF8_DEGREE).arg((get_units()->temperature ==
units::CELSIUS) ? "C" : "F"); break;
  case TOTALWEIGHT:ret = (get_units()->weight == units::KG) ? tr("kg") :
tr("lbs"); break;
- case SUIT: ret = tr("suit"); break;
+ case SUIT: ret = tr("Suit"); break;
  case CYLINDER: ret = tr("cyl"); break;
  case NITROX: ret = QString("O%1%").arg(UTF8_SUBSCRIPT_2); break;
  case SAC: ret = tr("SAC"); break;
  case OTU: ret = tr("OTU"); break;
  case MAXCNS: ret = tr("maxCNS"); break;
- case LOCATION: ret = tr("location"); break;
+ case LOCATION: ret = tr("Location"); break;
  }break;
  }

@@ -1418,8 +1418,23 @@ void DiveComputerModel::keepWorkingList()

 class YearStatisticsItem : public TreeItem {
 public:
- enum {YEAR, DIVES, TOTAL_TIME, AVERAGE_TIME, SHORTEST_TIME, LONGEST_TIME,
AVG_DEPTH, MIN_DEPTH,
- MAX_DEPTH, AVG_SAC, MIN_SAC, MAX_SAC, AVG_TEMP, MIN_TEMP, MAX_TEMP,
COLUMNS};
+ enum {
+  YEAR,
+  DIVES,
+  TOTAL_TIME,
+  AVERAGE_TIME,
+  SHORTEST_TIME,
+  LONGEST_TIME,
+  AVG_DEPTH,
+  MIN_DEPTH,
+  MAX_DEPTH,
+  AVG_SAC,
+  MIN_SAC,
+  MAX_SAC,
+  AVG_TEMP,
+  MIN_TEMP,
+  MAX_TEMP,
+  COLUMNS};

  QVariant data(int column, int role) const;
  YearStatisticsItem(stats_t interval);
@@ -1438,6 +1453,8 @@ QVariant YearStatisticsItem::data(int column, int
role) const

  if (role == Qt::FontRole) {
  QFont font = defaultModelFont();
+ font.setStretch(130);
+ font.setPixelSize(15);
  font.setBold(stats_interval.is_year);
  return font;
  } else if (role != Qt::DisplayRole) {
@@ -1588,11 +1605,9 @@ void TablePrintModel::callReset()

 QVariant TablePrintModel::data(const QModelIndex &index, int role) const
 {
- if (!index.isValid())
- return QVariant();
- if (role == Qt::BackgroundRole)
+ if ((role == Qt::BackgroundRole)&&(index.isValid()))
  return QColor(list.at(index.row())->colorBackground);
- if (role == Qt::DisplayRole)
+ if ((role == Qt::DisplayRole)&&(index.isValid()))
  switch (index.column()) {
  case 0: return list.at(index.row())->number;
  case 1: return list.at(index.row())->date;
-- 
1.8.1.2

-- 
-Heena
Season of kde'12 participant
Google Summer of Code 2013
Delhi College of Engineering(COE),India
http://about.me/heena.mahour
http://heenamahour.blogspot.in
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140306/bd975dbb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Signed-off-by-heena-mahour-heena393-gmail.com.patch
Type: text/x-patch
Size: 3176 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140306/bd975dbb/attachment.bin>


More information about the subsurface mailing list