Bug fixes for today

Tomaz Canabrava tcanabrava at kde.org
Fri Jun 14 12:35:08 PDT 2013

On Thu, Jun 13, 2013 at 4:00 PM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
> On Thu, Jun 13, 2013 at 11:41 AM, Tomaz Canabrava <tcanabrava at kde.org> wrote:
>> Good - So, I'm back on the Visual Plan Editor.
>> Linus, while dirk's asleep - you'd have anything that you want me to focus on?
> No, if you can get that visual plan/new dive editing working, that
> would be lovely.

That's the plan for the weekend. :)

> I'll be diving in a couple of days, and try to use the Qt branch this
> time (in Palau, not enough worked for me, this time around hopefully
> the Qt branch is actually good enough to download dives and gps
> coordinates and editing stuff).
> One thing missing from a practical standpoint is multi-dive editing -
> after downloading the dives of the day, I usually want to set things
> like weights and wetsuit information for all of the new dives, and the
> Qt branch doesn't have mult-dive editing yet. But from a priority
> standpoint, I think it's better if you look at the visual plan editor.

And this doesn't looks complicated to do, I just need to verify in the
amout of dives that are selected ono the dive list, and replicate the
edition to all of them.

> Oh, and I tried to make the trip entry bold in the divelist, but the
> obvious thing failed badly:
>     diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
>     index 601f2f6280ba..37f482b821fc 100644
>     --- a/qt-ui/models.cpp
>     +++ b/qt-ui/models.cpp
>     @@ -783,6 +783,12 @@ QVariant TripItem::data(int column, int role) const
>              if (role == SORT_ROLE)
>                      return (qulonglong)trip->when;
>     +        if (role == Qt::FontRole) {
>     +                QFont font;
>     +                font.setBold(true);
>     +                return font;
>     +        }
>     +
>              if (role == Qt::DisplayRole) {
>                      switch (column) {
>                      case NR:
> so if somebody knows what's wrong with that, holler. But it's not
> really all that important, I just wanted to see how it looked..

Well, it's correct but I may have broked your core, sorry =)
The DiveTripModel has a 'data' member that does a bit of filtering
before delivering things to each item, and  FontRole was one of the
things that I filtered ( because each item used to have the same font
- smaller than the system's ), I tougth it was a good idea to create
there instead of the data members on the children.

so, the correct patch - way similar from yours,

diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 601f2f6..16af82a 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -982,7 +982,11 @@ QVariant DiveTripModel::data(const QModelIndex&
index, int role) const

        if (role == Qt::FontRole) {
                QFont font;
-               font.setPointSizeF(font.pointSizeF() * 0.7);
+               font.setPointSizeF(font.pointSizeF() * 0.8);
+               if (rowCount(index)){ // is trip.
+                       font.setBold(true);
+               }
                return font;
        TreeItemDT* item = static_cast<TreeItemDT*>(index.internalPointer());

Why the 0.7 to 0.8? well, don't know why, but with 0.7 it didn't show
the bold, so I increased it's size a tiny bit.

> Thanks,
>              Linus

You're welcome.
I didn't commited this because it was something that you were trying
to do - feel free to commit it. ^^

Sleepy Tomaz

More information about the subsurface mailing list