Return the configured font for data browser in the model

Otherwise it cannot be used by the format toolbar to get the cell font when
the default has not been overwritten.

See comment in issue #1976
This commit is contained in:
mgrojo
2020-08-16 22:28:58 +02:00
parent 1e1e87e61c
commit 47aa591dfb
3 changed files with 7 additions and 2 deletions

View File

@@ -215,7 +215,8 @@ TableBrowser::TableBrowser(DBBrowserDB* _db, QWidget* parent) :
QString font_string = m_model->data(current, Qt::FontRole).toString();
QFont font;
if(!font_string.isEmpty())
font.fromString(m_model->data(current, Qt::FontRole).toString());
font.fromString(font_string);
ui->fontComboBox->blockSignals(true);
ui->fontComboBox->setCurrentFont(font);
ui->fontComboBox->blockSignals(false);

View File

@@ -353,7 +353,7 @@ QVariant SqliteTableModel::data(const QModelIndex &index, int role) const
return QVariant();
return decode(data);
} else if(role == Qt::FontRole) {
QFont font;
QFont font = m_font;
if(!row_available || data.isNull() || isBinary(data))
font.setItalic(true);
else {
@@ -1175,6 +1175,8 @@ void SqliteTableModel::reloadSettings()
m_nullBgColour = QColor(Settings::getValue("databrowser", "null_bg_colour").toString());
m_binFgColour = QColor(Settings::getValue("databrowser", "bin_fg_colour").toString());
m_binBgColour = QColor(Settings::getValue("databrowser", "bin_bg_colour").toString());
m_font = QFont(Settings::getValue("databrowser", "font").toString());
m_font.setPointSize(Settings::getValue("databrowser", "fontsize").toInt());
m_symbolLimit = Settings::getValue("databrowser", "symbol_limit").toInt();
m_imagePreviewEnabled = Settings::getValue("databrowser", "image_preview").toBool();
m_chunkSize = static_cast<std::size_t>(Settings::getValue("db", "prefetchsize").toUInt());

View File

@@ -3,6 +3,7 @@
#include <QAbstractTableModel>
#include <QColor>
#include <QFont>
#include <map>
#include <memory>
@@ -235,6 +236,7 @@ private:
QColor m_nullBgColour;
QColor m_binFgColour;
QColor m_binBgColour;
QFont m_font;
int m_symbolLimit;
bool m_imagePreviewEnabled;