mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-09 05:19:55 -05:00
Fixes when adding new conditional format
Font point size preference is taken into account when creating a new default conditional format. New conditional formats in dialog are resized to contents. See issues #1976 and #1815.
This commit is contained in:
@@ -45,12 +45,19 @@ CondFormatManager::~CondFormatManager()
|
||||
|
||||
void CondFormatManager::addNewItem()
|
||||
{
|
||||
QFont font = QFont(Settings::getValue("databrowser", "font").toString());
|
||||
font.setPointSize(Settings::getValue("databrowser", "fontsize").toInt());
|
||||
|
||||
CondFormat newCondFormat("", QColor(Settings::getValue("databrowser", "reg_fg_colour").toString()),
|
||||
m_condFormatPalette.nextSerialColor(Palette::appHasDarkTheme()),
|
||||
QFont(Settings::getValue("databrowser", "font").toString()),
|
||||
font,
|
||||
CondFormat::AlignLeft,
|
||||
m_encoding);
|
||||
addItem(newCondFormat);
|
||||
|
||||
// Resize columns to contents, except for the condition
|
||||
for(int col = ColumnForeground; col < ColumnFilter; ++col)
|
||||
ui->tableCondFormats->resizeColumnToContents(col);
|
||||
}
|
||||
|
||||
void CondFormatManager::addItem(const CondFormat& aCondFormat)
|
||||
|
||||
@@ -437,11 +437,14 @@ void TableBrowser::updateFilter(int column, const QString& value)
|
||||
|
||||
void TableBrowser::addCondFormat(int column, const QString& value)
|
||||
{
|
||||
QFont font = QFont(Settings::getValue("databrowser", "font").toString());
|
||||
font.setPointSize(Settings::getValue("databrowser", "fontsize").toInt());
|
||||
|
||||
// Create automatically a new conditional format with the next serial background color according to the theme and the regular foreground
|
||||
// color and font in the settings.
|
||||
CondFormat newCondFormat(value, QColor(Settings::getValue("databrowser", "reg_fg_colour").toString()),
|
||||
m_condFormatPalette.nextSerialColor(Palette::appHasDarkTheme()),
|
||||
QFont(Settings::getValue("databrowser", "font").toString()),
|
||||
font,
|
||||
CondFormat::AlignLeft,
|
||||
m_browseTableModel->encoding());
|
||||
m_browseTableModel->addCondFormat(column, newCondFormat);
|
||||
@@ -460,6 +463,8 @@ void TableBrowser::editCondFormats(int column)
|
||||
{
|
||||
CondFormatManager condFormatDialog(browseTableSettings[currentlyBrowsedTableName()].condFormats[column],
|
||||
m_browseTableModel->encoding(), this);
|
||||
condFormatDialog.setWindowTitle(tr("Conditional formats for \"%1\"").
|
||||
arg(m_browseTableModel->headerData(column, Qt::Horizontal).toString()));
|
||||
if (condFormatDialog.exec()) {
|
||||
std::vector<CondFormat> condFormatVector = condFormatDialog.getCondFormats();
|
||||
m_browseTableModel->setCondFormats(column, condFormatVector);
|
||||
|
||||
Reference in New Issue
Block a user