Try setting a saner default row height in the data browser

Maybe this helps with issue #419.
This commit is contained in:
Martin Kleusberg
2017-04-10 15:07:51 +02:00
parent f11c0181ca
commit 760ef092cd
3 changed files with 16 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
#include "sqlitetablemodel.h"
#include "FilterTableHeader.h"
#include "sqlitetypes.h"
#include "Settings.h"
#include <QApplication>
#include <QClipboard>
@@ -77,6 +78,17 @@ ExtendedTableWidget::ExtendedTableWidget(QWidget* parent) :
verticalHeader()->setContextMenuPolicy(Qt::CustomContextMenu);
}
void ExtendedTableWidget::reloadSettings()
{
// Set the new font and font size
QFont dataBrowserFont(Settings::getValue("databrowser", "font").toString());
dataBrowserFont.setPointSize(Settings::getValue("databrowser", "fontsize").toInt());
setFont(dataBrowserFont);
// Set new default row height depending on the font size
verticalHeader()->setDefaultSectionSize(verticalHeader()->fontMetrics().height()+10);
}
void ExtendedTableWidget::copy()
{
QModelIndexList indices = selectionModel()->selectedIndexes();

View File

@@ -20,6 +20,9 @@ public:
public:
QSet<int> selectedCols();
public slots:
void reloadSettings();
signals:
void foreignKeyClicked(const QString& table, const QString& column, const QByteArray& value);
void switchTable(bool next); // 'next' parameter is set to true if next table should be selected and to false if previous table should be selected

View File

@@ -1692,9 +1692,7 @@ void MainWindow::loadExtensionsFromSettings()
void MainWindow::reloadSettings()
{
// Set data browser font
QFont dataBrowserFont(Settings::getValue("databrowser", "font").toString());
dataBrowserFont.setPointSize(Settings::getValue("databrowser", "fontsize").toInt());
ui->dataTable->setFont(dataBrowserFont);
ui->dataTable->reloadSettings();
// Set prefetch sizes for lazy population of table models
m_browseTableModel->setChunkSize(Settings::getValue("db", "prefetchsize").toInt());