This commit is the start of the Editable Model work
for the planner, it creates a new delegate and shares
the code for the model that creates the gas types, so
we only need to change in one place to add new gases.
The table is already edition-enabled, but the outcome
is still undone, next commit - put all together.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This is a follow up commit to the previous one that
enabled cancel for cylinders, everything in the commit
log for the cylinders also applyes here.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Made the default 'Cancel' action correctly cancel
the cylinder edition. This is needed only because
we bypassed the default behavior on Qt that took
care of this, because we wanted to have more control
on how the view would update the items accordingly
with wich one of the cylinders were selected
on the edition pane - the pressure and size of the
cylinders needed to have it's data set, but the Qt
Model/View system *thinks* that cancel-edition is
simply 'do not commit the edition data, then.' wich
would not work with us, because we passed the strange
data already. So, I created a backup data that serves
us very well. When the user cancels, this backup data
is added back on the cylinder, making everything as
it was before.
[Dirk Hohndel: removed the inadvertendly added boost header]
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch fixes the combobox behavior on the inline edit
to what it was ( well, similar to ) the GTK version,
up and arrow keys will walk you to the list of choices,
and it will update the other data as soon as you walks over it
one drawback is that you cant ( for now, since I do have a
very big headache at the moment ) cancel, since the cancel
will just forgets the item and do not call 'setData' on the
model, but we already called it while walking on the list.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Adds spport for key_up and key_down in the combobox
delegates, now when you press key_up or down, it will
show the list of choices instead of going one-by-one
in the lineedit.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Better handling of default sizes on the Cylinder and weight widgets,
the weigth widget didn't had a CSS applied so it looked odd compared
to the cylinder one, also the default behavior for the combobox delegate
didn't worked very well with the css applied, being too small.
this patch fixes that.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch creates a ComboBoxDelegate where the other specific delegates
should inherit from. this adds a little code cleanup for the current
version, and will help as soon as more delegates got added to the code.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This is very much analogous to the way cylinders are implemented.
That means that just like with cylinders, if the user enters a new type
and hits 'tab' before hitting 'enter', Subsurface will crash.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I had to immprove the TankInfoModel with two new methods,
insertRows and setData, because the delegate used this
model to show what kind of Tanks we are offering.
Since the user can enter a new type of Tank, it's important
to add this tank to all lists using the delegates.
I Also added two new methods on the delegate itself,
to correctly shows the data, and set the data on the
model. This also will help dirk with a working example
on how to edit things while using a delegate.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Now when you edit 'Type', a drop-down list will appear
and will enable you to choose from it's contents.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
For the stars on the dive table I had to rework a bit my
StarRating widget, because it used a pixmap for each widget
that were created. Not it uses only 2 pixmaps: the active
and inactive ones.
A new file was created named modeldelegates(h, cpp) that
should hold all delegates of the models. For the GTK / C
folks, a 'Delegate' ia s way to bypass the default behavior
of the view that's displaying the data.
I also added the code to display the stars if no delegate
is set ( good for debugging. )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>