FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Return the configured font for data browser in the model · sqlitebrowser/sqlitebrowser@c4b2ffc · GitHub

Commit c4b2ffc

Browse files
committed
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 # Conflicts: # src/TableBrowser.cpp
1 parent f28ecc0 commit c4b2ffc

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎src/TableBrowser.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,11 @@ TableBrowser::TableBrowser(QWidget* parent) :
212212

213213
connect(ui->dataTable, &ExtendedTableWidget::currentIndexChanged, this, [this](const QModelIndex &current, const QModelIndex &) {
214214
// Get cell current format for updating the format toolbar values. Block signals, so the format change is not reapplied.
215+
QString font_string = m_model->data(current, Qt::FontRole).toString();
215216
QFont font;
216-
font.fromString(m_model->data(current, Qt::FontRole).toString());
217+
if(!font_string.isEmpty())
218+
font.fromString(font_string);
219+
217220
ui->fontComboBox->blockSignals(true);
218221
ui->fontComboBox->setCurrentFont(font);
219222
ui->fontComboBox->blockSignals(false);

‎src/sqlitetablemodel.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ QVariant SqliteTableModel::data(const QModelIndex &index, int role) const
353353
return QVariant();
354354
return decode(data);
355355
} else if(role == Qt::FontRole) {
356-
QFont font;
356+
QFont font = m_font;
357357
if(!row_available || data.isNull() || isBinary(data))
358358
font.setItalic(true);
359359
else {
@@ -1175,6 +1175,8 @@ void SqliteTableModel::reloadSettings()
11751175
m_nullBgColour = QColor(Settings::getValue("databrowser", "null_bg_colour").toString());
11761176
m_binFgColour = QColor(Settings::getValue("databrowser", "bin_fg_colour").toString());
11771177
m_binBgColour = QColor(Settings::getValue("databrowser", "bin_bg_colour").toString());
1178+
m_font = QFont(Settings::getValue("databrowser", "font").toString());
1179+
m_font.setPointSize(Settings::getValue("databrowser", "fontsize").toInt());
11781180
m_symbolLimit = Settings::getValue("databrowser", "symbol_limit").toInt();
11791181
m_imagePreviewEnabled = Settings::getValue("databrowser", "image_preview").toBool();
11801182
m_chunkSize = static_cast<std::size_t>(Settings::getValue("db", "prefetchsize").toUInt());

‎src/sqlitetablemodel.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <QAbstractTableModel>
55
#include <QColor>
6+
#include <QFont>
67

78
#include <map>
89
#include <memory>
@@ -235,6 +236,7 @@ public slots:
235236
QColor m_nullBgColour;
236237
QColor m_binFgColour;
237238
QColor m_binBgColour;
239+
QFont m_font;
238240
int m_symbolLimit;
239241
bool m_imagePreviewEnabled;
240242

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL