aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/modeldelegates.h
AgeCommit message (Collapse)Author
2015-07-01Create a delegate to display custom dataGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-17Turn of replotting while the cylinder type combo box is activeGravatar Robert C. Helling
Since replotting is expensive and it is triggered while scrolling through the list of cylinders, better not do it for improved user experience and replot only after the combo box loses focus. I hope this... Fixes #768 Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-17Add the ability to modify the cylinder use in the UIGravatar Dirk Hohndel
Thanks to Tomaz for writing a first draft of the delegate. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-18Dynamic dive trip list column widthsGravatar Giuseppe Bilotta
Compute the default widths for the columns in the dive trip list from their header and (expected) content length rather than some fixed pixel sizes. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Add the HTML Delegate to printing.Gravatar Tomaz Canabrava
This patch just adds the HTML Delegate to print the text. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Added a HTML Displayable DelegateGravatar Tomaz Canabrava
Added a HTML delegate to show rendered HTML on print. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-12Add step size in our SpinBox delegatesGravatar Anton Lundin
For the Set point spinbox, it was kinda hard just stepping by the default 1.0, so setting it to step by 0.1 makes much more sense. The int SpinBox got a step size parameter for consistency. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-12Use doubles in DoubleSpinBoxDelegateGravatar Anton Lundin
The previous code used qreals, but it feels clearer to use doubles when the name of the class contains the word double. The performance loss of using doubles instead of floats on arm is non-existent in this case. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-12Don't round range for DoubleSpinBoxDelegate to intGravatar Anton Lundin
This fixes simple copy-paste error that the DoubleSpinBoxDelegate range was stored as int, thus rounding min value from 0.2 to 0. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11Fixed input in the DivePlanner tableGravatar Tomaz Canabrava
Based on Glance's idea on rewritting the Delegates, but we don't need to redo the wheel as Qt already gives us the correct Delegate, we just need to set some boundaries on it before returning. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-25Better handling of mouse on the delegates ( Equipment Edition )Gravatar Tomaz Canabrava
This adds more handling of missing actions for the mouse on the equipment edition. It complements the stuff talked about on bug 359, but it's a different issue. 359 seems already fixed. See #359 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27Massive automated whitespace cleanupGravatar Dirk Hohndel
I know everyone will hate it. Go ahead. Complain. Call me names. At least now things are consistent and reproducible. If you want changes, have your complaint come with a patch to scripts/whitespace.pl so that we can automate it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Put include guard to every headerGravatar Boris Barbulovski
* ensure include guard to every header * comment endif guard block Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Fix some memory leaks.Gravatar Boris Barbulovski
Memory leaks were caused by broken parent/child relations. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-12Fix TableWidget ( equipment ones ) on dark scheme.Gravatar Tomaz Canabrava
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>
2013-10-15Fixed the Tab behavior on the QCombobox DelegateGravatar Tomaz Canabrava
This Patch fixes the tab behavior on the QComboBox delegate. For a QComboBox, tab was being treated as 'cancel' action on edit, but since it will send a editingFinished() signal, and the Qt::Key_Return will also send a editingFinished() signal, I couldn't use that method and had to do a little hack around it. The code is mostly clean and works. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15Random white space cleanupGravatar Dirk Hohndel
Because I can. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03Print: provide means to print profile tablesGravatar Lubomir I. Ivanov
This patch adds a couple of classes and some other modifications in PrintLayout that handle the printing of tables under a profile. models.h : ProfilePrintModel The class uses a 'struct *dive' to output all required data for a certain dive at specific rows and columns. It also handles font formatting and text alignment. modeldelagatates.h : ProfilePrintDelegate The class is used only for drawing a custom grid for profile tables. PrintLayout::createProfileTable() The function is used to create and setup the profile table object PrintLayout::printProfileDives() The function now has correct padding of dive profiles on a page and also the printing of actual tables below them. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-26Fix the edition of cylinders and weigths by keypressGravatar Tomaz Canabrava
This patch fixes the cylinders and weigth edition by keypress. I don`t know when I broke this and linus found, most probably when I added the code for showing the cylinder size and working press while moving the mouse around the list - sorry guys. So, now this *seems* fixed, tested for a fairly good amount of time and everything seemed ok. I was unable to reproduce the behavior that linus got on two value overlapped on each other, tougth. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25Make the Qt ComboBox behave in a Better WayGravatar Tomaz Canabrava
So, the ComboBox is a beast, and when used on a Delegate it's very hard to get things right, wich is a pitty, because I overly like qt. So: 1 - Combobox needs to show the popup when user press ↓ and ↑ keys 2 - Combobox needs to select when user press enter, not twice. 3 - Combobox neesds to select when user selects from the mouse, not pressing enter after. 4 - Combobox needs to not mess with stuff when moving around. Everything that I listed there works on a non-delegate combobox, but for some reason, a delegate missed those, so I reimplemented all. not nice, but now we have a code that will work, I hope. *fingers crossed* Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-30Started the work of Editable Model for the PlannerGravatar Tomaz Canabrava
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>
2013-07-18Added the code to revert Weigths when user cancels editionGravatar Tomaz Canabrava
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>
2013-07-18'Cancel' action Cancels editing Cylinders.Gravatar Tomaz Canabrava
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>
2013-07-16Fixes the Combobox behavior on the inline-editGravatar Tomaz Canabrava
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>
2013-07-16Support for key_up and down in the combobox delegate.Gravatar Tomaz Canabrava
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>
2013-06-16Better handling of default sizes on the Cylinder and Weight widgetsGravatar Tomaz Canabrava
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>
2013-06-16Create a 'ComboBoxDelegate' to concentrate the comboboxness of delegates.Gravatar Tomaz Canabrava
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>
2013-05-23Add weightsystem delegate to enable editing of weightsystemGravatar Dirk Hohndel
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>
2013-05-23Added support for Completing on the Cylinder Type delegateGravatar Tomaz Canabrava
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>
2013-05-22The never ending, futile fight for whitespace consistencyGravatar Dirk Hohndel
I just need to write a tool that does this... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22Added a Delegate for editing CylindersGravatar Tomaz Canabrava
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>
2013-05-02Test the CSS for styling the TableViewGravatar Tomaz Canabrava
This is a test and I shouldn't be taken seriously. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-27Added support for showing the Stars on the DiveTableGravatar Tomaz Canabrava
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>