From 60f27c79a091569b51cddd22e517ed78931eea04 Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Wed, 12 Mar 2014 23:31:22 +0800 Subject: [PATCH] Make Format() constructed as fast as possible. QMetaType::type("XlsxColor") is not fast. --- src/xlsx/xlsxformat.cpp | 8 -------- src/xlsx/xlsxstyles.cpp | 9 +++++++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/xlsx/xlsxformat.cpp b/src/xlsx/xlsxformat.cpp index bfa9184..21b0e14 100755 --- a/src/xlsx/xlsxformat.cpp +++ b/src/xlsx/xlsxformat.cpp @@ -180,14 +180,6 @@ FormatPrivate::~FormatPrivate() */ Format::Format() { - if (QMetaType::type("XlsxColor") == QMetaType::UnknownType) { - //Fix me! Where should we put these register code? - qRegisterMetaType("XlsxColor"); - qRegisterMetaTypeStreamOperators("XlsxColor"); -#if QT_VERSION >= 0x050200 - QMetaType::registerDebugStreamOperator(); -#endif - } //The d pointer is initialized with a null pointer } diff --git a/src/xlsx/xlsxstyles.cpp b/src/xlsx/xlsxstyles.cpp index 03f1444..2c32bfb 100755 --- a/src/xlsx/xlsxstyles.cpp +++ b/src/xlsx/xlsxstyles.cpp @@ -47,6 +47,15 @@ Styles::Styles(CreateFlag flag) { //!Fix me. Should the custom num fmt Id starts with 164 or 176 or others?? + //!Fix me! Where should we put these register code? + if (QMetaType::type("XlsxColor") == QMetaType::UnknownType) { + qRegisterMetaType("XlsxColor"); + qRegisterMetaTypeStreamOperators("XlsxColor"); +#if QT_VERSION >= 0x050200 + QMetaType::registerDebugStreamOperator(); +#endif + } + if (flag == F_NewFromScratch) { //Add default Format Format defaultFmt;