Make that QXlsx::Document is the only subclass of QObject
This commit is contained in:
@@ -12,7 +12,7 @@ namespace QXlsx {
|
|||||||
DocumentPrivate::DocumentPrivate(Document *p) :
|
DocumentPrivate::DocumentPrivate(Document *p) :
|
||||||
q_ptr(p), defaultPackageName(QStringLiteral("Book1.xlsx"))
|
q_ptr(p), defaultPackageName(QStringLiteral("Book1.xlsx"))
|
||||||
{
|
{
|
||||||
workbook = new Workbook(p);
|
workbook = QSharedPointer<Workbook>(new Workbook);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DocumentPrivate::init()
|
void DocumentPrivate::init()
|
||||||
@@ -147,7 +147,7 @@ QStringList Document::documentPropertyNames() const
|
|||||||
Workbook *Document::workbook() const
|
Workbook *Document::workbook() const
|
||||||
{
|
{
|
||||||
Q_D(const Document);
|
Q_D(const Document);
|
||||||
return d->workbook;
|
return d->workbook.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Document::addWorksheet(const QString &name)
|
bool Document::addWorksheet(const QString &name)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public:
|
|||||||
QString packageName; //name of the .xlsx file
|
QString packageName; //name of the .xlsx file
|
||||||
|
|
||||||
QMap<QString, QString> documentProperties; //core, app and custom properties
|
QMap<QString, QString> documentProperties; //core, app and custom properties
|
||||||
Workbook *workbook;
|
QSharedPointer<Workbook> workbook;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
namespace QXlsx {
|
namespace QXlsx {
|
||||||
|
|
||||||
Drawing::Drawing(QObject *parent) :
|
Drawing::Drawing()
|
||||||
QObject(parent)
|
|
||||||
{
|
{
|
||||||
embedded = false;
|
embedded = false;
|
||||||
orientation = 0;
|
orientation = 0;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#ifndef QXLSX_DRAWING_H
|
#ifndef QXLSX_DRAWING_H
|
||||||
#define QXLSX_DRAWING_H
|
#define QXLSX_DRAWING_H
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
class QIODevice;
|
class QIODevice;
|
||||||
|
|
||||||
@@ -28,11 +28,10 @@ struct XlsxDrawingDimensionData
|
|||||||
int shape;
|
int shape;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Drawing : public QObject
|
class Drawing
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
explicit Drawing(QObject *parent = 0);
|
Drawing();
|
||||||
void saveToXmlFile(QIODevice *device);
|
void saveToXmlFile(QIODevice *device);
|
||||||
|
|
||||||
bool embedded;
|
bool embedded;
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
#define XLSXRELATIONSHIPS_H
|
#define XLSXRELATIONSHIPS_H
|
||||||
|
|
||||||
#include "xlsxglobal.h"
|
#include "xlsxglobal.h"
|
||||||
#include <QObject>
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QString>
|
||||||
class QIODevice;
|
class QIODevice;
|
||||||
|
|
||||||
namespace QXlsx {
|
namespace QXlsx {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ struct FillData;
|
|||||||
struct BorderData;
|
struct BorderData;
|
||||||
class XmlStreamWriter;
|
class XmlStreamWriter;
|
||||||
|
|
||||||
class XLSX_AUTOTEST_EXPORT Styles : public QObject
|
class XLSX_AUTOTEST_EXPORT Styles
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Styles();
|
Styles();
|
||||||
|
|||||||
@@ -55,14 +55,15 @@ WorkbookPrivate::WorkbookPrivate(Workbook *q) :
|
|||||||
table_count = 0;
|
table_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Workbook::Workbook(QObject *parent) :
|
Workbook::Workbook() :
|
||||||
QObject(parent), d_ptr(new WorkbookPrivate(this))
|
d_ptr(new WorkbookPrivate(this))
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Workbook::~Workbook()
|
Workbook::~Workbook()
|
||||||
{
|
{
|
||||||
|
qDeleteAll(d_ptr->worksheets);
|
||||||
delete d_ptr;
|
delete d_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#define XLSXWORKBOOK_H
|
#define XLSXWORKBOOK_H
|
||||||
|
|
||||||
#include "xlsxglobal.h"
|
#include "xlsxglobal.h"
|
||||||
#include <QObject>
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
@@ -45,9 +44,8 @@ class Document;
|
|||||||
class DocumentPrivate;
|
class DocumentPrivate;
|
||||||
|
|
||||||
class WorkbookPrivate;
|
class WorkbookPrivate;
|
||||||
class Q_XLSX_EXPORT Workbook : public QObject
|
class Q_XLSX_EXPORT Workbook
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
Q_DECLARE_PRIVATE(Workbook)
|
Q_DECLARE_PRIVATE(Workbook)
|
||||||
public:
|
public:
|
||||||
~Workbook();
|
~Workbook();
|
||||||
@@ -72,7 +70,7 @@ private:
|
|||||||
friend class Document;
|
friend class Document;
|
||||||
friend class DocumentPrivate;
|
friend class DocumentPrivate;
|
||||||
|
|
||||||
Workbook(QObject *parent=0);
|
Workbook();
|
||||||
|
|
||||||
void saveToXmlFile(QIODevice *device);
|
void saveToXmlFile(QIODevice *device);
|
||||||
QByteArray saveToXmlData();
|
QByteArray saveToXmlData();
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#define XLSXWORKSHEET_H
|
#define XLSXWORKSHEET_H
|
||||||
|
|
||||||
#include "xlsxglobal.h"
|
#include "xlsxglobal.h"
|
||||||
#include <QObject>
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|||||||
@@ -28,15 +28,13 @@
|
|||||||
|
|
||||||
namespace QXlsx {
|
namespace QXlsx {
|
||||||
|
|
||||||
ZipWriter::ZipWriter(const QString &filePath, QObject *parent) :
|
ZipWriter::ZipWriter(const QString &filePath)
|
||||||
QObject(parent)
|
|
||||||
{
|
{
|
||||||
m_writer = new QZipWriter(filePath, QIODevice::WriteOnly);
|
m_writer = new QZipWriter(filePath, QIODevice::WriteOnly);
|
||||||
m_writer->setCompressionPolicy(QZipWriter::NeverCompress);
|
m_writer->setCompressionPolicy(QZipWriter::NeverCompress);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZipWriter::ZipWriter(QIODevice *device, QObject *parent) :
|
ZipWriter::ZipWriter(QIODevice *device)
|
||||||
QObject(parent)
|
|
||||||
{
|
{
|
||||||
m_writer = new QZipWriter(device);
|
m_writer = new QZipWriter(device);
|
||||||
m_writer->setCompressionPolicy(QZipWriter::NeverCompress);
|
m_writer->setCompressionPolicy(QZipWriter::NeverCompress);
|
||||||
|
|||||||
@@ -25,18 +25,17 @@
|
|||||||
#ifndef QXLSX_ZIPWRITER_H
|
#ifndef QXLSX_ZIPWRITER_H
|
||||||
#define QXLSX_ZIPWRITER_H
|
#define QXLSX_ZIPWRITER_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QString>
|
||||||
class QIODevice;
|
class QIODevice;
|
||||||
class QZipWriter;
|
class QZipWriter;
|
||||||
|
|
||||||
namespace QXlsx {
|
namespace QXlsx {
|
||||||
|
|
||||||
class ZipWriter : public QObject
|
class ZipWriter
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
explicit ZipWriter(const QString &filePath, QObject *parent = 0);
|
explicit ZipWriter(const QString &filePath);
|
||||||
explicit ZipWriter(QIODevice *device, QObject *parent = 0);
|
explicit ZipWriter(QIODevice *device);
|
||||||
~ZipWriter();
|
~ZipWriter();
|
||||||
|
|
||||||
void addFile(const QString &filePath, QIODevice *device);
|
void addFile(const QString &filePath, QIODevice *device);
|
||||||
|
|||||||
Reference in New Issue
Block a user