mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Better image file handling in EditDialog
Put the image editor into a scrollarea so the dialog doesn't screw up when importing a large image file. When importing a file add a filter to the file dialog to only show image files.
This commit is contained in:
@@ -59,11 +59,17 @@ void EditDialog::loadText(const QByteArray& data, int row, int col)
|
||||
|
||||
void EditDialog::importData()
|
||||
{
|
||||
// Get list of supported image file formats to include them in the file dialog filter
|
||||
QString image_formats;
|
||||
QList<QByteArray> image_formats_list = QImageReader::supportedImageFormats();
|
||||
for(int i=0;i<image_formats_list.size();++i)
|
||||
image_formats.append(QString("*.%1 ").arg(QString::fromUtf8(image_formats_list.at(i))));
|
||||
|
||||
QString fileName = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
tr("Choose a file"),
|
||||
defaultlocation,
|
||||
tr("Text files(*.txt);;All files(*)"));
|
||||
tr("Text files(*.txt);;Image files(%1);;All files(*)").arg(image_formats));
|
||||
if(QFile::exists(fileName))
|
||||
{
|
||||
QFile file(fileName);
|
||||
|
||||
@@ -95,7 +95,30 @@
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="editorBinary"/>
|
||||
<widget class="QLabel" name="editorImage"/>
|
||||
<widget class="QScrollArea" name="editorImageScrollArea">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>358</width>
|
||||
<height>267</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="editorImage">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
Reference in New Issue
Block a user