Added toolbar for direct formatting of columns in Data Browser
The new toolbar is hidden by default and can be toggled using a button in the main Data Browser toolbar. Margins and spacing have been updated to improve appearance of the two toolbars. These tool buttons apply the format to the columns which are contained in the selection. This is done by updating or adding a new condition-less format to the list of conditional formats of those columns. New style icons from the Silk icon set. Changed existent ones for coherence. See issue #1976.
@@ -43,13 +43,25 @@ private:
|
||||
public:
|
||||
QString sqlCondition() const { return m_sqlCondition; }
|
||||
QString filter() const { return m_filter; }
|
||||
|
||||
QColor backgroundColor() const { return m_bgColor; }
|
||||
QColor foregroundColor() const { return m_fgColor; }
|
||||
void setBackgroundColor(QColor color) { m_bgColor = color; }
|
||||
void setForegroundColor(QColor color) { m_fgColor = color; }
|
||||
|
||||
bool isBold() const { return m_font.bold(); }
|
||||
bool isItalic() const { return m_font.italic(); }
|
||||
bool isUnderline() const { return m_font.underline(); }
|
||||
void setBold(bool value) { m_font.setBold(value); }
|
||||
void setItalic(bool value) { m_font.setItalic(value); }
|
||||
void setUnderline(bool value) { m_font.setUnderline(value); }
|
||||
|
||||
QFont font() const { return m_font; }
|
||||
void setFontFamily(const QString &family) { m_font.setFamily(family); }
|
||||
void setFontPointSize(int pointSize) { m_font.setPointSize(pointSize); }
|
||||
|
||||
Alignment alignment() const { return m_align; }
|
||||
void setAlignment(Alignment value) { m_align = value; }
|
||||
Qt::AlignmentFlag alignmentFlag() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -70,6 +70,8 @@ signals:
|
||||
void openFileFromDropEvent(QString);
|
||||
void selectedRowsToBeDeleted();
|
||||
void editCondFormats(int column);
|
||||
// Make the inherited protected signal public
|
||||
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
|
||||
private:
|
||||
void copyMimeData(const QModelIndexList& fromIndices, QMimeData* mimeData, const bool withHeaders, const bool inSQL);
|
||||
|
||||
@@ -184,7 +184,7 @@ void FilterLineEdit::showContextMenu(const QPoint &pos)
|
||||
emit clearAllCondFormats();
|
||||
});
|
||||
} else {
|
||||
conditionalFormatAction = new QAction(QIcon(":/icons/cond_formats"), tr("Use for Conditional Format"), editContextMenu);
|
||||
conditionalFormatAction = new QAction(QIcon(":/icons/add_cond_format"), tr("Use for Conditional Format"), editContextMenu);
|
||||
connect(conditionalFormatAction, &QAction::triggered, [&]() {
|
||||
emit addFilterAsCondFormat(text());
|
||||
});
|
||||
|
||||
@@ -124,6 +124,21 @@ You can drag SQL statements from an object row and drop them into other applicat
|
||||
<string>Browse Data</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="TableBrowser" name="tableBrowser" native="true"/>
|
||||
</item>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <QScrollBar>
|
||||
#include <QShortcut>
|
||||
#include <QTextCodec>
|
||||
#include <QColorDialog>
|
||||
|
||||
QMap<sqlb::ObjectIdentifier, BrowseDataTableSettings> TableBrowser::browseTableSettings;
|
||||
QString TableBrowser::defaultBrowseTableEncoding;
|
||||
@@ -127,6 +128,114 @@ TableBrowser::TableBrowser(QWidget* parent) :
|
||||
connect(ui->dataTable->verticalHeader(), &QHeaderView::customContextMenuRequested, this, &TableBrowser::showRecordPopupMenu);
|
||||
connect(ui->dataTable, &ExtendedTableWidget::openFileFromDropEvent, this, &TableBrowser::requestFileOpen);
|
||||
connect(ui->dataTable, &ExtendedTableWidget::selectedRowsToBeDeleted, this, &TableBrowser::deleteRecord);
|
||||
|
||||
connect(ui->fontComboBox, &QFontComboBox::currentFontChanged, this, [this](const QFont &font) {
|
||||
modifyColumnFormat(ui->dataTable->selectedCols(), [font](CondFormat& format) { format.setFontFamily(font.family()); });
|
||||
});
|
||||
connect(ui->fontSizeBox, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](int pointSize) {
|
||||
modifyColumnFormat(ui->dataTable->selectedCols(), [pointSize](CondFormat& format) { format.setFontPointSize(pointSize); });
|
||||
});
|
||||
|
||||
connect(ui->actionFontColor, &QAction::triggered, this, [this]() {
|
||||
QColor color = QColorDialog::getColor(QColor(m_browseTableModel->data(currentIndex(), Qt::ForegroundRole).toString()));
|
||||
if(color.isValid())
|
||||
modifyColumnFormat(ui->dataTable->selectedCols(), [color](CondFormat& format) { format.setForegroundColor(color); });
|
||||
});
|
||||
connect(ui->actionBackgroundColor, &QAction::triggered, this, [this]() {
|
||||
QColor color = QColorDialog::getColor(QColor(m_browseTableModel->data(currentIndex(), Qt::BackgroundRole).toString()));
|
||||
if(color.isValid())
|
||||
modifyColumnFormat(ui->dataTable->selectedCols(), [color](CondFormat& format) { format.setBackgroundColor(color); });
|
||||
});
|
||||
|
||||
connect(ui->actionBold, &QAction::toggled, this, [this](bool checked) {
|
||||
modifyColumnFormat(ui->dataTable->selectedCols(), [checked](CondFormat& format) { format.setBold(checked); });
|
||||
});
|
||||
connect(ui->actionItalic, &QAction::toggled, this, [this](bool checked) {
|
||||
modifyColumnFormat(ui->dataTable->selectedCols(), [checked](CondFormat& format) { format.setItalic(checked); });
|
||||
});
|
||||
connect(ui->actionUnderline, &QAction::toggled, this, [this](bool checked) {
|
||||
modifyColumnFormat(ui->dataTable->selectedCols(), [checked](CondFormat& format) { format.setUnderline(checked); });
|
||||
});
|
||||
|
||||
connect(ui->actionLeftAlign, &QAction::triggered, this, [this]() {
|
||||
ui->actionLeftAlign->setChecked(true);
|
||||
ui->actionRightAlign->setChecked(false);
|
||||
ui->actionCenter->setChecked(false);
|
||||
ui->actionJustify->setChecked(false);
|
||||
modifyColumnFormat(ui->dataTable->selectedCols(), [](CondFormat& format) { format.setAlignment(CondFormat::AlignLeft); });
|
||||
});
|
||||
connect(ui->actionRightAlign, &QAction::triggered, this, [this]() {
|
||||
ui->actionLeftAlign->setChecked(false);
|
||||
ui->actionRightAlign->setChecked(true);
|
||||
ui->actionCenter->setChecked(false);
|
||||
ui->actionJustify->setChecked(false);
|
||||
modifyColumnFormat(ui->dataTable->selectedCols(), [](CondFormat& format) { format.setAlignment(CondFormat::AlignRight); });
|
||||
});
|
||||
connect(ui->actionCenter, &QAction::triggered, this, [this]() {
|
||||
ui->actionLeftAlign->setChecked(false);
|
||||
ui->actionRightAlign->setChecked(false);
|
||||
ui->actionCenter->setChecked(true);
|
||||
ui->actionJustify->setChecked(false);
|
||||
modifyColumnFormat(ui->dataTable->selectedCols(), [](CondFormat& format) { format.setAlignment(CondFormat::AlignCenter); });
|
||||
});
|
||||
connect(ui->actionJustify, &QAction::triggered, this, [this]() {
|
||||
ui->actionLeftAlign->setChecked(false);
|
||||
ui->actionRightAlign->setChecked(false);
|
||||
ui->actionCenter->setChecked(false);
|
||||
ui->actionJustify->setChecked(true);
|
||||
modifyColumnFormat(ui->dataTable->selectedCols(), [](CondFormat& format) { format.setAlignment(CondFormat::AlignJustify); });
|
||||
});
|
||||
|
||||
connect(ui->actionEditCondFormats, &QAction::triggered, this, [this]() { editCondFormats(currentIndex().column()); });
|
||||
connect(ui->actionClearFormat, &QAction::triggered, this, [this]() {
|
||||
for (int column : ui->dataTable->selectedCols())
|
||||
clearAllCondFormats(column);
|
||||
});
|
||||
|
||||
connect(ui->dataTable, &ExtendedTableWidget::currentChanged, this, [this](const QModelIndex ¤t, const QModelIndex &) {
|
||||
// Get cell current format for updating the format toolbar values. Block signals, so the format change is not reapplied.
|
||||
QFont font = QFont(m_browseTableModel->data(current, Qt::FontRole).toString());
|
||||
ui->fontComboBox->blockSignals(true);
|
||||
ui->fontComboBox->setCurrentFont(font);
|
||||
ui->fontComboBox->blockSignals(false);
|
||||
|
||||
ui->fontSizeBox->blockSignals(true);
|
||||
ui->fontSizeBox->setValue(font.pointSize());
|
||||
ui->fontSizeBox->blockSignals(false);
|
||||
|
||||
ui->actionBold->blockSignals(true);
|
||||
ui->actionBold->setChecked(font.bold());
|
||||
ui->actionBold->blockSignals(false);
|
||||
|
||||
ui->actionItalic->blockSignals(true);
|
||||
ui->actionItalic->setChecked(font.italic());
|
||||
ui->actionItalic->blockSignals(false);
|
||||
|
||||
ui->actionUnderline->blockSignals(true);
|
||||
ui->actionUnderline->setChecked(font.underline());
|
||||
ui->actionUnderline->blockSignals(false);
|
||||
|
||||
Qt::Alignment align = Qt::Alignment(m_browseTableModel->data(current, Qt::TextAlignmentRole).toInt());
|
||||
ui->actionLeftAlign->blockSignals(true);
|
||||
ui->actionLeftAlign->setChecked(align.testFlag(Qt::AlignLeft));
|
||||
ui->actionLeftAlign->blockSignals(false);
|
||||
|
||||
ui->actionRightAlign->blockSignals(true);
|
||||
ui->actionRightAlign->setChecked(align.testFlag(Qt::AlignRight));
|
||||
ui->actionRightAlign->blockSignals(false);
|
||||
|
||||
ui->actionCenter->blockSignals(true);
|
||||
ui->actionCenter->setChecked(align.testFlag(Qt::AlignCenter));
|
||||
ui->actionCenter->blockSignals(false);
|
||||
|
||||
ui->actionJustify->blockSignals(true);
|
||||
ui->actionJustify->setChecked(align.testFlag(Qt::AlignJustify));
|
||||
ui->actionJustify->blockSignals(false);
|
||||
});
|
||||
|
||||
connect(ui->actionToggleFormatToolbar, &QAction::toggled, ui->formatFrame, &QFrame::setVisible);
|
||||
ui->actionToggleFormatToolbar->setChecked(false);
|
||||
ui->formatFrame->setVisible(false);
|
||||
}
|
||||
|
||||
TableBrowser::~TableBrowser()
|
||||
@@ -473,6 +582,35 @@ void TableBrowser::editCondFormats(int column)
|
||||
}
|
||||
}
|
||||
|
||||
void TableBrowser::modifyColumnFormat(std::unordered_set<int> columns, std::function<void(CondFormat&)> changeFunction)
|
||||
{
|
||||
for (int column : columns) {
|
||||
std::vector<CondFormat>& columnFormats = browseTableSettings[currentlyBrowsedTableName()].condFormats[column];
|
||||
|
||||
auto it = std::find_if(columnFormats.begin(), columnFormats.end(), [](const CondFormat& format) {
|
||||
return format.sqlCondition().isEmpty();
|
||||
});
|
||||
if(it != columnFormats.end()) {
|
||||
changeFunction(*it);
|
||||
m_browseTableModel->addCondFormat(column, *it);
|
||||
} else {
|
||||
|
||||
QFont font = QFont(Settings::getValue("databrowser", "font").toString());
|
||||
font.setPointSize(Settings::getValue("databrowser", "fontsize").toInt());
|
||||
|
||||
CondFormat newCondFormat(QString(""), QColor(Settings::getValue("databrowser", "reg_fg_colour").toString()),
|
||||
QColor(Settings::getValue("databrowser", "reg_bg_colour").toString()),
|
||||
font,
|
||||
CondFormat::AlignLeft,
|
||||
m_browseTableModel->encoding());
|
||||
changeFunction(newCondFormat);
|
||||
m_browseTableModel->addCondFormat(column, newCondFormat);
|
||||
browseTableSettings[currentlyBrowsedTableName()].condFormats[column].push_back(newCondFormat);
|
||||
}
|
||||
}
|
||||
emit projectModified();
|
||||
}
|
||||
|
||||
void TableBrowser::updateRecordsetLabel()
|
||||
{
|
||||
// Get all the numbers, i.e. the number of the first row and the last row as well as the total number of rows
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <QModelIndex>
|
||||
#include <QWidget>
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
class DBBrowserDB;
|
||||
class ExtendedTableWidget;
|
||||
class SqliteTableModel;
|
||||
@@ -169,6 +171,8 @@ private:
|
||||
static QString defaultBrowseTableEncoding;
|
||||
|
||||
Palette m_condFormatPalette;
|
||||
|
||||
void modifyColumnFormat(std::unordered_set<int> columns, std::function<void(CondFormat&)> changeFunction);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>552</width>
|
||||
<width>651</width>
|
||||
<height>362</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -14,6 +14,9 @@
|
||||
<string>Browse Data</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@@ -28,6 +31,12 @@
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
@@ -74,6 +83,8 @@
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionNewRecord"/>
|
||||
<addaction name="actionDeleteRecord"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionToggleFormatToolbar"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -97,6 +108,64 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="formatFrame">
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutFormat">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFontComboBox" name="fontComboBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="fontSizeBox">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolBar" name="formatToolbar">
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonIconOnly</enum>
|
||||
</property>
|
||||
<addaction name="actionBold"/>
|
||||
<addaction name="actionItalic"/>
|
||||
<addaction name="actionUnderline"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionFontColor"/>
|
||||
<addaction name="actionBackgroundColor"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionLeftAlign"/>
|
||||
<addaction name="actionCenter"/>
|
||||
<addaction name="actionRightAlign"/>
|
||||
<addaction name="actionJustify"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionEditCondFormats"/>
|
||||
<addaction name="actionClearFormat"/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ExtendedTableWidget" name="dataTable">
|
||||
<property name="acceptDrops">
|
||||
@@ -127,6 +196,18 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonBegin">
|
||||
<property name="enabled">
|
||||
@@ -507,6 +588,186 @@
|
||||
<enum>Qt::WidgetShortcut</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionBold">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/text_bold.png</normaloff>:/icons/text_bold.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bold</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Bold</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+B</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionItalic">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/text_italic.png</normaloff>:/icons/text_italic.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Italic</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Italic</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUnderline">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/text_underline.png</normaloff>:/icons/text_underline.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Underline</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Underline</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+U</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRightAlign">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/text_align_right.png</normaloff>:/icons/text_align_right.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Align Right</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Align Right</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLeftAlign">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/text_align_left.png</normaloff>:/icons/text_align_left.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Align Left</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Align Left</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCenter">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/text_align_center.png</normaloff>:/icons/text_align_center.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Center Horizontally</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Center Horizontally</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionJustify">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/text_align_justify.png</normaloff>:/icons/text_align_justify.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Justify</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Justify</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEditCondFormats">
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/edit_cond_formats</normaloff>:/icons/edit_cond_formats</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit Conditional Formats...</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Edit Conditional Formats...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClearFormat">
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/clear_cond_formats</normaloff>:/icons/clear_cond_formats</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear Format</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Clear All Conditional Formats</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFontColor">
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/foreground_color</normaloff>:/icons/foreground_color</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Font Color</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Font Color</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionBackgroundColor">
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/background_color</normaloff>:/icons/background_color</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Background Color</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Background Color</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionToggleFormatToolbar">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/cond_formats</normaloff>:/icons/cond_formats</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Toggle Format Toolbar</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Show/hide format toolbar</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>This button shows or hides the formatting toolbar of the Data Browser</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>This button shows or hides the formatting toolbar of the Data Browser</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
||||
|
Before Width: | Height: | Size: 445 B |
@@ -80,12 +80,21 @@
|
||||
<file alias="field_fk">page_foreign_key.png</file>
|
||||
<file alias="save_all">save_all.png</file>
|
||||
<file alias="word_wrap">page_white_text.png</file>
|
||||
<file alias="cond_formats">color_swatch.png</file>
|
||||
<file alias="clear_cond_formats">clear_cond_formats.png</file>
|
||||
<file alias="edit_cond_formats">edit_cond_formats.png</file>
|
||||
<file>color_swatch.png</file>
|
||||
<file>edit_cond_formats.png</file>
|
||||
<file alias="clear_sorting">clear_sorting.png</file>
|
||||
<file>text_bold.png</file>
|
||||
<file>text_italic.png</file>
|
||||
<file>text_underline.png</file>
|
||||
<file>text_align_center.png</file>
|
||||
<file>text_align_justify.png</file>
|
||||
<file>text_align_left.png</file>
|
||||
<file>text_align_right.png</file>
|
||||
<file alias="background_color">page_paintbrush.png</file>
|
||||
<file alias="foreground_color">text_paintbrush.png</file>
|
||||
<file alias="cond_formats">style.png</file>
|
||||
<file alias="edit_cond_formats">style_edit.png</file>
|
||||
<file alias="clear_cond_formats">style_delete.png</file>
|
||||
<file alias="add_cond_format">style_add.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
BIN
src/icons/page_paintbrush.png
Normal file
|
After Width: | Height: | Size: 813 B |
BIN
src/icons/style.png
Normal file
|
After Width: | Height: | Size: 813 B |
BIN
src/icons/style_add.png
Normal file
|
After Width: | Height: | Size: 844 B |
BIN
src/icons/style_delete.png
Normal file
|
After Width: | Height: | Size: 865 B |
BIN
src/icons/style_edit.png
Normal file
|
After Width: | Height: | Size: 927 B |
BIN
src/icons/text_align_center.png
Normal file
|
After Width: | Height: | Size: 234 B |
BIN
src/icons/text_align_justify.png
Normal file
|
After Width: | Height: | Size: 209 B |
BIN
src/icons/text_align_left.png
Normal file
|
After Width: | Height: | Size: 209 B |
BIN
src/icons/text_align_right.png
Normal file
|
After Width: | Height: | Size: 209 B |
BIN
src/icons/text_paintbrush.png
Normal file
|
After Width: | Height: | Size: 880 B |
@@ -822,7 +822,15 @@ std::vector<std::string> SqliteTableModel::getColumns(std::shared_ptr<sqlite3> p
|
||||
|
||||
void SqliteTableModel::addCondFormat(int column, const CondFormat& condFormat)
|
||||
{
|
||||
m_mCondFormats[column].push_back(condFormat);
|
||||
// If the condition is already present in the vector, update that entry and respect the order, since two entries with the same
|
||||
// condition do not make sense.
|
||||
auto it = std::find_if(m_mCondFormats[column].begin(), m_mCondFormats[column].end(), [condFormat](const CondFormat& format) {
|
||||
return format.sqlCondition() == condFormat.sqlCondition();
|
||||
});
|
||||
if(it != m_mCondFormats[column].end()) {
|
||||
*it = condFormat;
|
||||
} else
|
||||
m_mCondFormats[column].push_back(condFormat);
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
|
||||