mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-02-09 21:28:30 -06:00
Allow user to define their own display formats. The SQL code is editable and the combo box changes automatically to custom if the user edits one of the predefined formats. The display format (either custom or predefined) is validated with a case-insensitive regex so at least it contains a function applied to the column name. Added a new callback for executeSQL following the model of sqlite3_exec. Using this, the number of columns is got from a checking query execution. If it is not one, the custom display format is also rejected. Note that these validations might still be fooled in some unforeseen way, but the users should know what they're doing. See issue #573
135 lines
3.2 KiB
XML
135 lines
3.2 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<ui version="4.0">
|
|
<class>ColumnDisplayFormatDialog</class>
|
|
<widget class="QDialog" name="ColumnDisplayFormatDialog">
|
|
<property name="geometry">
|
|
<rect>
|
|
<x>0</x>
|
|
<y>0</y>
|
|
<width>624</width>
|
|
<height>205</height>
|
|
</rect>
|
|
</property>
|
|
<property name="windowTitle">
|
|
<string>Choose display format</string>
|
|
</property>
|
|
<layout class="QVBoxLayout" name="verticalLayout">
|
|
<item>
|
|
<widget class="QGroupBox" name="groupBox">
|
|
<property name="title">
|
|
<string>Display format</string>
|
|
</property>
|
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
<item>
|
|
<widget class="QLabel" name="labelDisplayFormat">
|
|
<property name="text">
|
|
<string>Choose a display format for the column '%1' which is applied to each value prior to showing it.</string>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
<item>
|
|
<widget class="QComboBox" name="comboDisplayFormat"/>
|
|
</item>
|
|
<item>
|
|
<widget class="SqlTextEdit" name="editDisplayFormat"/>
|
|
</item>
|
|
</layout>
|
|
</widget>
|
|
</item>
|
|
<item>
|
|
<widget class="QDialogButtonBox" name="buttonBox">
|
|
<property name="orientation">
|
|
<enum>Qt::Horizontal</enum>
|
|
</property>
|
|
<property name="standardButtons">
|
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
</property>
|
|
</widget>
|
|
</item>
|
|
</layout>
|
|
</widget>
|
|
<customwidgets>
|
|
<customwidget>
|
|
<class>SqlTextEdit</class>
|
|
<extends>QTextEdit</extends>
|
|
<header>sqltextedit.h</header>
|
|
<container>1</container>
|
|
</customwidget>
|
|
</customwidgets>
|
|
<tabstops>
|
|
<tabstop>comboDisplayFormat</tabstop>
|
|
<tabstop>editDisplayFormat</tabstop>
|
|
</tabstops>
|
|
<resources/>
|
|
<connections>
|
|
<connection>
|
|
<sender>buttonBox</sender>
|
|
<signal>accepted()</signal>
|
|
<receiver>ColumnDisplayFormatDialog</receiver>
|
|
<slot>accept()</slot>
|
|
<hints>
|
|
<hint type="sourcelabel">
|
|
<x>227</x>
|
|
<y>188</y>
|
|
</hint>
|
|
<hint type="destinationlabel">
|
|
<x>157</x>
|
|
<y>204</y>
|
|
</hint>
|
|
</hints>
|
|
</connection>
|
|
<connection>
|
|
<sender>buttonBox</sender>
|
|
<signal>rejected()</signal>
|
|
<receiver>ColumnDisplayFormatDialog</receiver>
|
|
<slot>reject()</slot>
|
|
<hints>
|
|
<hint type="sourcelabel">
|
|
<x>295</x>
|
|
<y>194</y>
|
|
</hint>
|
|
<hint type="destinationlabel">
|
|
<x>286</x>
|
|
<y>204</y>
|
|
</hint>
|
|
</hints>
|
|
</connection>
|
|
<connection>
|
|
<sender>comboDisplayFormat</sender>
|
|
<signal>currentIndexChanged(int)</signal>
|
|
<receiver>ColumnDisplayFormatDialog</receiver>
|
|
<slot>updateSqlCode()</slot>
|
|
<hints>
|
|
<hint type="sourcelabel">
|
|
<x>125</x>
|
|
<y>69</y>
|
|
</hint>
|
|
<hint type="destinationlabel">
|
|
<x>244</x>
|
|
<y>4</y>
|
|
</hint>
|
|
</hints>
|
|
</connection>
|
|
<connection>
|
|
<sender>editDisplayFormat</sender>
|
|
<signal>modificationChanged(bool)</signal>
|
|
<receiver>ColumnDisplayFormatDialog</receiver>
|
|
<slot>setCustom(bool)</slot>
|
|
<hints>
|
|
<hint type="sourcelabel">
|
|
<x>125</x>
|
|
<y>69</y>
|
|
</hint>
|
|
<hint type="destinationlabel">
|
|
<x>244</x>
|
|
<y>4</y>
|
|
</hint>
|
|
</hints>
|
|
</connection>
|
|
</connections>
|
|
<slots>
|
|
<slot>updateSqlCode()</slot>
|
|
<slot>setCustom()</slot>
|
|
</slots>
|
|
</ui>
|