mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-21 03:21:43 -06:00
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:
@@ -38,6 +38,7 @@ public:
|
||||
Qt::SortOrder sortOrderMode;
|
||||
QMap<int, int> columnWidths;
|
||||
QMap<int, QString> filterValues;
|
||||
QMap<int, QString> displayFormats;
|
||||
|
||||
friend QDataStream& operator<<(QDataStream& stream, const MainWindow::BrowseDataTableSettings& object)
|
||||
{
|
||||
@@ -45,6 +46,7 @@ public:
|
||||
stream << static_cast<int>(object.sortOrderMode);
|
||||
stream << object.columnWidths;
|
||||
stream << object.filterValues;
|
||||
stream << object.displayFormats;
|
||||
|
||||
return stream;
|
||||
}
|
||||
@@ -56,6 +58,7 @@ public:
|
||||
object.sortOrderMode = static_cast<Qt::SortOrder>(sortordermode);
|
||||
stream >> object.columnWidths;
|
||||
stream >> object.filterValues;
|
||||
stream >> object.displayFormats;
|
||||
|
||||
return stream;
|
||||
}
|
||||
@@ -98,6 +101,7 @@ private:
|
||||
QMenu *popupTableMenu;
|
||||
QMenu *recentFilesMenu;
|
||||
QMenu *popupSaveSqlFileMenu;
|
||||
QMenu* popupBrowseDataHeaderMenu;
|
||||
|
||||
QLabel* statusEncodingLabel;
|
||||
QLabel* statusEncryptionLabel;
|
||||
@@ -207,6 +211,8 @@ private slots:
|
||||
void copyCurrentCreateStatement();
|
||||
void on_comboLineType_currentIndexChanged(int index);
|
||||
void on_comboPointShape_currentIndexChanged(int index);
|
||||
void showDataColumnPopupMenu(const QPoint& pos);
|
||||
void editDataColumnDisplayFormat();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user