Support alternative display formats in the Browse Data tab

This is a proof-of-concept or even a basic first implementation of a new
feature I'd like to have in DB4S which at the moment I call display
formats.

The idea here is to allow the user to change the data in the Browse Data
tab on a per column basis before displaying it. This means even though
the data is stored in format X in the database it can be shown in format
Y in the browser. This should be useful in cases where the original
format X is hard to read or just not useful in a particular case.

This first implementation allows the user to right click on the header
of a column and open a new dialog for setting the display format which
offers a (limited) list of pre-defined formats. The selected format is
then integrated into the SELECT statement which is sent to SQLite.

While it works, this draft implementation lacks a number of features.
Here are the most prominent ones I'm currently aware of:
* Data not editable (or only via the Edit Dialog) because it isn't
  transformed back yet.
* More display formats needed; maybe customizable ones, too.
* No indication in the UI for which columns a format has been set.
* Could _maybe_ be integrated into the import/export etc. for optional
  use.
This commit is contained in:
Martin Kleusberg
2015-07-06 18:28:30 +02:00
parent 944e22a80d
commit 7c1d237d9b
11 changed files with 349 additions and 10 deletions

View File

@@ -1760,6 +1760,14 @@
<string>Copy the CREATE statement of the item to the clipboard</string>
</property>
</action>
<action name="actionBrowseTableEditDisplayFormat">
<property name="text">
<string>Edit display format</string>
</property>
<property name="toolTip">
<string>Edit the display format of the data in this column</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
@@ -2683,6 +2691,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>actionBrowseTableEditDisplayFormat</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>editDataColumnDisplayFormat()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>518</x>
<y>314</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>fileOpen()</slot>
@@ -2739,5 +2763,6 @@
<slot>switchToBrowseDataTab()</slot>
<slot>copyCurrentCreateStatement()</slot>
<slot>jumpToRow(QString,QString,QByteArray)</slot>
<slot>editDataColumnDisplayFormat()</slot>
</slots>
</ui>