Import dialog and import progress moved to core library.
This commit is contained in:
+9
-3
@@ -63,7 +63,9 @@ SOURCES += \
|
|||||||
reporting/report.cpp \
|
reporting/report.cpp \
|
||||||
reporting/reportviewer.cpp \
|
reporting/reportviewer.cpp \
|
||||||
reporting/reportdialog.cpp \
|
reporting/reportdialog.cpp \
|
||||||
csvimporter.cpp
|
csvimporter.cpp \
|
||||||
|
importdialog.cpp \
|
||||||
|
importprogress.cpp
|
||||||
|
|
||||||
HEADERS += core.h\
|
HEADERS += core.h\
|
||||||
core_global.h \
|
core_global.h \
|
||||||
@@ -126,7 +128,9 @@ HEADERS += core.h\
|
|||||||
reporting/reportdialog.h \
|
reporting/reportdialog.h \
|
||||||
iimporter.h \
|
iimporter.h \
|
||||||
csvimporter.h \
|
csvimporter.h \
|
||||||
iimportprogress.h
|
iimportprogress.h \
|
||||||
|
importdialog.h \
|
||||||
|
importprogress.h
|
||||||
|
|
||||||
unix {
|
unix {
|
||||||
target.path = /usr/lib
|
target.path = /usr/lib
|
||||||
@@ -161,7 +165,9 @@ FORMS += \
|
|||||||
settings/globalsettingsform.ui \
|
settings/globalsettingsform.ui \
|
||||||
settings/seasonnamedialog.ui \
|
settings/seasonnamedialog.ui \
|
||||||
reporting/reportviewer.ui \
|
reporting/reportviewer.ui \
|
||||||
reporting/reportdialog.ui
|
reporting/reportdialog.ui \
|
||||||
|
importdialog.ui \
|
||||||
|
importprogress.ui
|
||||||
|
|
||||||
OTHER_FILES += \
|
OTHER_FILES += \
|
||||||
users/metaData.json \
|
users/metaData.json \
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
|
#include <QToolButton>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
#include "autoform.h"
|
#include "autoform.h"
|
||||||
#include "autotablemodel.h"
|
#include "autotablemodel.h"
|
||||||
@@ -12,6 +14,9 @@
|
|||||||
#include "iplugin.h"
|
#include "iplugin.h"
|
||||||
#include "igridform.h"
|
#include "igridform.h"
|
||||||
#include "iservice.h"
|
#include "iservice.h"
|
||||||
|
#include "importdialog.h"
|
||||||
|
#include "csvimporter.h"
|
||||||
|
#include "importprogress.h"
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
class GridForm : public IGridForm
|
class GridForm : public IGridForm
|
||||||
@@ -164,6 +169,8 @@ private:
|
|||||||
bool m_serviceConnected;
|
bool m_serviceConnected;
|
||||||
bool m_permissionDenied;
|
bool m_permissionDenied;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
// IGridForm interface
|
// IGridForm interface
|
||||||
protected:
|
protected:
|
||||||
void handleNewRecord() override
|
void handleNewRecord() override
|
||||||
@@ -216,6 +223,42 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showImportButton()
|
||||||
|
{
|
||||||
|
QHBoxLayout *tbLayout = qobject_cast<QHBoxLayout*>(this->toolbar()->layout());
|
||||||
|
|
||||||
|
if (tbLayout != NULL)
|
||||||
|
{
|
||||||
|
QToolButton *btnImport = new QToolButton(this->toolbar());
|
||||||
|
btnImport->setIcon(QIcon(":/icons/import.svg"));
|
||||||
|
btnImport->setAutoRaise(true);
|
||||||
|
btnImport->setIconSize(QSize(24, 24));
|
||||||
|
btnImport->setToolTip(tr("Import"));
|
||||||
|
tbLayout->insertWidget(tbLayout->count() - 1, btnImport);
|
||||||
|
|
||||||
|
connect(btnImport, &QToolButton::clicked, [this](){
|
||||||
|
ImportDialog *dlg = new ImportDialog(this);
|
||||||
|
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
dlg->show();
|
||||||
|
|
||||||
|
connect(dlg, &QDialog::accepted, [this, dlg](){
|
||||||
|
T dataObj;
|
||||||
|
CsvImporter importer(dataObj.metaObject());
|
||||||
|
|
||||||
|
importer.setImportFile(dlg->fileName());
|
||||||
|
importer.setSeparator(dlg->separator());
|
||||||
|
|
||||||
|
ImportProgress *progress = new ImportProgress();
|
||||||
|
progress->move(QApplication::desktop()->screen()->rect().center() - progress->rect().center());
|
||||||
|
progress->setWindowModality(Qt::ApplicationModal);
|
||||||
|
progress->show();
|
||||||
|
|
||||||
|
service()->importData(&importer, progress);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GRIDFORM_H
|
#endif // GRIDFORM_H
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 820 B After Width: | Height: | Size: 820 B |
@@ -0,0 +1,36 @@
|
|||||||
|
#include "importdialog.h"
|
||||||
|
#include "ui_importdialog.h"
|
||||||
|
#include "importprogress.h"
|
||||||
|
#include "csvimporter.h"
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
|
ImportDialog::ImportDialog(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::ImportDialog)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImportDialog::~ImportDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ImportDialog::fileName()
|
||||||
|
{
|
||||||
|
return ui->editFile->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ImportDialog::separator()
|
||||||
|
{
|
||||||
|
return ui->editSeparator->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImportDialog::on_btnFile_clicked()
|
||||||
|
{
|
||||||
|
QString file = QFileDialog::getOpenFileName(this, tr("Import file"), "", tr("All Files (*.*)"));
|
||||||
|
ui->editFile->setText(file);
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
#define IMPORTDIALOG_H
|
#define IMPORTDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QMetaObject>
|
||||||
|
#include "iservice.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ImportDialog;
|
class ImportDialog;
|
||||||
@@ -15,9 +17,10 @@ public:
|
|||||||
explicit ImportDialog(QWidget *parent = 0);
|
explicit ImportDialog(QWidget *parent = 0);
|
||||||
~ImportDialog();
|
~ImportDialog();
|
||||||
|
|
||||||
private slots:
|
QString fileName();
|
||||||
void on_buttonBox_accepted();
|
QString separator();
|
||||||
|
|
||||||
|
private slots:
|
||||||
void on_btnFile_clicked();
|
void on_btnFile_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -6,33 +6,44 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>518</width>
|
<width>454</width>
|
||||||
<height>152</height>
|
<height>115</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Import data</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<property name="horizontalSpacing">
|
<item row="0" column="0">
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="verticalSpacing">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>CSV file</string>
|
<string>File</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Separator</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="editSeparator"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
<widget class="QWidget" name="widget" native="true">
|
<widget class="QWidget" name="widget" native="true">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="spacing">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -58,30 +69,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" colspan="2">
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Field separator</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLineEdit" name="editSparator">
|
|
||||||
<property name="text">
|
|
||||||
<string>;</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#include "importprogress.h"
|
||||||
|
#include "ui_importprogress.h"
|
||||||
|
|
||||||
|
ImportProgress::ImportProgress(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::ImportProgress)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui->progressBar->setRange(0, 100);
|
||||||
|
ui->progressBar->setValue(0);
|
||||||
|
|
||||||
|
m_terminate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImportProgress::~ImportProgress()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImportProgress::on_btnCancel_clicked()
|
||||||
|
{
|
||||||
|
m_terminate = true;
|
||||||
|
this->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImportProgress::updateProgress(int currentPos)
|
||||||
|
{
|
||||||
|
ui->progressBar->setValue(currentPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImportProgress::terminate()
|
||||||
|
{
|
||||||
|
return m_terminate;
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#ifndef IMPORTPROGRESS_H
|
||||||
|
#define IMPORTPROGRESS_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "iimportprogress.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class ImportProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ImportProgress : public QWidget, public IImportProgress
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ImportProgress(QWidget *parent = 0);
|
||||||
|
~ImportProgress();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_btnCancel_clicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::ImportProgress *ui;
|
||||||
|
bool m_terminate;
|
||||||
|
|
||||||
|
// IImportProgress interface
|
||||||
|
public:
|
||||||
|
void updateProgress(int currentPos);
|
||||||
|
bool terminate();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // IMPORTPROGRESS_H
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ImportProgressForm</class>
|
<class>ImportProgress</class>
|
||||||
<widget class="QWidget" name="ImportProgressForm">
|
<widget class="QWidget" name="ImportProgress">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>369</width>
|
<width>400</width>
|
||||||
<height>134</height>
|
<height>165</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Import progress</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="btnCancel">
|
<widget class="QPushButton" name="btnCancel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Cancel</string>
|
<string>Cenacel</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -24,5 +24,6 @@
|
|||||||
<file>icons/zoomIn.svg</file>
|
<file>icons/zoomIn.svg</file>
|
||||||
<file>icons/zoomOut.svg</file>
|
<file>icons/zoomOut.svg</file>
|
||||||
<file>icons/report.svg</file>
|
<file>icons/report.svg</file>
|
||||||
|
<file>icons/import.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
CountryRegisterGrid::CountryRegisterGrid(QWidget *parent) : GridForm<CountryData>(parent)
|
CountryRegisterGrid::CountryRegisterGrid(QWidget *parent) : GridForm<CountryData>(parent)
|
||||||
{
|
{
|
||||||
setTableModel(new AutoTableModel<CountryData>());
|
setTableModel(new AutoTableModel<CountryData>());
|
||||||
|
showImportButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CountryRegisterGrid::canAddRecord()
|
bool CountryRegisterGrid::canAddRecord()
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
#include "importdialog.h"
|
|
||||||
#include "ui_importdialog.h"
|
|
||||||
|
|
||||||
#include <service.h>
|
|
||||||
#include <csvimporter.h>
|
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QFileDialog>
|
|
||||||
|
|
||||||
#include "data/postdata.h"
|
|
||||||
#include "postregister-odb.hxx"
|
|
||||||
#include "importprogressform.h"
|
|
||||||
|
|
||||||
ImportDialog::ImportDialog(QWidget *parent) :
|
|
||||||
QDialog(parent),
|
|
||||||
ui(new Ui::ImportDialog)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImportDialog::~ImportDialog()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImportDialog::on_buttonBox_accepted()
|
|
||||||
{
|
|
||||||
QString fileName = ui->editFile->text();
|
|
||||||
Service<PostData> service;
|
|
||||||
PostData pd;
|
|
||||||
CsvImporter importer(pd.metaObject());
|
|
||||||
|
|
||||||
importer.setImportFile(fileName);
|
|
||||||
importer.setSeparator(ui->editSparator->text());
|
|
||||||
|
|
||||||
ImportProgressForm *progress = new ImportProgressForm();
|
|
||||||
progress->move(QApplication::desktop()->screen()->rect().center() - progress->rect().center());
|
|
||||||
progress->setWindowModality(Qt::ApplicationModal);
|
|
||||||
progress->show();
|
|
||||||
service.importData(&importer, progress);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImportDialog::on_btnFile_clicked()
|
|
||||||
{
|
|
||||||
QString file = QFileDialog::getOpenFileName(this, tr("Import file"), "", tr("All Files (*.*)"));
|
|
||||||
ui->editFile->setText(file);
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
#include "importprogressform.h"
|
|
||||||
#include "ui_importprogressform.h"
|
|
||||||
|
|
||||||
ImportProgressForm::ImportProgressForm(QWidget *parent) :
|
|
||||||
QWidget(parent),
|
|
||||||
ui(new Ui::ImportProgressForm)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
ui->progressBar->setRange(0, 100);
|
|
||||||
ui->progressBar->setValue(0);
|
|
||||||
|
|
||||||
m_terminate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImportProgressForm::~ImportProgressForm()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImportProgressForm::on_btnCancel_clicked()
|
|
||||||
{
|
|
||||||
m_terminate = true;
|
|
||||||
this->close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImportProgressForm::updateProgress(int currentPos)
|
|
||||||
{
|
|
||||||
ui->progressBar->setValue(currentPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ImportProgressForm::terminate()
|
|
||||||
{
|
|
||||||
return m_terminate;
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#ifndef IMPORTPROGRESSFORM_H
|
|
||||||
#define IMPORTPROGRESSFORM_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <iimportprogress.h>
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class ImportProgressForm;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ImportProgressForm : public QWidget, public IImportProgress
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit ImportProgressForm(QWidget *parent = 0);
|
|
||||||
~ImportProgressForm();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void on_btnCancel_clicked();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::ImportProgressForm *ui;
|
|
||||||
bool m_terminate;
|
|
||||||
|
|
||||||
// IImportProgress interface
|
|
||||||
public:
|
|
||||||
void updateProgress(int currentPos);
|
|
||||||
bool terminate();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // IMPORTPROGRESSFORM_H
|
|
||||||
@@ -24,16 +24,12 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
|
|
||||||
SOURCES += postregister.cpp \
|
SOURCES += postregister.cpp \
|
||||||
data/postdata.cpp \
|
data/postdata.cpp \
|
||||||
postregistergrid.cpp \
|
postregistergrid.cpp
|
||||||
importdialog.cpp \
|
|
||||||
importprogressform.cpp
|
|
||||||
|
|
||||||
HEADERS += postregister.h\
|
HEADERS += postregister.h\
|
||||||
postregister_global.h \
|
postregister_global.h \
|
||||||
data/postdata.h \
|
data/postdata.h \
|
||||||
postregistergrid.h \
|
postregistergrid.h
|
||||||
importdialog.h \
|
|
||||||
importprogressform.h
|
|
||||||
|
|
||||||
include(../config_plugin.pri)
|
include(../config_plugin.pri)
|
||||||
|
|
||||||
@@ -44,9 +40,6 @@ include(../odb.pri)
|
|||||||
DISTFILES += \
|
DISTFILES += \
|
||||||
postregister.json
|
postregister.json
|
||||||
|
|
||||||
FORMS += \
|
FORMS +=
|
||||||
importdialog.ui \
|
|
||||||
importprogressform.ui
|
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES +=
|
||||||
postregisterrc.qrc
|
|
||||||
|
|||||||
@@ -3,30 +3,12 @@
|
|||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
|
||||||
#include "postregister-odb.hxx"
|
#include "postregister-odb.hxx"
|
||||||
#include "importdialog.h"
|
|
||||||
|
|
||||||
PostRegisterGrid::PostRegisterGrid(QWidget *parent)
|
PostRegisterGrid::PostRegisterGrid(QWidget *parent)
|
||||||
:GridForm<PostData>(parent)
|
:GridForm<PostData>(parent)
|
||||||
{
|
{
|
||||||
setTableModel(new AutoTableModel<PostData>());
|
setTableModel(new AutoTableModel<PostData>());
|
||||||
QHBoxLayout *tbLayout = qobject_cast<QHBoxLayout*>(this->toolbar()->layout());
|
showImportButton();
|
||||||
|
|
||||||
if (tbLayout != NULL)
|
|
||||||
{
|
|
||||||
QToolButton *btnImport = new QToolButton(this->toolbar());
|
|
||||||
btnImport->setIcon(QIcon(":/icons/import.svg"));
|
|
||||||
btnImport->setAutoRaise(true);
|
|
||||||
btnImport->setIconSize(QSize(24, 24));
|
|
||||||
btnImport->setToolTip(tr("Import"));
|
|
||||||
tbLayout->insertWidget(tbLayout->count() - 1, btnImport);
|
|
||||||
|
|
||||||
connect(btnImport, &QToolButton::clicked, [this](){
|
|
||||||
ImportDialog *dlg = new ImportDialog(this);
|
|
||||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
|
|
||||||
dlg->show();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PostRegisterGrid::canAddRecord()
|
bool PostRegisterGrid::canAddRecord()
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
<RCC>
|
|
||||||
<qresource prefix="/">
|
|
||||||
<file>icons/import.svg</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
||||||
Reference in New Issue
Block a user