UI for data filtering.

Icons for plugin grid operations.
print
Josef Rokos 9 years ago
parent 94fba56dab
commit d2f391558a

@ -23,7 +23,7 @@ void Accommodation::initServiceUi()
m_service = service; m_service = service;
m_ui = grid; m_ui = grid;
} }
/*
QWidget *Accommodation::ui() QWidget *Accommodation::ui()
{ {
QWidget *ui = IPlugin::ui(); QWidget *ui = IPlugin::ui();
@ -33,3 +33,4 @@ QWidget *Accommodation::ui()
return ui; return ui;
} }
*/

@ -26,7 +26,7 @@ protected:
// IPlugin interface // IPlugin interface
public: public:
QWidget *ui(); //QWidget *ui();
}; };
#endif // ACCOMMODATION_H #endif // ACCOMMODATION_H

@ -9,7 +9,8 @@ QT += widgets sql
TARGET = accommodation TARGET = accommodation
TEMPLATE = lib TEMPLATE = lib
DEFINES += ACCOMMODATION_LIBRARY DEFINES += ACCOMMODATION_LIBRARY\
_GLIBCXX_USE_CXX11_ABI=0
SOURCES += accommodation.cpp \ SOURCES += accommodation.cpp \
data/person.cpp \ data/person.cpp \

@ -11,6 +11,8 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = prodejna TARGET = prodejna
TEMPLATE = app TEMPLATE = app
DEFINES += _GLIBCXX_USE_CXX11_ABI=0
win32 { win32 {
INCLUDEPATH += d:/prac/odb/libodb-2.4.0 INCLUDEPATH += d:/prac/odb/libodb-2.4.0
INCLUDEPATH += d:/prac/odb/libodb-qt-2.4.0 INCLUDEPATH += d:/prac/odb/libodb-qt-2.4.0

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>825</width> <width>1000</width>
<height>538</height> <height>700</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -43,8 +43,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>825</width> <width>1000</width>
<height>21</height> <height>19</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">

@ -8,6 +8,7 @@
#include "define.h" #include "define.h"
#include "core_global.h" #include "core_global.h"
#include "exprevaluator.h"
template<class T> template<class T>
class AutoTableModel : public QAbstractTableModel class AutoTableModel : public QAbstractTableModel
@ -17,6 +18,7 @@ public:
explicit AutoTableModel(QObject *parent = NULL) explicit AutoTableModel(QObject *parent = NULL)
:QAbstractTableModel(parent) :QAbstractTableModel(parent)
{ {
filtered = false;
} }
virtual ~AutoTableModel() {} virtual ~AutoTableModel() {}
@ -139,8 +141,38 @@ public:
m_list = list; m_list = list;
} }
public slots:
void filter(const QString &filter)
{
beginResetModel();
if (!filtered)
{
m_fullList = m_list;
filtered = true;
}
ExprEvaluator ev;
m_list.clear();
std::copy_if(ALL(m_fullList), m_list.begin(), [&filter, &ev](QSharedPointer<T> obj){ return ev.evaluate((QObject*)obj.pointer, filter); });
endResetModel();
}
void restore()
{
if (filtered)
{
beginResetModel();
m_list = m_fullList;
endResetModel();
filtered = false;
}
}
private: private:
QList<QSharedPointer<T> > m_list; QList<QSharedPointer<T> > m_list;
QList<QSharedPointer<T> > m_fullList;
bool filtered;
}; };

@ -4,12 +4,15 @@
# #
#------------------------------------------------- #-------------------------------------------------
#iconset: https://www.iconfinder.com/iconsets/snipicons
QT += widgets sql QT += widgets sql
TARGET = core TARGET = core
TEMPLATE = lib TEMPLATE = lib
DEFINES += CORE_LIBRARY DEFINES += CORE_LIBRARY \
_GLIBCXX_USE_CXX11_ABI=0
SOURCES += \ SOURCES += \
data/user.cpp \ data/user.cpp \
@ -33,7 +36,9 @@ SOURCES += \
roles/roles.cpp \ roles/roles.cpp \
roles/rolesui.cpp \ roles/rolesui.cpp \
roles/rolesform.cpp \ roles/rolesform.cpp \
permissionservice.cpp permissionservice.cpp \
filterui.cpp \
exprevaluator.cpp
HEADERS += core.h\ HEADERS += core.h\
core_global.h \ core_global.h \
@ -66,7 +71,9 @@ HEADERS += core.h\
roles/roles.h \ roles/roles.h \
roles/rolesui.h \ roles/rolesui.h \
roles/rolesform.h \ roles/rolesform.h \
permissionservice.h permissionservice.h \
filterui.h \
exprevaluator.h
unix { unix {
target.path = /usr/lib target.path = /usr/lib
@ -95,7 +102,8 @@ FORMS += \
formdialog.ui \ formdialog.ui \
users/userform.ui \ users/userform.ui \
columndialog.ui \ columndialog.ui \
roles/rolesform.ui roles/rolesform.ui \
filterui.ui
OTHER_FILES += \ OTHER_FILES += \
users/metaData.json \ users/metaData.json \

@ -0,0 +1,41 @@
#include "exprevaluator.h"
#ifdef _MSC_VER
ExprEvaluator::ExprEvaluator()
{
m_operations["=="] = [](QVariant left, QVariant right) { return left == right; };
m_operations["!="] = [](QVariant left, QVariant right) { return left != right; };
m_operations["<"] = [](QVariant left, QVariant right) { return left < right; };
m_operations["<="] = [](QVariant left, QVariant right) { return left <= right; };
m_operations[">"] = [](QVariant left, QVariant right) { return left > right; };
m_operations[">="] = [](QVariant left, QVariant right) { return left >= right; };
m_operations["%"] = [](QVariant left, QVariant right) { return left.toString().contains(right.toString()); };
m_operations["||"] = [](QVariant left, QVariant right) { return left.toBool() || right.toBool(); };
m_operations["&&"] = [](QVariant left, QVariant right) { return left.toBool() && right.toBool(); };
}
#else
const QMap<QString, std::function<bool(QVariant, QVariant)> > ExprEvaluator::m_operations = {
{ "==", [](QVariant left, QVariant right) { return left == right; }},
{ "!=", [](QVariant left, QVariant right) { return left != right; }},
{ "<", [](QVariant left, QVariant right) { return left < right; }},
{ "<=", [](QVariant left, QVariant right) { return left <= right; }},
{ ">", [](QVariant left, QVariant right) { return left > right; }},
{ ">=", [](QVariant left, QVariant right) { return left >= right; }},
{ "%", [](QVariant left, QVariant right) { return left.toString().contains(right.toString()); }},
{ "||", [](QVariant left, QVariant right) { return left.toBool() || right.toBool(); }},
{ "&&", [](QVariant left, QVariant right) { return left.toBool() && right.toBool(); }}
};
ExprEvaluator::ExprEvaluator()
{
}
#endif
bool ExprEvaluator::evaluate(const QObject *data, const QString &expression)
{
return true;
}

@ -0,0 +1,26 @@
#ifndef EXPREVALUATOR_H
#define EXPREVALUATOR_H
#include <QMap>
#include <QString>
#include <QVariant>
#include <functional>
class ExprEvaluator
{
public:
ExprEvaluator();
bool evaluate(const QObject *data, const QString &expression);
private:
#ifdef _MSC_VER
QMap<QString, std::function<bool(QVariant, QVariant)> > m_operations;
#else
static const QMap<QString, std::function<bool(QVariant, QVariant)> > m_operations;
#endif
bool m_caseSensitive;
};
#endif // EXPREVALUATOR_H

@ -0,0 +1,208 @@
#include "filterui.h"
#include "ui_filterui.h"
#include <QComboBox>
#include <QMetaProperty>
#include <QTableWidgetItem>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include <QDateEdit>
#include <QDateTimeEdit>
#include <QLineEdit>
#include <QToolButton>
FilterUi::FilterUi(QWidget *parent, QObject *entity) :
QWidget(parent),
ui(new Ui::FilterUi)
{
ui->setupUi(this);
m_entity = entity;
if (entity == NULL)
{
return;
}
m_entity->setParent(this);
addRow(false);
m_contextMenu = new QMenu(this);
m_contextMenu->addAction(ui->actionAdd_condition_AND);
m_contextMenu->addAction(ui->actionAdd_condition_OR);
}
FilterUi::~FilterUi()
{
delete ui;
}
void FilterUi::on_actionAdd_condition_AND_triggered()
{
addRow(false);
}
void FilterUi::on_actionAdd_condition_OR_triggered()
{
addRow(true);
}
void FilterUi::addRow(bool isOr)
{
if (m_entity == NULL)
{
Q_ASSERT(false);
return;
}
int row = ui->tableWidget->rowCount();
ui->tableWidget->setRowCount(row + 1);
QComboBox *properties = new QComboBox(this);
for (int i = 1; i < m_entity->metaObject()->propertyCount(); i++)
{
properties->addItem(tr(m_entity->metaObject()->property(i).name()), m_entity->metaObject()->property(i).name());
}
QComboBox *oper = new QComboBox(this);
oper->addItems(QStringList() << "==" << "%" << "!=" << "<" << "<=" << ">" << ">=");
ui->tableWidget->setCellWidget(row, 2, oper);
void (QComboBox::*indexChanged)(int) = &QComboBox::currentIndexChanged;
connect(properties, indexChanged, [this, oper, row](int index){
this->propertyChanged(row, oper, index);
});
ui->tableWidget->setCellWidget(row, 1, properties);
if (row > 0)
{
QComboBox *rowOper = new QComboBox(this);
rowOper->addItems(QStringList() << tr("OR") << tr("AND"));
rowOper->setCurrentIndex(isOr ? 0 : 1);
ui->tableWidget->setCellWidget(row, 0, rowOper);
QToolButton *tb = new QToolButton(this);
tb->setText("-");
connect(tb, &QToolButton::clicked, [this, tb](){
int row = ui->tableWidget->rowAt(tb->y());
ui->tableWidget->removeRow(row);
});
ui->tableWidget->setCellWidget(row, 4, tb);
}
else
{
ui->tableWidget->setColumnWidth(1, 150);
ui->tableWidget->setColumnWidth(2, 50);
ui->tableWidget->setColumnWidth(3, 300);
ui->tableWidget->setColumnWidth(4, 50);
}
propertyChanged(row, oper, 0);
}
QString FilterUi::buildExpression() const
{
QString expr;
for (int i = 0; i < ui->tableWidget->rowCount(); i++)
{
if (i == 0)
{
expr = qobject_cast<QComboBox*>(ui->tableWidget->cellWidget(i, 1))->currentData(Qt::UserRole).toString();
}
else
{
expr += " " + QString(qobject_cast<QComboBox*>(ui->tableWidget->cellWidget(i, 0))->currentIndex() == 0 ? "||" : "&&");
expr += " " + qobject_cast<QComboBox*>(ui->tableWidget->cellWidget(i, 1))->currentData(Qt::UserRole).toString();
}
expr += " " + qobject_cast<QComboBox*>(ui->tableWidget->cellWidget(i, 2))->currentText();
QWidget *cellWidget = ui->tableWidget->cellWidget(i, 3);
if (cellWidget != NULL)
{
expr += " " + cellWidget->property(cellWidget->metaObject()->userProperty().name()).toString();
}
}
return expr;
}
void FilterUi::on_tableWidget_customContextMenuRequested(const QPoint &pos)
{
m_contextMenu->popup(ui->tableWidget->viewport()->mapToGlobal(pos));
}
void FilterUi::on_actionRemove_condition_triggered()
{
QObject *action = sender();
ui->tableWidget->removeRow(action->property("row").toInt());
}
void FilterUi::on_btnGo_toggled(bool checked)
{
if (checked)
{
emit applyFilter(buildExpression());
}
else
{
emit restoreData();
}
}
void FilterUi::propertyChanged(int row, QComboBox *oper, int index)
{
QWidget *cellWidget = ui->tableWidget->cellWidget(row, 3);
ui->tableWidget->removeCellWidget(row, 3);
if (cellWidget != NULL)
{
delete cellWidget;
cellWidget = NULL;
}
oper->clear();
switch (this->m_entity->metaObject()->property(index + 1).type()) {
case QVariant::Bool:
oper->addItems(QStringList() << "==" << "!=");
cellWidget = new QComboBox(this);
qobject_cast<QComboBox*>(cellWidget)->addItem("true", 1);
qobject_cast<QComboBox*>(cellWidget)->addItem("false", 0);
break;
case QVariant::String:
oper->addItems(QStringList() << "==" << "%" << "!=" << "<" << "<=" << ">" << ">=");
cellWidget = new QLineEdit(this);
break;
case QVariant::Int:
oper->addItems(QStringList() << "==" << "!=" << "<" << "<=" << ">" << ">=");
cellWidget = new QSpinBox(this);
break;
case QVariant::Double:
oper->addItems(QStringList() << "==" << "!=" << "<" << "<=" << ">" << ">=");
cellWidget = new QDoubleSpinBox(this);
break;
case QVariant::Date:
oper->addItems(QStringList() << "==" << "!=" << "<" << "<=" << ">" << ">=");
cellWidget = new QDateEdit(this);
qobject_cast<QDateEdit*>(cellWidget)->setCalendarPopup(true);
break;
case QVariant::DateTime:
oper->addItems(QStringList() << "==" << "!=" << "<" << "<=" << ">" << ">=");
cellWidget = new QDateTimeEdit(this);
qobject_cast<QDateTimeEdit*>(cellWidget)->setCalendarPopup(true);
break;
default:
oper->addItems(QStringList() << "==" << "!=" << "<" << "<=" << ">" << ">=");
cellWidget = new QLineEdit(this);
break;
}
if (cellWidget != NULL)
{
ui->tableWidget->setCellWidget(row, 3, cellWidget);
}
}

@ -0,0 +1,43 @@
#ifndef FILTERUI_H
#define FILTERUI_H
#include <QWidget>
#include <QMenu>
#include <QComboBox>
#include "core_global.h"
namespace Ui {
class FilterUi;
}
class CORESHARED_EXPORT FilterUi : public QWidget
{
Q_OBJECT
public:
explicit FilterUi(QWidget *parent = 0, QObject *entity = NULL);
~FilterUi();
private slots:
void on_actionAdd_condition_AND_triggered();
void on_actionAdd_condition_OR_triggered();
void on_tableWidget_customContextMenuRequested(const QPoint &pos);
void on_actionRemove_condition_triggered();
void on_btnGo_toggled(bool checked);
signals:
void applyFilter(const QString &filter);
void restoreData();
private:
Ui::FilterUi *ui;
void addRow(bool isOr);
QObject *m_entity;
QMenu *m_contextMenu;
QString buildExpression() const;
void propertyChanged(int row, QComboBox *oper, int index);
};
#endif // FILTERUI_H

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FilterUi</class>
<widget class="QWidget" name="FilterUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>667</width>
<height>177</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="filterWidget" native="true">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>150</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>6</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Load filter:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboLoad"/>
</item>
<item>
<widget class="QPushButton" name="btnGo">
<property name="text">
<string>Go</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnSave">
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTableWidget" name="tableWidget">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="rowCount">
<number>0</number>
</property>
<property name="columnCount">
<number>5</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column/>
<column/>
<column/>
<column/>
<column/>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
<action name="actionAdd_condition_AND">
<property name="text">
<string>Add condition &quot;AND&quot;</string>
</property>
</action>
<action name="actionAdd_condition_OR">
<property name="text">
<string>Add condition &quot;OR&quot;</string>
</property>
</action>
<action name="actionRemove_condition">
<property name="text">
<string>Remove condition</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>

@ -4,6 +4,7 @@
#include <QWidget> #include <QWidget>
#include <QMessageBox> #include <QMessageBox>
#include <QHeaderView> #include <QHeaderView>
#include <QLayout>
#include "autoform.h" #include "autoform.h"
#include "autotablemodel.h" #include "autotablemodel.h"
@ -23,6 +24,9 @@ public:
m_form = NULL; m_form = NULL;
m_tableModel = NULL; m_tableModel = NULL;
m_formHandler = new DefaultFormHandler(); m_formHandler = new DefaultFormHandler();
m_filterUi = new FilterUi(this, new T);
filterWidget()->layout()->addWidget(m_filterUi);
} }
virtual ~GridForm() virtual ~GridForm()
{ {

@ -19,9 +19,28 @@
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QToolButton" name="btnNew"> <widget class="QToolButton" name="btnNew">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text"> <property name="text">
<string>N</string> <string>N</string>
</property> </property>
<property name="icon">
<iconset resource="rc.qrc">
<normaloff>:/icons/new.svg</normaloff>:/icons/new.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonFollowStyle</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -29,6 +48,19 @@
<property name="text"> <property name="text">
<string>E</string> <string>E</string>
</property> </property>
<property name="icon">
<iconset resource="rc.qrc">
<normaloff>:/icons/edit.svg</normaloff>:/icons/edit.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -36,6 +68,19 @@
<property name="text"> <property name="text">
<string>D</string> <string>D</string>
</property> </property>
<property name="icon">
<iconset resource="rc.qrc">
<normaloff>:/icons/remove.svg</normaloff>:/icons/remove.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -43,6 +88,22 @@
<property name="text"> <property name="text">
<string>F</string> <string>F</string>
</property> </property>
<property name="icon">
<iconset resource="rc.qrc">
<normaloff>:/icons/filter.svg</normaloff>:/icons/filter.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -50,6 +111,19 @@
<property name="text"> <property name="text">
<string>P</string> <string>P</string>
</property> </property>
<property name="icon">
<iconset resource="rc.qrc">
<normaloff>:/icons/print.svg</normaloff>:/icons/print.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -68,6 +142,17 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QWidget" name="filterWidget" native="true">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>150</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2"/>
</widget>
</item>
<item> <item>
<widget class="QTableView" name="tableView"> <widget class="QTableView" name="tableView">
<property name="contextMenuPolicy"> <property name="contextMenuPolicy">
@ -91,6 +176,8 @@
</property> </property>
</action> </action>
</widget> </widget>
<resources/> <resources>
<include location="rc.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>

@ -0,0 +1 @@
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient gradientUnits="userSpaceOnUse" id="a" x1="390.983" x2="109.017" y1="87.969" y2="87.969"><stop offset="0" stop-color="#008BFF"/><stop offset="1" stop-color="#0af"/></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="b" x1="360.005" x2="139.997" y1="295" y2="295"><stop offset="0" stop-color="#008BFF"/><stop offset="1" stop-color="#0af"/></linearGradient></defs><g><path d="M391 110c0-24-20-44-44-44h-194c-24 0-44 20-44 44h282z" fill="url(#a)" stroke="#434242" stroke-width="10"/><path d="M390 130h-280v294c0 20 16 36 36 36h208c20 0 36-16 36-36v-294z" fill="#434242" stroke="#434242" stroke-width="10"/><path d="M307 63c0-10-8-18-18-18h-78c-10 0-18 8-18 18h114z" fill="#434242"/><path d="M150 170h10c6 0 10 4 10 10v230c0 6-4 10-10 10h-10c-6 0-10-4-10-10v-230c0-6 4-10 10-10zm60 0h10c6 0 10 4 10 10v230c0 6-4 10-10 10h-10c-6 0-10-4-10-10v-230c0-6 4-10 10-10zm70 0h10c6 0 10 4 10 10v230c0 6-4 10-10 10h-10c-6 0-10-4-10-10v-230c0-6 4-10 10-10zm60 0h10c6 0 10 4 10 10v230c0 6-4 10-10 10h-10c-6 0-10-4-10-10v-230c0-6 4-10 10-10z" fill="url(#b)"/></g></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -0,0 +1,13 @@
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs><style type="text/css"><![CDATA[
.str2 {stroke:#434242;stroke-width:5}
.str0 {stroke:#434242;stroke-width:10;stroke-linecap:round;stroke-linejoin:round}
.str1 {stroke:#434242;stroke-width:15;stroke-linejoin:round}
.fil2 {fill:#434242}
.fil1 {fill:#FEFEFE}
.fil5 {fill:#0075D8}
.fil6 {fill:#008BFF}
.fil7 {fill:#289CFF}
.fil3 {fill:#979798}
.fil4 {fill:#CDCDCE}
.fil0 {fill:#FFFFFF}
]]></style></defs><g id="Layer_x0020_1"><path class="fil0 str0" d="M190 30h140c11 0 20 9 20 20v400c0 11-9 20-20 20h-280c-11 0-20-9-20-20v-260l160-160z"/><path class="fil1 str0" d="M160 190h-130l160-160v130c0 17-14 30-30 30z"/><path class="fil2 str1" d="M400 88l64 63c6 6 6 16 0 22l-202 201-127 43 42-128 202-201c6-6 15-6 21 0z"/><rect class="fil3" height="219.999" transform="matrix(-2.121 -2.121 .064 -.064 424.911 211.53)" width="39.999"/><polygon class="fil4" points="177,289 262,374 135,417"/><rect class="fil5" height="229.998" transform="matrix(.707 .707 -.707 .707 396.628 183.246)" width="39.997"/><rect class="fil6" height="230.001" transform="matrix(.707 .707 -.707 .707 368.344 154.959)" width="39.999"/><rect class="fil7" height="230.001" transform="matrix(.707 .707 -.707 .707 340.059 126.675)" width="40.001"/><path class="fil2 str2" d="M135 417l66-23c-3-10-9-19-17-27-7-8-17-13-27-17l-22 67z"/></g></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -0,0 +1,6 @@
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 5000 5000" xmlns="http://www.w3.org/2000/svg"><defs><style type="text/css"><![CDATA[
.str1 {stroke:#434242;stroke-width:100}
.str0 {stroke:#434242;stroke-width:100;stroke-linejoin:round}
.fil0 {fill:url(#id0)}
.fil1 {fill:url(#id1)}
]]></style><linearGradient gradientUnits="userSpaceOnUse" id="id0" x1="4299.96" x2="700" y1="2700" y2="2700"><stop offset="0" stop-color="#008BFF"/><stop offset="1" stop-color="#0af"/></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="id1" x1="2499.98" x2="2499.98" y1="300.01" y2="1099.98"><stop offset="0" stop-color="#FCFCFD"/><stop offset="1" stop-color="#fff"/></linearGradient></defs><g id="Layer_x0020_1"><path class="fil0 str0" d="M2200 4500l600 200v-2100c0-100 50-150 100-200l1400-1400v-300h-3600v311l1400 1389c50 50 100 100 100 204v1896z"/><ellipse class="fil1 str1" cx="2500" cy="700" rx="1800" ry="400"/></g></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1,6 @@
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs><style type="text/css"><![CDATA[
.str1 {stroke:#434242;stroke-width:10}
.str0 {stroke:#434242;stroke-width:15}
.fil1 {fill:#FFFFFF}
.fil0 {fill:url(#id0)}
]]></style><radialGradient cx="48%" fx="48%" fy="50%" id="id0"><stop offset="0" stop-color="#0af"/><stop offset="1" stop-color="#008BFF"/></radialGradient></defs><g id="Layer_x0020_1"><path class="fil0 str0" d="M30 250c0 122 98 220 220 220s220-98 220-220-98-220-220-220-220 98-220 220z"/><path class="fil1 str1" d="M293 120v88h87c5 0 10 4 10 10v64c0 6-5 11-10 11h-87v87c0 5-5 10-11 10h-64c-6 0-10-5-10-10v-87h-88c-5 0-10-5-10-11v-64c0-6 5-10 10-10h88v-88c0-5 4-10 10-10h64c6 0 11 5 11 10z"/></g></svg>

After

Width:  |  Height:  |  Size: 912 B

@ -0,0 +1,10 @@
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"><![CDATA[
.str1 {stroke:#434242;stroke-width:10}
.str0 {stroke:#434242;stroke-width:15}
.fil0 {fill:#434242}
.fil3 {fill:#008BFF}
.fil2 {fill:url(#id0)}
.fil5 {fill:url(#id1)}
.fil4 {fill:url(#id2)}
.fil1 {fill:url(#id3)}
]]></style><linearGradient gradientUnits="userSpaceOnUse" id="id0" x1="254.998" x2="254.998" y1="155.079" y2="325.077"><stop offset="0" stop-color="#008BFF"/><stop offset="1" stop-color="#0af"/></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="id1" x1="249.999" x2="249.999" y1="373.399" y2="426.599"><stop offset="0" stop-color="#FCFCFD"/><stop offset="1" stop-color="#fff"/></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="id2" x1="249.998" x2="249.998" y1="60.8" y2="129.202"/><linearGradient gradientUnits="userSpaceOnUse" id="id3" x1="249.999" x2="249.999" y1="182.68" y2="357.478"/></defs><g id="Layer_x0020_1"><path class="fil0" d="M70 135h360c5 0 10 5 10 10v240h-380v-240c0-5 5-10 10-10z"/><path class="fil1 str0" d="M55 155h390c8 0 15 7 15 15v205c0 6-5 10-10 10h-50c-15 0-20-30-40-30h-220c-20 0-25 30-40 30h-50c-5 0-10-4-10-10v-205c0-8 7-15 15-15z"/><path class="fil2 str1" d="M100 155h310v155c0 8-7 15-15 15h-280c-8 0-15-7-15-15v-155z"/><path class="fil3" d="M60 185h20v20h-20v-20zm0 40h20v10h-20v-10zm0 30h20v10h-20v-10z"/><path class="fil4 str1" d="M120 140h260v-80c0-5-5-10-10-10h-240c-6 0-10 4-10 10v80z"/><path class="fil5 str1" d="M355 365h-210c-3 0-6 1-8 4l-36 50c-2 3-2 7 0 11 1 3 5 5 8 5h282c3 0 7-2 8-5 2-4 2-8 0-11l-36-50c-2-3-5-4-8-4z"/></g></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -0,0 +1,6 @@
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs><style type="text/css"><![CDATA[
.str1 {stroke:#434242;stroke-width:10}
.str0 {stroke:#434242;stroke-width:15}
.fil1 {fill:#FFFFFF}
.fil0 {fill:url(#id0)}
]]></style><radialGradient cx="48%" fx="48%" fy="50%" id="id0"><stop offset="0" stop-color="#0af"/><stop offset="1" stop-color="#008BFF"/></radialGradient></defs><g id="Layer_x0020_1"><path class="fil0 str0" d="M30 250c0 122 98 220 220 220s220-98 220-220-98-220-220-220-220 98-220 220z"/><path class="fil1 str1" d="M380 208c5 0 10 4 10 10v64c0 6-5 11-10 11h-260c-5 0-10-5-10-11v-64c0-6 5-10 10-10h260z"/></g></svg>

After

Width:  |  Height:  |  Size: 825 B

@ -4,12 +4,14 @@
#include <QList> #include <QList>
#include "context.h" #include "context.h"
#include "filterui.h"
IGridForm::IGridForm(QWidget *parent) : IGridForm::IGridForm(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::GridForm) ui(new Ui::GridForm)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->filterWidget->setVisible(false);
m_contextMenu = new QMenu(this); m_contextMenu = new QMenu(this);
m_contextMenu->addAction(ui->actionSelectColumns); m_contextMenu->addAction(ui->actionSelectColumns);
@ -43,6 +45,11 @@ void IGridForm::hideColumns(const QList<int> &cols)
} }
} }
QWidget *IGridForm::filterWidget()
{
return ui->filterWidget;
}
void IGridForm::on_btnNew_clicked() void IGridForm::on_btnNew_clicked()
{ {
@ -88,3 +95,16 @@ void IGridForm::columnsAccepted()
Context::instance().settings()->setValue("grids/" + pluginId() + "/hide", QVariant::fromValue(varList)); Context::instance().settings()->setValue("grids/" + pluginId() + "/hide", QVariant::fromValue(varList));
} }
void IGridForm::on_btnFilter_toggled(bool checked)
{
if (checked)
{
ui->filterWidget->setVisible(true);
}
else
{
ui->filterWidget->setVisible(false);
}
}

@ -8,6 +8,7 @@
#include <QList> #include <QList>
#include "columndialog.h" #include "columndialog.h"
#include "filterui.h"
#include "defaultformhandler.h" #include "defaultformhandler.h"
#include "core_global.h" #include "core_global.h"
@ -37,8 +38,8 @@ protected:
virtual void handleNewRecord() = 0; virtual void handleNewRecord() = 0;
virtual void handleEditRecord() = 0; virtual void handleEditRecord() = 0;
virtual void handleDeleteRecord() = 0; virtual void handleDeleteRecord() = 0;
void hideColumns(const QList<int> &cols); void hideColumns(const QList<int> &cols);
QWidget *filterWidget();
private slots: private slots:
void on_btnNew_clicked(); void on_btnNew_clicked();
@ -48,12 +49,17 @@ private slots:
void on_actionSelectColumns_triggered(); void on_actionSelectColumns_triggered();
void columnsAccepted(); void columnsAccepted();
void on_btnFilter_toggled(bool checked);
private: private:
QString m_pluginId; QString m_pluginId;
IFormHandler *m_formHandler; IFormHandler *m_formHandler;
Ui::GridForm *ui; Ui::GridForm *ui;
QMenu *m_contextMenu; QMenu *m_contextMenu;
ColumnDialog *m_columnDialog; ColumnDialog *m_columnDialog;
protected:
FilterUi *m_filterUi;
}; };
#endif // IGRIDFORM_H #endif // IGRIDFORM_H

@ -3,5 +3,11 @@
<file>metaData.json</file> <file>metaData.json</file>
<file>users/metaData.json</file> <file>users/metaData.json</file>
<file>roles/metaData.json</file> <file>roles/metaData.json</file>
<file>icons/new.svg</file>
<file>icons/edit.svg</file>
<file>icons/delete.svg</file>
<file>icons/remove.svg</file>
<file>icons/filter.svg</file>
<file>icons/print.svg</file>
</qresource> </qresource>
</RCC> </RCC>

Loading…
Cancel
Save