0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-23 16:22:58 +03:00
LimeReport/demo_r2/mainwindow.h

69 lines
2.0 KiB
C
Raw Permalink Normal View History

2016-04-02 03:39:45 +03:00
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
2016-05-24 00:32:21 +03:00
#include <QComboBox>
#include <QDebug>
#include <QDir>
#include <QMainWindow>
2016-05-24 00:32:21 +03:00
#include <QSpinBox>
#include <QTreeWidget>
#include <LimeReport>
2016-04-02 03:39:45 +03:00
namespace Ui {
class MainWindow;
}
class MainWindow: public QMainWindow {
2016-04-02 03:39:45 +03:00
Q_OBJECT
public:
explicit MainWindow(QWidget* parent = 0);
2016-04-02 03:39:45 +03:00
~MainWindow();
2016-04-02 03:39:45 +03:00
private:
void enableUI(bool value);
private slots:
void slotScalePercentChanged(int percent);
void scaleComboboxChanged(QString text);
void slotPagesSet(int pagesCount);
void slotPageChanged(int page);
2016-05-24 00:32:21 +03:00
void slotPageNavigatorChanged(int page);
void on_treeWidget_itemClicked(QTreeWidgetItem* item, int);
// void on_sbPageNavigator_valueChanged(int arg1);
2016-05-24 00:32:21 +03:00
void slotDesignReport();
2016-05-24 00:39:56 +03:00
void slotOneToOne();
2016-04-02 03:39:45 +03:00
private:
template <typename T> void buildReportsTree(const QString& path, T* parentItem)
2016-04-02 03:39:45 +03:00
{
QDir reportsDir(path);
QStringList items = reportsDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
foreach (QString dir, items) {
2016-04-02 03:39:45 +03:00
QTreeWidgetItem* listItem = new QTreeWidgetItem(parentItem);
listItem->setText(0, dir);
listItem->setIcon(0, QIcon(":/images/images/folder.png"));
buildReportsTree(reportsDir.path() + "/" + dir, listItem);
2016-04-02 03:39:45 +03:00
}
QStringList nameFilters;
nameFilters << "*.lrxml";
2016-04-02 03:39:45 +03:00
items = reportsDir.entryList(nameFilters, QDir::Files);
foreach (QString file, items) {
2016-04-02 03:39:45 +03:00
QTreeWidgetItem* listItem = new QTreeWidgetItem(parentItem);
listItem->setIcon(0, QIcon(":/images/images/report.png"));
listItem->setText(0, file);
listItem->setData(0, Qt::UserRole, reportsDir.path() + "/" + file);
2016-04-02 03:39:45 +03:00
}
}
void initPercentCombobox();
2016-04-02 03:39:45 +03:00
private:
Ui::MainWindow* ui;
2016-04-02 03:39:45 +03:00
LimeReport::ReportEngine m_report;
LimeReport::PreviewReportWidget* m_preview;
2016-05-24 00:32:21 +03:00
QComboBox* m_scalePercent;
QSpinBox* m_pageNavigator;
2016-04-02 03:39:45 +03:00
};
#endif // MAINWINDOW_H