diff --git a/autotests/ElementsTest.cpp b/autotests/ElementsTest.cpp --- a/autotests/ElementsTest.cpp +++ b/autotests/ElementsTest.cpp @@ -142,13 +142,13 @@ { // types KReportSection sec1; - QCOMPARE(sec1.type(), KReportSection::InvalidType); - QCOMPARE(KReportSection(sec1).type(), KReportSection::InvalidType); - sec1.setType(KReportSection::PageFooterFirst); + QCOMPARE(sec1.type(), KReportSection::Type::Invalid); + QCOMPARE(KReportSection(sec1).type(), KReportSection::Type::Invalid); + sec1.setType(KReportSection::Type::PageFooterFirst); KReportSection sec2(sec1); QCOMPARE(sec1.type(), sec2.type()); QCOMPARE(sec1, sec2); - sec1.setType(KReportSection::PageFooterEven); + sec1.setType(KReportSection::Type::PageFooterEven); QCOMPARE(sec1.type(), sec2.type()); // shared QCOMPARE(sec1, sec2); // shared diff --git a/autotests/format/FormatTest.cpp b/autotests/format/FormatTest.cpp --- a/autotests/format/FormatTest.cpp +++ b/autotests/format/FormatTest.cpp @@ -156,9 +156,9 @@ QCOMPARE(design.title(), QLatin1String("Label Element Test Report")); - QVERIFY(design.hasSection(KReportSection::Detail)); - KReportSection detailSection = design.section(KReportSection::Detail); - QCOMPARE(detailSection.type(), KReportSection::Detail); + QVERIFY(design.hasSection(KReportSection::Type::Detail)); + KReportSection detailSection = design.section(KReportSection::Type::Detail); + QCOMPARE(detailSection.type(), KReportSection::Type::Detail); QCOMPARE(detailSection.height(), CM_TO_POINT(5.0)); QCOMPARE(detailSection.backgroundColor(), QColor("#eeeeee")); diff --git a/src/common/KReportDesign.cpp b/src/common/KReportDesign.cpp --- a/src/common/KReportDesign.cpp +++ b/src/common/KReportDesign.cpp @@ -206,16 +206,16 @@ bool KReportDesign::hasSection(KReportSection::Type type) const { - const int index = type - 1; + const int index = static_cast(type) - 1; if (0 <= index && index < d->sections.length()) { return d->sections[index]; } return false; } KReportSection KReportDesign::section(KReportSection::Type type) const { - const int index = type - 1; + const int index = static_cast(type) - 1; if (0 <= index && index < d->sections.length()) { KReportSection *section = d->sections[index]; if (section) { @@ -227,7 +227,7 @@ void KReportDesign::addSection(const KReportSection §ion) { - const int index = section.type() - 1; + const int index = static_cast(section.type()) - 1; if (0 <= index && index < d->sections.length()) { if (d->sections[index]) { *d->sections[index] = section; diff --git a/src/common/KReportDesign_p.h b/src/common/KReportDesign_p.h --- a/src/common/KReportDesign_p.h +++ b/src/common/KReportDesign_p.h @@ -92,7 +92,7 @@ // END OF: Visual settings only QString title; KReportPrivate::PageLayout pageLayout; - QVarLengthArray sections; + QVarLengthArray(KReportSection::Type::Detail)> sections; #ifdef KREPORT_SCRIPTING QString script; QString originalInterpreter; //!< used for backward-compatibility to save the original diff --git a/src/common/KReportDesign_p.cpp b/src/common/KReportDesign_p.cpp --- a/src/common/KReportDesign_p.cpp +++ b/src/common/KReportDesign_p.cpp @@ -34,7 +34,7 @@ , snapToGrid(DEFAULT_SNAP_TO_GRID) , gridDivisions(DEFAULT_GRID_DIVISIONS) , pageUnit(DEFAULT_UNIT) - , sections(KReportSection::Detail) + , sections(static_cast(KReportSection::Type::Detail)) { memset(static_cast(sections.data()), 0, sizeof(void*) * sections.length()); pageLayout.setUnits(QPageLayout::Point); // initializate because of https://bugreports.qt.io/browse/QTBUG-47551 @@ -60,7 +60,12 @@ KReportSection::Type KReportDesignGlobal::sectionType(const QString& typeName) { initSectionTypes(); - return sectionTypesForName.value(typeName); // returns InvalidType for invalid name + return sectionTypesForName.value(typeName); // returns Invalid typefor invalid name +} + +inline uint qHash(KReportSection::Type sectionType, uint seed = 0) +{ + return qHash(static_cast(sectionType), seed); } QString KReportDesignGlobal::sectionTypeName(KReportSection::Type sectionType) { @@ -79,23 +84,23 @@ } const KReportDesignGlobal::SectionTypeInfo KReportDesignGlobal::sectionTypes[] = { - { KReportSection::InvalidType, "" }, - { KReportSection::PageHeaderAny, "header-page-any" }, - { KReportSection::PageHeaderEven, "header-page-even" }, - { KReportSection::PageHeaderOdd, "header-page-odd" }, - { KReportSection::PageHeaderFirst, "header-page-first" }, - { KReportSection::PageHeaderLast, "header-page-last" }, - { KReportSection::PageFooterAny, "footer-page-any" }, - { KReportSection::PageFooterEven, "footer-page-even" }, - { KReportSection::PageFooterOdd, "footer-page-odd" }, - { KReportSection::PageFooterFirst, "footer-page-first" }, - { KReportSection::PageFooterLast, "footer-page-last" }, - { KReportSection::ReportHeader, "header-report" }, - { KReportSection::ReportFooter, "footer-report" }, - { KReportSection::GroupHeader, "group-header" }, - { KReportSection::GroupFooter, "group-footer" }, - { KReportSection::Detail, "detail" }, - { KReportSection::InvalidType, nullptr } + { KReportSection::Type::Invalid, "" }, + { KReportSection::Type::PageHeaderAny, "header-page-any" }, + { KReportSection::Type::PageHeaderEven, "header-page-even" }, + { KReportSection::Type::PageHeaderOdd, "header-page-odd" }, + { KReportSection::Type::PageHeaderFirst, "header-page-first" }, + { KReportSection::Type::PageHeaderLast, "header-page-last" }, + { KReportSection::Type::PageFooterAny, "footer-page-any" }, + { KReportSection::Type::PageFooterEven, "footer-page-even" }, + { KReportSection::Type::PageFooterOdd, "footer-page-odd" }, + { KReportSection::Type::PageFooterFirst, "footer-page-first" }, + { KReportSection::Type::PageFooterLast, "footer-page-last" }, + { KReportSection::Type::ReportHeader, "header-report" }, + { KReportSection::Type::ReportFooter, "footer-report" }, + { KReportSection::Type::GroupHeader, "group-header" }, + { KReportSection::Type::GroupFooter, "group-footer" }, + { KReportSection::Type::Detail, "detail" }, + { KReportSection::Type::Invalid, nullptr } }; Q_GLOBAL_STATIC(KReportDesignGlobal, s_global) @@ -148,7 +153,7 @@ { const QString sectionTypeName = KReportUtils::attr(el, "report:section-type", QString()); KReportSection::Type sectionType = s_global->sectionType(sectionTypeName); - if (sectionType == KReportSection::InvalidType) { + if (sectionType == KReportSection::Type::Invalid) { setStatus(status, QString::fromLatin1("Invalid value of report:section-type=\"%1\" in element <%2>") .arg(sectionTypeName).arg(el.tagName()), el); @@ -243,7 +248,7 @@ if (status && status->isError()) { return false; } - if (section.type() != KReportSection::Detail) { + if (section.type() != KReportSection::Type::Detail) { setStatus(status, QString::fromLatin1("Only section of type \"detail\" allowed in "), el); return false; @@ -295,7 +300,7 @@ .arg(s_global->sectionTypeName(section.type())), el); return false; } - if (section.type() == KReportSection::Detail) { + if (section.type() == KReportSection::Type::Detail) { setStatus(status, QString::fromLatin1("Section of type \"detail\" not allowed in "), el); return false; diff --git a/src/common/KReportDocument.h b/src/common/KReportDocument.h --- a/src/common/KReportDocument.h +++ b/src/common/KReportDocument.h @@ -63,14 +63,14 @@ QList sections() const; /** - \return a sectiondata given a section enum + \return a sectiondata given a section type */ - KReportSectionData* section(KReportSectionData::Section) const; + KReportSectionData* section(KReportSectionData::Type type) const; /** \return a sectiondata given its name */ - KReportSectionData* section(const QString&) const; + KReportSectionData* section(const QString &name) const; QString query() const; #ifdef KREPORT_SCRIPTING diff --git a/src/common/KReportDocument.cpp b/src/common/KReportDocument.cpp --- a/src/common/KReportDocument.cpp +++ b/src/common/KReportDocument.cpp @@ -123,40 +123,40 @@ } else { //kreportDebug() << "Adding section of type " << sd->type(); switch (sd->type()) { - case KReportSectionData::PageHeaderFirst: + case KReportSectionData::Type::PageHeaderFirst: m_pageHeaderFirst = sd; break; - case KReportSectionData::PageHeaderOdd: + case KReportSectionData::Type::PageHeaderOdd: m_pageHeaderOdd = sd; break; - case KReportSectionData::PageHeaderEven: + case KReportSectionData::Type::PageHeaderEven: m_pageHeaderEven = sd; break; - case KReportSectionData::PageHeaderLast: + case KReportSectionData::Type::PageHeaderLast: m_pageHeaderLast = sd; break; - case KReportSectionData::PageHeaderAny: + case KReportSectionData::Type::PageHeaderAny: m_pageHeaderAny = sd; break; - case KReportSectionData::ReportHeader: + case KReportSectionData::Type::ReportHeader: m_reportHeader = sd; break; - case KReportSectionData::ReportFooter: + case KReportSectionData::Type::ReportFooter: m_reportFooter = sd; break; - case KReportSectionData::PageFooterFirst: + case KReportSectionData::Type::PageFooterFirst: m_pageFooterFirst = sd; break; - case KReportSectionData::PageFooterOdd: + case KReportSectionData::Type::PageFooterOdd: m_pageFooterOdd = sd; break; - case KReportSectionData::PageFooterEven: + case KReportSectionData::Type::PageFooterEven: m_pageFooterEven = sd; break; - case KReportSectionData::PageFooterLast: + case KReportSectionData::Type::PageFooterLast: m_pageFooterLast = sd; break; - case KReportSectionData::PageFooterAny: + case KReportSectionData::Type::PageFooterAny: m_pageFooterAny = sd; break; default: @@ -192,8 +192,10 @@ QList KReportDocument::objects() const { QList obs; - for (int i = 1; i <= KReportSectionData::PageFooterAny; i++) { - KReportSectionData *sec = section((KReportSectionData::Section)i); + for (int i = static_cast(KReportSectionData::Type::None) + 1; + i <= static_cast(KReportSectionData::Type::GroupFooter); i++) + { + KReportSectionData *sec = section(static_cast(i)); if (sec) { obs << sec->objects(); } @@ -235,8 +237,10 @@ QList KReportDocument::sections() const { QList secs; - for (int i = 0; i < 12 ; ++i) { - KReportSectionData *sec = section((KReportSectionData::Section)(i + 1)); + for (int i = static_cast(KReportSectionData::Type::None) + 1; + i <= static_cast(KReportSectionData::Type::GroupFooter); i++) + { + KReportSectionData *sec = section(static_cast(i)); if (sec) { secs << sec; } @@ -271,44 +275,44 @@ return nullptr; } -KReportSectionData* KReportDocument::section(KReportSectionData::Section s) const +KReportSectionData* KReportDocument::section(KReportSectionData::Type type) const { KReportSectionData *sec; - switch (s) { - case KReportSectionData::PageHeaderAny: + switch (type) { + case KReportSectionData::Type::PageHeaderAny: sec = m_pageHeaderAny; break; - case KReportSectionData::PageHeaderEven: + case KReportSectionData::Type::PageHeaderEven: sec = m_pageHeaderEven; break; - case KReportSectionData::PageHeaderOdd: + case KReportSectionData::Type::PageHeaderOdd: sec = m_pageHeaderOdd; break; - case KReportSectionData::PageHeaderFirst: + case KReportSectionData::Type::PageHeaderFirst: sec = m_pageHeaderFirst; break; - case KReportSectionData::PageHeaderLast: + case KReportSectionData::Type::PageHeaderLast: sec = m_pageHeaderLast; break; - case KReportSectionData::PageFooterAny: + case KReportSectionData::Type::PageFooterAny: sec = m_pageFooterAny; break; - case KReportSectionData::PageFooterEven: + case KReportSectionData::Type::PageFooterEven: sec = m_pageFooterEven; break; - case KReportSectionData::PageFooterOdd: + case KReportSectionData::Type::PageFooterOdd: sec = m_pageFooterOdd; break; - case KReportSectionData::PageFooterFirst: + case KReportSectionData::Type::PageFooterFirst: sec = m_pageFooterFirst; break; - case KReportSectionData::PageFooterLast: + case KReportSectionData::Type::PageFooterLast: sec = m_pageFooterLast; break; - case KReportSectionData::ReportHeader: + case KReportSectionData::Type::ReportHeader: sec = m_reportHeader; break; - case KReportSectionData::ReportFooter: + case KReportSectionData::Type::ReportFooter: sec = m_reportFooter; break; default: @@ -381,4 +385,3 @@ { d->labelType = label; } - diff --git a/src/common/KReportRenderObjects.h b/src/common/KReportRenderObjects.h --- a/src/common/KReportRenderObjects.h +++ b/src/common/KReportRenderObjects.h @@ -211,8 +211,8 @@ const ORODocument* document() const; void setDocument(ORODocument *doc); - void setType(KReportSectionData::Section t); - KReportSectionData::Section type() const; + void setType(KReportSectionData::Type type); + KReportSectionData::Type type() const; int primitiveCount() const; OROPrimitive* primitive(int index); @@ -431,8 +431,8 @@ class KREPORT_EXPORT OROCheckBox : public OROPrimitive { public: - enum Type { - Cross = 1, + enum class Type { + Cross, Tick, Dot }; diff --git a/src/common/KReportRenderObjects.cpp b/src/common/KReportRenderObjects.cpp --- a/src/common/KReportRenderObjects.cpp +++ b/src/common/KReportRenderObjects.cpp @@ -293,7 +293,7 @@ QList primitives; qint64 row = 0; int height = 0; - KReportSectionData::Section type = KReportSectionData::None; + KReportSectionData::Type type = KReportSectionData::Type::None; QColor backgroundColor = Qt::white; }; @@ -383,12 +383,12 @@ return d->primitives.count(); } -void OROSection::setType(KReportSectionData::Section t) +void OROSection::setType(KReportSectionData::Type type) { - d->type = t; + d->type = type; } -KReportSectionData::Section OROSection::type() const +KReportSectionData::Type OROSection::type() const { return d->type; } @@ -948,10 +948,10 @@ void OROCheckBox::setCheckType(Type type) { - if (type == Cross || type == Tick || type == Dot) { + if (type == Type::Cross || type == Type::Tick || type == Type::Dot) { d->checkType = type; } else { - d->checkType = Cross; + d->checkType = Type::Cross; } } diff --git a/src/common/KReportSection.shared.h b/src/common/KReportSection.shared.h --- a/src/common/KReportSection.shared.h +++ b/src/common/KReportSection.shared.h @@ -32,9 +32,9 @@ { Q_DECLARE_TR_FUNCTIONS(KReportSection) public: - enum Type { - InvalidType = 0, - PageHeaderFirst = 1, + enum class Type { + Invalid, + PageHeaderFirst, PageHeaderOdd, PageHeaderEven, PageHeaderLast, @@ -54,11 +54,11 @@ /*! @getter @return section type - Default section type is InvalidType. + Default section type is Invalid. @setter Sets section type. */ - KReportSection::Type type; //SDC: default=KReportSection::InvalidType simple_type + KReportSection::Type type; //SDC: default=KReportSection::Type::Invalid simple_type /*! @getter diff --git a/src/common/KReportSectionData.h b/src/common/KReportSectionData.h --- a/src/common/KReportSectionData.h +++ b/src/common/KReportSectionData.h @@ -45,9 +45,9 @@ { Q_OBJECT public: - enum Section { - None = 0, - PageHeaderFirst = 1, + enum class Type { + None, + PageHeaderFirst, PageHeaderOdd, PageHeaderEven, PageHeaderLast, @@ -89,12 +89,12 @@ return m_backgroundColor->value().value(); } - Section type() const { + Type type() const { return m_type; } - static KReportSectionData::Section sectionTypeFromString(const QString& s); - static QString sectionTypeString(KReportSectionData::Section s); + static KReportSectionData::Type sectionTypeFromString(const QString& s); + static QString sectionTypeString(KReportSectionData::Type type); protected: KPropertySet *m_set; KProperty *m_height; @@ -105,7 +105,7 @@ QList m_objects; - Section m_type; + Type m_type; static bool zLessThan(KReportItemBase* s1, KReportItemBase* s2); static bool xLessThan(KReportItemBase* s1, KReportItemBase* s2); diff --git a/src/common/KReportSectionData.cpp b/src/common/KReportSectionData.cpp --- a/src/common/KReportSectionData.cpp +++ b/src/common/KReportSectionData.cpp @@ -42,7 +42,7 @@ m_type = sectionTypeFromString(elemSource.attribute(QLatin1String("report:section-type"))); createProperties(elemSource); - if (objectName() != QLatin1String("report:section") || m_type == KReportSectionData::None) { + if (objectName() != QLatin1String("report:section") || m_type == KReportSectionData::Type::None) { m_valid = false; return; } @@ -117,100 +117,100 @@ return (objectName() + QLatin1Char('-') + sectionTypeString(m_type)); } -QString KReportSectionData::sectionTypeString(KReportSectionData::Section s) +QString KReportSectionData::sectionTypeString(KReportSectionData::Type type) { //! @todo use QMap QString sectiontype; - switch (s) { - case KReportSectionData::PageHeaderAny: + switch (type) { + case KReportSectionData::Type::PageHeaderAny: sectiontype = QLatin1String("header-page-any"); break; - case KReportSectionData::PageHeaderEven: + case KReportSectionData::Type::PageHeaderEven: sectiontype = QLatin1String("header-page-even"); break; - case KReportSectionData::PageHeaderOdd: + case KReportSectionData::Type::PageHeaderOdd: sectiontype = QLatin1String("header-page-odd"); break; - case KReportSectionData::PageHeaderFirst: + case KReportSectionData::Type::PageHeaderFirst: sectiontype = QLatin1String("header-page-first"); break; - case KReportSectionData::PageHeaderLast: + case KReportSectionData::Type::PageHeaderLast: sectiontype = QLatin1String("header-page-last"); break; - case KReportSectionData::PageFooterAny: + case KReportSectionData::Type::PageFooterAny: sectiontype = QLatin1String("footer-page-any"); break; - case KReportSectionData::PageFooterEven: + case KReportSectionData::Type::PageFooterEven: sectiontype = QLatin1String("footer-page-even"); break; - case KReportSectionData::PageFooterOdd: + case KReportSectionData::Type::PageFooterOdd: sectiontype = QLatin1String("footer-page-odd"); break; - case KReportSectionData::PageFooterFirst: + case KReportSectionData::Type::PageFooterFirst: sectiontype = QLatin1String("footer-page-first"); break; - case KReportSectionData::PageFooterLast: + case KReportSectionData::Type::PageFooterLast: sectiontype = QLatin1String("footer-page-last"); break; - case KReportSectionData::ReportHeader: + case KReportSectionData::Type::ReportHeader: sectiontype = QLatin1String("header-report"); break; - case KReportSectionData::ReportFooter: + case KReportSectionData::Type::ReportFooter: sectiontype = QLatin1String("footer-report"); break; - case KReportSectionData::GroupHeader: + case KReportSectionData::Type::GroupHeader: sectiontype = QLatin1String("group-header"); break; - case KReportSectionData::GroupFooter: + case KReportSectionData::Type::GroupFooter: sectiontype = QLatin1String("group-footer"); break; - case KReportSectionData::Detail: + case KReportSectionData::Type::Detail: sectiontype = QLatin1String("detail"); break; default: - ; + break; } return sectiontype; } -KReportSectionData::Section KReportSectionData::sectionTypeFromString(const QString& s) +KReportSectionData::Type KReportSectionData::sectionTypeFromString(const QString& s) { //! @todo use QMap - KReportSectionData::Section sec; + KReportSectionData::Type type; //kreportDebug() << "Determining section type for " << s; if (s == QLatin1String("header-page-any")) - sec = KReportSectionData::PageHeaderAny; + type = KReportSectionData::Type::PageHeaderAny; else if (s == QLatin1String("header-page-even")) - sec = KReportSectionData::PageHeaderEven; + type = KReportSectionData::Type::PageHeaderEven; else if (s == QLatin1String("header-page-odd")) - sec = KReportSectionData::PageHeaderOdd; + type = KReportSectionData::Type::PageHeaderOdd; else if (s == QLatin1String("header-page-first")) - sec = KReportSectionData::PageHeaderFirst; + type = KReportSectionData::Type::PageHeaderFirst; else if (s == QLatin1String("header-page-last")) - sec = KReportSectionData::PageHeaderLast; + type = KReportSectionData::Type::PageHeaderLast; else if (s == QLatin1String("header-report")) - sec = KReportSectionData::ReportHeader; + type = KReportSectionData::Type::ReportHeader; else if (s == QLatin1String("footer-page-any")) - sec = KReportSectionData::PageFooterAny; + type = KReportSectionData::Type::PageFooterAny; else if (s == QLatin1String("footer-page-even")) - sec = KReportSectionData::PageFooterEven; + type = KReportSectionData::Type::PageFooterEven; else if (s == QLatin1String("footer-page-odd")) - sec = KReportSectionData::PageFooterOdd; + type = KReportSectionData::Type::PageFooterOdd; else if (s == QLatin1String("footer-page-first")) - sec = KReportSectionData::PageFooterFirst; + type = KReportSectionData::Type::PageFooterFirst; else if (s == QLatin1String("footer-page-last")) - sec = KReportSectionData::PageFooterLast; + type = KReportSectionData::Type::PageFooterLast; else if (s == QLatin1String("footer-report")) - sec = KReportSectionData::ReportFooter; + type = KReportSectionData::Type::ReportFooter; else if (s == QLatin1String("group-header")) - sec = KReportSectionData::GroupHeader; + type = KReportSectionData::Type::GroupHeader; else if (s == QLatin1String("group-footer")) - sec = KReportSectionData::GroupFooter; + type = KReportSectionData::Type::GroupFooter; else if (s == QLatin1String("detail")) - sec = KReportSectionData::Detail; + type = KReportSectionData::Type::Detail; else - sec = KReportSectionData::None; + type = KReportSectionData::Type::None; - return sec; + return type; } diff --git a/src/items/check/KReportItemCheck.cpp b/src/items/check/KReportItemCheck.cpp --- a/src/items/check/KReportItemCheck.cpp +++ b/src/items/check/KReportItemCheck.cpp @@ -128,11 +128,11 @@ chk->setLineStyle(lineStyle()); chk->setForegroundColor(m_foregroundColor->value().value()); if (m_checkStyle->value().toString() == QLatin1String("Cross")) { - chk->setCheckType(OROCheckBox::Cross); + chk->setCheckType(OROCheckBox::Type::Cross); } else if (m_checkStyle->value().toString() == QLatin1String("Dot")) { - chk->setCheckType(OROCheckBox::Dot); + chk->setCheckType(OROCheckBox::Type::Dot); } else { - chk->setCheckType(OROCheckBox::Tick); + chk->setCheckType(OROCheckBox::Type::Tick); } QString str; diff --git a/src/renderer/KReportHTMLCSSRenderer_p.cpp b/src/renderer/KReportHTMLCSSRenderer_p.cpp --- a/src/renderer/KReportHTMLCSSRenderer_p.cpp +++ b/src/renderer/KReportHTMLCSSRenderer_p.cpp @@ -96,17 +96,21 @@ for (int s = 0; s < document->sectionCount(); s++) { OROSection *section = document->section(s); - if (section->type() == KReportSectionData::GroupHeader || - section->type() == KReportSectionData::GroupFooter || - section->type() == KReportSectionData::Detail || - section->type() == KReportSectionData::ReportHeader || - section->type() == KReportSectionData::ReportFooter || - (section->type() == KReportSectionData::PageHeaderAny && !renderedPageHead) || - (section->type() == KReportSectionData::PageFooterAny && !renderedPageFoot && s > document->sectionCount() - 2)) { //render the page foot right at the end, it will either be the last or second last section if there is a report footer - if (section->type() == KReportSectionData::PageHeaderAny) + if (section->type() == KReportSectionData::Type::GroupHeader + || section->type() == KReportSectionData::Type::GroupFooter + || section->type() == KReportSectionData::Type::Detail + || section->type() == KReportSectionData::Type::ReportHeader + || section->type() == KReportSectionData::Type::ReportFooter + || (section->type() == KReportSectionData::Type::PageHeaderAny && !renderedPageHead) + || (section->type() == KReportSectionData::Type::PageFooterAny && !renderedPageFoot + && s > document->sectionCount() - 2)) + { // render the page foot right at the end, it + // will either be the last or second last + // section if there is a report footer + if (section->type() == KReportSectionData::Type::PageHeaderAny) renderedPageHead = true; - if (section->type() == KReportSectionData::PageFooterAny) + if (section->type() == KReportSectionData::Type::PageFooterAny) renderedPageFoot = true; style = QLatin1String("position: relative; top: 0pt; left: 0pt; background-color: ") + section->backgroundColor().name() + QLatin1String("; height: ") + QString::number(section->height()) + QLatin1String("pt;"); diff --git a/src/renderer/KReportHTMLTableRenderer_p.cpp b/src/renderer/KReportHTMLTableRenderer_p.cpp --- a/src/renderer/KReportHTMLTableRenderer_p.cpp +++ b/src/renderer/KReportHTMLTableRenderer_p.cpp @@ -97,17 +97,21 @@ OROSection *section = document->section(s); section->sortPrimitives(Qt::Horizontal); - if (section->type() == KReportSectionData::GroupHeader || - section->type() == KReportSectionData::GroupFooter || - section->type() == KReportSectionData::Detail || - section->type() == KReportSectionData::ReportHeader || - section->type() == KReportSectionData::ReportFooter || - (section->type() == KReportSectionData::PageHeaderAny && !renderedPageHeader) || - (section->type() == KReportSectionData::PageFooterAny && !renderedPageFooter && s > document->sectionCount() - 2)) { //render the page foot right at the end, it will either be the last or second last section if there is a report footer - if (section->type() == KReportSectionData::PageHeaderAny) + if (section->type() == KReportSectionData::Type::GroupHeader + || section->type() == KReportSectionData::Type::GroupFooter + || section->type() == KReportSectionData::Type::Detail + || section->type() == KReportSectionData::Type::ReportHeader + || section->type() == KReportSectionData::Type::ReportFooter + || (section->type() == KReportSectionData::Type::PageHeaderAny && !renderedPageHeader) + || (section->type() == KReportSectionData::Type::PageFooterAny && !renderedPageFooter + && s > document->sectionCount() - 2)) + { // render the page foot right at the end, it + // will either be the last or second last + // section if there is a report footer + if (section->type() == KReportSectionData::Type::PageHeaderAny) renderedPageHeader = true; - if (section->type() == KReportSectionData::PageFooterAny) + if (section->type() == KReportSectionData::Type::PageFooterAny) renderedPageFooter = true; tr = QLatin1String("backgroundColor().name() + QLatin1String("\">\n"); diff --git a/src/renderer/KReportPrintRenderer_p.cpp b/src/renderer/KReportPrintRenderer_p.cpp --- a/src/renderer/KReportPrintRenderer_p.cpp +++ b/src/renderer/KReportPrintRenderer_p.cpp @@ -198,7 +198,7 @@ qreal oy = sz.height() / 5; //Checkbox Style - if (chk->checkType() == OROCheckBox::Cross) { + if (chk->checkType() == OROCheckBox::Type::Cross) { context.painter()->drawRoundedRect(rc, sz.width() / 10 , sz.height() / 10); if (chk->value()) { @@ -209,7 +209,7 @@ context.painter()->drawLine(QPointF(ox, oy) + ps, QPointF(sz.width() - ox, sz.height() - oy) + ps); context.painter()->drawLine(QPointF(ox, sz.height() - oy) + ps, QPoint(sz.width() - ox, oy) + ps); } - } else if (chk->checkType() == OROCheckBox::Dot) { + } else if (chk->checkType() == OROCheckBox::Type::Dot) { //Radio Style context.painter()->drawEllipse(rc); diff --git a/src/renderer/KReportScreenRenderer_p.cpp b/src/renderer/KReportScreenRenderer_p.cpp --- a/src/renderer/KReportScreenRenderer_p.cpp +++ b/src/renderer/KReportScreenRenderer_p.cpp @@ -155,7 +155,7 @@ qreal oy = sz.height() / 5; //Checkbox Style - if (chk->checkType() == OROCheckBox::Cross) { + if (chk->checkType() == OROCheckBox::Type::Cross) { context.painter()->drawRoundedRect(rc, sz.width() / 10 , sz.height() / 10); if (chk->value()) { @@ -167,7 +167,7 @@ context.painter()->drawLine(QPointF(ox, sz.height() - oy) + ps, QPoint(sz.width() - ox, oy) + ps); } } - else if (chk->checkType() == OROCheckBox::Dot) { + else if (chk->checkType() == OROCheckBox::Type::Dot) { //Radio Style context.painter()->drawEllipse(rc); diff --git a/src/renderer/scripting/KReportScriptConstants.h b/src/renderer/scripting/KReportScriptConstants.h --- a/src/renderer/scripting/KReportScriptConstants.h +++ b/src/renderer/scripting/KReportScriptConstants.h @@ -41,7 +41,7 @@ //! constants.QtSolidLine //! \endcode //! for example - enum PenStyle {QtNoPen = 0, QtSolidLine, QtDashLine, QtDotLine, QtDashDotLine, QtDashDotDotLine}; + enum PenStyle {QtNoPen, QtSolidLine, QtDashLine, QtDotLine, QtDashDotLine, QtDashDotDotLine}; void setPageNumber(int p) { m_currentPage = p; diff --git a/src/wrtembed/KReportDesigner.h b/src/wrtembed/KReportDesigner.h --- a/src/wrtembed/KReportDesigner.h +++ b/src/wrtembed/KReportDesigner.h @@ -99,7 +99,7 @@ @param section KReportSectionData::Section enum value of the section to return @return Pointer to report section object, or 0 if no section exists */ - KReportDesignerSection* section(KReportSectionData::Section) const; + KReportDesignerSection* section(KReportSectionData::Type type) const; /** @brief Creates new section @@ -112,13 +112,13 @@ @brief Deletes the section specified @param section KReportSectionData::Section enum value of the section to return */ - void removeSection(KReportSectionData::Section); + void removeSection(KReportSectionData::Type type); /** @brief Create a new section and insert it into the report @param section KReportSectionData::Section enum value of the section to return */ - void insertSection(KReportSectionData::Section); + void insertSection(KReportSectionData::Type type); /** @brief Return a pointer to the detail section. diff --git a/src/wrtembed/KReportDesigner.cpp b/src/wrtembed/KReportDesigner.cpp --- a/src/wrtembed/KReportDesigner.cpp +++ b/src/wrtembed/KReportDesigner.cpp @@ -74,25 +74,25 @@ ReportWriterSectionData() { selected_x_offset = 0; selected_y_offset = 0; - mouseAction = ReportWriterSectionData::MA_None; + mouseAction = MouseAction::None; } virtual ~ReportWriterSectionData() { } - enum MouseAction { - MA_None = 0, - MA_Insert = 1, - MA_Grab = 2, - MA_MoveStartPoint, - MA_MoveEndPoint, - MA_ResizeNW = 8, - MA_ResizeN, - MA_ResizeNE, - MA_ResizeE, - MA_ResizeSE, - MA_ResizeS, - MA_ResizeSW, - MA_ResizeW + enum class MouseAction { + None = 0, + Insert = 1, + Grab = 2, + MoveStartPoint, + MoveEndPoint, + ResizeNW = 8, + ResizeN, + ResizeNE, + ResizeE, + ResizeSE, + ResizeS, + ResizeSW, + ResizeW }; int selected_x_offset; @@ -416,11 +416,15 @@ QDomElement body = doc.createElement(QLatin1String("report:body")); QDomElement domsection; - for (int i = KReportSectionData::PageHeaderFirst; i <= KReportSectionData::PageFooterAny; ++i) { - KReportDesignerSection *sec = section((KReportSectionData::Section)i); + for (int i = static_cast(KReportSectionData::Type::PageHeaderFirst); + i <= static_cast(KReportSectionData::Type::PageFooterAny); ++i) + { + KReportDesignerSection *sec = section(static_cast(i)); if (sec) { domsection = doc.createElement(QLatin1String("report:section")); - domsection.setAttribute(QLatin1String("report:section-type"), KReportSectionData::sectionTypeString(KReportSectionData::Section(i))); + domsection.setAttribute( + QLatin1String("report:section-type"), + KReportSectionData::sectionTypeString(static_cast(i))); sec->buildXML(&doc, &domsection); body.appendChild(domsection); } @@ -460,44 +464,44 @@ } #endif -KReportDesignerSection * KReportDesigner::section(KReportSectionData::Section s) const +KReportDesignerSection * KReportDesigner::section(KReportSectionData::Type type) const { KReportDesignerSection *sec; - switch (s) { - case KReportSectionData::PageHeaderAny: + switch (type) { + case KReportSectionData::Type::PageHeaderAny: sec = d->pageHeaderAny; break; - case KReportSectionData::PageHeaderEven: + case KReportSectionData::Type::PageHeaderEven: sec = d->pageHeaderEven; break; - case KReportSectionData::PageHeaderOdd: + case KReportSectionData::Type::PageHeaderOdd: sec = d->pageHeaderOdd; break; - case KReportSectionData::PageHeaderFirst: + case KReportSectionData::Type::PageHeaderFirst: sec = d->pageHeaderFirst; break; - case KReportSectionData::PageHeaderLast: + case KReportSectionData::Type::PageHeaderLast: sec = d->pageHeaderLast; break; - case KReportSectionData::PageFooterAny: + case KReportSectionData::Type::PageFooterAny: sec = d->pageFooterAny; break; - case KReportSectionData::PageFooterEven: + case KReportSectionData::Type::PageFooterEven: sec = d->pageFooterEven; break; - case KReportSectionData::PageFooterOdd: + case KReportSectionData::Type::PageFooterOdd: sec = d->pageFooterOdd; break; - case KReportSectionData::PageFooterFirst: + case KReportSectionData::Type::PageFooterFirst: sec = d->pageFooterFirst; break; - case KReportSectionData::PageFooterLast: + case KReportSectionData::Type::PageFooterLast: sec = d->pageFooterLast; break; - case KReportSectionData::ReportHeader: + case KReportSectionData::Type::ReportHeader: sec = d->reportHeader; break; - case KReportSectionData::ReportFooter: + case KReportSectionData::Type::ReportFooter: sec = d->reportFooter; break; default: @@ -511,47 +515,47 @@ return new KReportDesignerSection(this, d->zoomHandler); } -void KReportDesigner::removeSection(KReportSectionData::Section s) +void KReportDesigner::removeSection(KReportSectionData::Type type) { - KReportDesignerSection* sec = section(s); + KReportDesignerSection* sec = section(type); if (sec) { delete sec; - switch (s) { - case KReportSectionData::PageHeaderAny: + switch (type) { + case KReportSectionData::Type::PageHeaderAny: d->pageHeaderAny = nullptr; break; - case KReportSectionData::PageHeaderEven: + case KReportSectionData::Type::PageHeaderEven: sec = d->pageHeaderEven = nullptr; break; - case KReportSectionData::PageHeaderOdd: + case KReportSectionData::Type::PageHeaderOdd: d->pageHeaderOdd = nullptr; break; - case KReportSectionData::PageHeaderFirst: + case KReportSectionData::Type::PageHeaderFirst: d->pageHeaderFirst = nullptr; break; - case KReportSectionData::PageHeaderLast: + case KReportSectionData::Type::PageHeaderLast: d->pageHeaderLast = nullptr; break; - case KReportSectionData::PageFooterAny: + case KReportSectionData::Type::PageFooterAny: d->pageFooterAny = nullptr; break; - case KReportSectionData::PageFooterEven: + case KReportSectionData::Type::PageFooterEven: d->pageFooterEven = nullptr; break; - case KReportSectionData::PageFooterOdd: + case KReportSectionData::Type::PageFooterOdd: d->pageFooterOdd = nullptr; break; - case KReportSectionData::PageFooterFirst: + case KReportSectionData::Type::PageFooterFirst: d->pageFooterFirst = nullptr; break; - case KReportSectionData::PageFooterLast: + case KReportSectionData::Type::PageFooterLast: d->pageFooterLast = nullptr; break; - case KReportSectionData::ReportHeader: + case KReportSectionData::Type::ReportHeader: d->reportHeader = nullptr; break; - case KReportSectionData::ReportFooter: + case KReportSectionData::Type::ReportFooter: d->reportFooter = nullptr; break; default: @@ -563,75 +567,77 @@ } } -void KReportDesigner::insertSection(KReportSectionData::Section s) +void KReportDesigner::insertSection(KReportSectionData::Type type) { - KReportDesignerSection* sec = section(s); + KReportDesignerSection* sec = section(type); if (!sec) { int idx = 0; - for (int i = 1; i <= s; ++i) { - if (section((KReportSectionData::Section)i)) + for (int i = static_cast(KReportSectionData::Type::None) + 1; + i <= static_cast(type); ++i) + { + if (section(static_cast(i))) idx++; } - if (s > KReportSectionData::ReportHeader) + if (type > KReportSectionData::Type::ReportHeader) idx++; //kreportDebug() << idx; KReportDesignerSection *rs = createSection(); d->vboxlayout->insertWidget(idx, rs); - switch (s) { - case KReportSectionData::PageHeaderAny: + switch (type) { + case KReportSectionData::Type::PageHeaderAny: rs->setTitle(tr("Page Header (Any)")); d->pageHeaderAny = rs; break; - case KReportSectionData::PageHeaderEven: + case KReportSectionData::Type::PageHeaderEven: rs->setTitle(tr("Page Header (Even)")); d->pageHeaderEven = rs; break; - case KReportSectionData::PageHeaderOdd: + case KReportSectionData::Type::PageHeaderOdd: rs->setTitle(tr("Page Header (Odd)")); d->pageHeaderOdd = rs; break; - case KReportSectionData::PageHeaderFirst: + case KReportSectionData::Type::PageHeaderFirst: rs->setTitle(tr("Page Header (First)")); d->pageHeaderFirst = rs; break; - case KReportSectionData::PageHeaderLast: + case KReportSectionData::Type::PageHeaderLast: rs->setTitle(tr("Page Header (Last)")); d->pageHeaderLast = rs; break; - case KReportSectionData::PageFooterAny: + case KReportSectionData::Type::PageFooterAny: rs->setTitle(tr("Page Footer (Any)")); d->pageFooterAny = rs; break; - case KReportSectionData::PageFooterEven: + case KReportSectionData::Type::PageFooterEven: rs->setTitle(tr("Page Footer (Even)")); d->pageFooterEven = rs; break; - case KReportSectionData::PageFooterOdd: + case KReportSectionData::Type::PageFooterOdd: rs->setTitle(tr("Page Footer (Odd)")); d->pageFooterOdd = rs; break; - case KReportSectionData::PageFooterFirst: + case KReportSectionData::Type::PageFooterFirst: rs->setTitle(tr("Page Footer (First)")); d->pageFooterFirst = rs; break; - case KReportSectionData::PageFooterLast: + case KReportSectionData::Type::PageFooterLast: rs->setTitle(tr("Page Footer (Last)")); d->pageFooterLast = rs; break; - case KReportSectionData::ReportHeader: + case KReportSectionData::Type::ReportHeader: rs->setTitle(tr("Report Header")); d->reportHeader = rs; break; - case KReportSectionData::ReportFooter: + case KReportSectionData::Type::ReportFooter: rs->setTitle(tr("Report Footer")); d->reportFooter = rs; break; //These sections cannot be inserted this way - case KReportSectionData::None: - case KReportSectionData::GroupHeader: - case KReportSectionData::GroupFooter: - case KReportSectionData::Detail: + case KReportSectionData::Type::None: + case KReportSectionData::Type::GroupHeader: + case KReportSectionData::Type::GroupFooter: + case KReportSectionData::Type::Detail: break; } @@ -984,7 +990,7 @@ end.setX(v->scene()->width()); } - if (d->sectionData.mouseAction == ReportWriterSectionData::MA_Insert) { + if (d->sectionData.mouseAction == ReportWriterSectionData::MouseAction::Insert) { QGraphicsItem * item = nullptr; QString classString; QString iconName; @@ -1024,7 +1030,7 @@ } } - d->sectionData.mouseAction = ReportWriterSectionData::MA_None; + d->sectionData.mouseAction = ReportWriterSectionData::MouseAction::None; d->sectionData.itemToInsert.clear(); unsetSectionCursor(); } @@ -1058,7 +1064,7 @@ void KReportDesigner::slotItem(const QString &entity) { //kreportDebug() << entity; - d->sectionData.mouseAction = ReportWriterSectionData::MA_Insert; + d->sectionData.mouseAction = ReportWriterSectionData::MouseAction::Insert; d->sectionData.itemToInsert = entity; setSectionCursor(QCursor(Qt::CrossCursor)); } @@ -1073,7 +1079,7 @@ QGraphicsScene * scene = item->scene(); delete item; scene->update(); - d->sectionData.mouseAction = ReportWriterSectionData::MA_None; + d->sectionData.mouseAction = ReportWriterSectionData::MouseAction::None; modified = true; } } @@ -1153,7 +1159,7 @@ activeItem = activeItems.first(); } canvas->clearSelection(); - d->sectionData.mouseAction = ReportWriterSectionData::MA_None; + d->sectionData.mouseAction = ReportWriterSectionData::MouseAction::None; //! @todo this code sucks :) //! The setPos calls only work AFTER the name has been set ?!?!? @@ -1178,7 +1184,7 @@ pasted_ent->setSelected(true); canvas->addItem(pasted_ent); pasted_ent->show(); - d->sectionData.mouseAction = ReportWriterSectionData::MA_Grab; + d->sectionData.mouseAction = ReportWriterSectionData::MouseAction::Grab; setModified(true); } } @@ -1213,9 +1219,11 @@ { KReportDesignerSection *sec; int itemCount = 0; - //Count items in the main sections - for (int i = 1; i <= KReportSectionData::PageFooterAny; i++) { - sec = section((KReportSectionData::Section) i); + // Count items in the main sections + for (int i = static_cast(KReportSectionData::Type::None) + 1; + i <= static_cast(KReportSectionData::Type::GroupFooter); i++) + { + sec = section(static_cast(i)); if (sec) { const QGraphicsItemList l = sec->items(); itemCount += l.count(); @@ -1255,9 +1263,11 @@ KReportDesignerSection *sec; bool unique = true; - //Check items in the main sections - for (int i = 1; i <= KReportSectionData::PageFooterAny; i++) { - sec = section((KReportSectionData::Section)i); + // Check items in the main sections + for (int i = static_cast(KReportSectionData::Type::None); + i <= static_cast(KReportSectionData::Type::GroupFooter); i++) + { + sec = section(static_cast(i)); if (sec) { const QGraphicsItemList l = sec->items(); for (QGraphicsItemList::const_iterator it = l.constBegin(); it != l.constEnd(); ++it) { diff --git a/src/wrtembed/KReportDesignerItemRectBase.h b/src/wrtembed/KReportDesignerItemRectBase.h --- a/src/wrtembed/KReportDesignerItemRectBase.h +++ b/src/wrtembed/KReportDesignerItemRectBase.h @@ -50,13 +50,15 @@ int m_dpiX; int m_dpiY; - enum UpdatePropertyFlag { + enum class SceneRectFlag { UpdateProperty, DontUpdateProperty }; - void setSceneRect(const QPointF& topLeft, const QSizeF& size, UpdatePropertyFlag update = UpdateProperty); - void setSceneRect(const QRectF& rect, UpdatePropertyFlag update = UpdateProperty); + void setSceneRect(const QPointF &topLeft, const QSizeF &size, + SceneRectFlag update = SceneRectFlag::UpdateProperty); + void setSceneRect(const QRectF &rect, + SceneRectFlag update = SceneRectFlag::UpdateProperty); void drawHandles(QPainter*); QRectF sceneRect(); diff --git a/src/wrtembed/KReportDesignerItemRectBase.cpp b/src/wrtembed/KReportDesignerItemRectBase.cpp --- a/src/wrtembed/KReportDesignerItemRectBase.cpp +++ b/src/wrtembed/KReportDesignerItemRectBase.cpp @@ -70,16 +70,16 @@ return QRectF(item()->position(), item()->size()); } -void KReportDesignerItemRectBase::setSceneRect(const QPointF& topLeft, const QSizeF& size, UpdatePropertyFlag update) +void KReportDesignerItemRectBase::setSceneRect(const QPointF& topLeft, const QSizeF& size, SceneRectFlag update) { setSceneRect(QRectF(topLeft, size), update); } -void KReportDesignerItemRectBase::setSceneRect(const QRectF& rect, UpdatePropertyFlag update) +void KReportDesignerItemRectBase::setSceneRect(const QRectF& rect, SceneRectFlag update) { QGraphicsRectItem::setPos(rect.x(), rect.y()); setRect(0, 0, rect.width(), rect.height()); - if (update == UpdateProperty) { + if (update == SceneRectFlag::UpdateProperty) { item()->setPosition(KReportItemBase::positionFromScene(QPointF(rect.x(), rect.y()))); item()->setSize(KReportItemBase::sizeFromScene(QSizeF(rect.width(), rect.height()))); } @@ -307,7 +307,8 @@ else if (newPos.y() > (scene()->height() - rect().height())) newPos.setY(scene()->height() - rect().height()); - setSceneRect(newPos, KReportItemBase::sceneSize(item()->size()), KReportDesignerItemRectBase::DontUpdateProperty); + setSceneRect(newPos, KReportItemBase::sceneSize(item()->size()), + KReportDesignerItemRectBase::SceneRectFlag::DontUpdateProperty); } } return QGraphicsItem::itemChange(change, value); @@ -324,7 +325,8 @@ item()->setSize(item()->unit().convertToPoint(p.value().toSizeF())); //TODO dont update property } #endif - setSceneRect(KReportItemBase::scenePosition(item()->position()), KReportItemBase::sceneSize(item()->size()), DontUpdateProperty); + setSceneRect(KReportItemBase::scenePosition(item()->position()), + KReportItemBase::sceneSize(item()->size()), SceneRectFlag::DontUpdateProperty); } void KReportDesignerItemRectBase::move(const QPointF& /*m*/) diff --git a/src/wrtembed/KReportRuler_p.cpp b/src/wrtembed/KReportRuler_p.cpp --- a/src/wrtembed/KReportRuler_p.cpp +++ b/src/wrtembed/KReportRuler_p.cpp @@ -193,7 +193,7 @@ QList hotspots; bool rightToLeft; - enum Selection { + enum class Selection { None, Tab, FirstLineIndent, @@ -552,11 +552,16 @@ // Draw the mouse indicator const int mouseCoord = d->mouseCoordinate - start; - if (d->selected == KReportRuler::Private::None || d->selected == KReportRuler::Private::HotSpot) { + if (d->selected == KReportRuler::Private::Selection::None + || d->selected == KReportRuler::Private::Selection::HotSpot) + { const qreal top = rectangle.y() + 1; const qreal bottom = rectangle.bottom() -1; - if (d->selected == KReportRuler::Private::None && d->showMousePosition && mouseCoord > 0 && mouseCoord < rectangle.width() ) + if (d->selected == KReportRuler::Private::Selection::None && d->showMousePosition + && mouseCoord > 0 && mouseCoord < rectangle.width()) + { painter->drawLine(QPointF(mouseCoord, top), QPointF(mouseCoord, bottom)); + } foreach (const KReportRuler::Private::HotSpotData & hp, d->hotspots) { const qreal x = d->viewConverter->documentToViewX(hp.position) + d->offset; painter->drawLine(QPointF(x, top), QPointF(x, bottom)); @@ -763,11 +768,16 @@ // Draw the mouse indicator const int mouseCoord = d->mouseCoordinate - start; - if (d->selected == KReportRuler::Private::None || d->selected == KReportRuler::Private::HotSpot) { + if (d->selected == KReportRuler::Private::Selection::None + || d->selected == KReportRuler::Private::Selection::HotSpot) + { const qreal left = rectangle.left() + 1; const qreal right = rectangle.right() -1; - if (d->selected == KReportRuler::Private::None && d->showMousePosition && mouseCoord > 0 && mouseCoord < rectangle.height() ) + if (d->selected == KReportRuler::Private::Selection::None && d->showMousePosition + && mouseCoord > 0 && mouseCoord < rectangle.height()) + { painter->drawLine(QPointF(left, mouseCoord), QPointF(right, mouseCoord)); + } foreach (const KReportRuler::Private::HotSpotData & hp, d->hotspots) { const qreal y = d->viewConverter->documentToViewY(hp.position) + d->offset; painter->drawLine(QPointF(left, y), QPointF(right, y)); @@ -882,7 +892,7 @@ currentIndex(0), tabDistance(0.0), rightToLeft(false), - selected(None), + selected(Selection::None), selectOffset(0), tabChooser(nullptr), normalPaintingStrategy(o == Qt::Horizontal ? @@ -930,47 +940,47 @@ if (pos.x() >= x - 8 && pos.x() <= x +8 && pos.y() < height / 2) { if (selectOffset) *selectOffset = x - pos.x(); - return KReportRuler::Private::FirstLineIndent; + return KReportRuler::Private::Selection::FirstLineIndent; } x = int(viewConverter->documentToViewX(effectiveActiveRangeEnd() - paragraphIndent) + offset); if (pos.x() >= x - 8 && pos.x() <= x +8 && pos.y() > height / 2) { if (selectOffset) *selectOffset = x - pos.x(); - return KReportRuler::Private::ParagraphIndent; + return KReportRuler::Private::Selection::ParagraphIndent; } x = int(viewConverter->documentToViewX(effectiveActiveRangeStart() + endIndent) + offset); if (pos.x() >= x - 8 && pos.x() <= x + 8) { if (selectOffset) *selectOffset = x - pos.x(); - return KReportRuler::Private::EndIndent; + return KReportRuler::Private::Selection::EndIndent; } } else { int x = int(viewConverter->documentToViewX(effectiveActiveRangeStart() + firstLineIndent + paragraphIndent) + offset); if (pos.x() >= x -8 && pos.x() <= x + 8 && pos.y() < height / 2) { if (selectOffset) *selectOffset = x - pos.x(); - return KReportRuler::Private::FirstLineIndent; + return KReportRuler::Private::Selection::FirstLineIndent; } x = int(viewConverter->documentToViewX(effectiveActiveRangeStart() + paragraphIndent) + offset); if (pos.x() >= x - 8 && pos.x() <= x + 8 && pos.y() > height/2) { if (selectOffset) *selectOffset = x - pos.x(); - return KReportRuler::Private::ParagraphIndent; + return KReportRuler::Private::Selection::ParagraphIndent; } x = int(viewConverter->documentToViewX(effectiveActiveRangeEnd() - endIndent) + offset); if (pos.x() >= x - 8 && pos.x() <= x + 8) { if (selectOffset) *selectOffset = x - pos.x(); - return KReportRuler::Private::EndIndent; + return KReportRuler::Private::Selection::EndIndent; } } - return KReportRuler::Private::None; + return KReportRuler::Private::Selection::None; } int KReportRuler::Private::hotSpotIndex(const QPoint & pos) @@ -1244,7 +1254,7 @@ void KReportRuler::mousePressEvent ( QMouseEvent* ev ) { d->tabMoved = false; - d->selected = KReportRuler::Private::None; + d->selected = KReportRuler::Private::Selection::None; if (ev->button() == Qt::RightButton && !d->popupActions.isEmpty()) QMenu::exec(d->popupActions, ev->globalPos()); if (ev->button() != Qt::LeftButton) { @@ -1266,7 +1276,7 @@ + (d->relativeTabs ? d->paragraphIndent : 0) + t.position) + d->offset; } if (pos.x() >= x-6 && pos.x() <= x+6) { - d->selected = KReportRuler::Private::Tab; + d->selected = KReportRuler::Private::Selection::Tab; d->selectOffset = x - pos.x(); d->currentIndex = i; break; @@ -1276,17 +1286,17 @@ d->originalIndex = d->currentIndex; } - if (d->selected == KReportRuler::Private::None) + if (d->selected == KReportRuler::Private::Selection::None) d->selected = d->selectionAtPosition(ev->pos(), &d->selectOffset); - if (d->selected == KReportRuler::Private::None) { + if (d->selected == KReportRuler::Private::Selection::None) { int hotSpotIndex = d->hotSpotIndex(ev->pos()); if (hotSpotIndex >= 0) { - d->selected = KReportRuler::Private::HotSpot; + d->selected = KReportRuler::Private::Selection::HotSpot; update(); } } - if (d->showTabs && d->selected == KReportRuler::Private::None) { + if (d->showTabs && d->selected == KReportRuler::Private::Selection::None) { // still haven't found something so let assume the user wants to add a tab qreal tabpos; if (d->rightToLeft) { @@ -1301,26 +1311,26 @@ QTextOption::LeftTab); d->tabs.append(t); d->selectOffset = 0; - d->selected = KReportRuler::Private::Tab; + d->selected = KReportRuler::Private::Selection::Tab; d->currentIndex = d->tabs.count() - 1; d->originalIndex = -1; // new! update(); } if (d->orientation == Qt::Horizontal && (ev->modifiers() & Qt::ShiftModifier) && - (d->selected == KReportRuler::Private::FirstLineIndent || - d->selected == KReportRuler::Private::ParagraphIndent || - d->selected == KReportRuler::Private::Tab || - d->selected == KReportRuler::Private::EndIndent)) + (d->selected == KReportRuler::Private::Selection::FirstLineIndent || + d->selected == KReportRuler::Private::Selection::ParagraphIndent || + d->selected == KReportRuler::Private::Selection::Tab || + d->selected == KReportRuler::Private::Selection::EndIndent)) d->paintingStrategy = d->distancesPaintingStrategy; - if (d->selected != KReportRuler::Private::None) + if (d->selected != KReportRuler::Private::Selection::None) emit aboutToChange(); } void KReportRuler::mouseReleaseEvent ( QMouseEvent* ev ) { ev->accept(); - if (d->selected == KReportRuler::Private::Tab) { + if (d->selected == KReportRuler::Private::Selection::Tab) { if (d->originalIndex >= 0 && !d->tabMoved) { int type = d->tabs[d->currentIndex].type; type++; @@ -1331,13 +1341,13 @@ } d->emitTabChanged(); } - else if( d->selected != KReportRuler::Private::None) + else if( d->selected != KReportRuler::Private::Selection::None) emit indentsChanged(true); else ev->ignore(); d->paintingStrategy = d->normalPaintingStrategy; - d->selected = KReportRuler::Private::None; + d->selected = KReportRuler::Private::Selection::None; } void KReportRuler::mouseMoveEvent ( QMouseEvent* ev ) @@ -1347,7 +1357,7 @@ qreal activeLength = d->effectiveActiveRangeEnd() - d->effectiveActiveRangeStart(); switch (d->selected) { - case KReportRuler::Private::FirstLineIndent: + case KReportRuler::Private::Selection::FirstLineIndent: if (d->rightToLeft) d->firstLineIndent = d->effectiveActiveRangeEnd() - d->paragraphIndent - d->viewConverter->viewToDocumentX(pos.x() + d->selectOffset - d->offset); @@ -1364,7 +1374,7 @@ emit indentsChanged(false); break; - case KReportRuler::Private::ParagraphIndent: + case KReportRuler::Private::Selection::ParagraphIndent: if (d->rightToLeft) d->paragraphIndent = d->effectiveActiveRangeEnd() - d->viewConverter->viewToDocumentX(pos.x() + d->selectOffset - d->offset); @@ -1383,7 +1393,7 @@ d->paragraphIndent = activeLength - d->endIndent; emit indentsChanged(false); break; - case KReportRuler::Private::EndIndent: + case KReportRuler::Private::Selection::EndIndent: if (d->rightToLeft) d->endIndent = d->viewConverter->viewToDocumentX(pos.x() + d->selectOffset - d->offset) - d->effectiveActiveRangeStart(); @@ -1402,7 +1412,7 @@ d->endIndent = activeLength - d->paragraphIndent; emit indentsChanged(false); break; - case KReportRuler::Private::Tab: + case KReportRuler::Private::Selection::Tab: d->tabMoved = true; if (d->currentIndex < 0) { // tab is deleted. if (ev->pos().y() < height()) { // reinstante it. @@ -1438,16 +1448,16 @@ d->emitTabChanged(); break; - case KReportRuler::Private::HotSpot: + case KReportRuler::Private::Selection::HotSpot: qreal newPos; if (d->orientation == Qt::Horizontal) newPos= d->viewConverter->viewToDocumentX(pos.x() - d->offset); else newPos= d->viewConverter->viewToDocumentY(pos.y() - d->offset); d->hotspots[d->currentIndex].position = newPos; emit hotSpotChanged(d->hotspots[d->currentIndex].id, newPos); break; - case KReportRuler::Private::None: + case KReportRuler::Private::Selection::None: d->mouseCoordinate = (d->orientation == Qt::Horizontal ? pos.x() : pos.y()) - d->offset; int hotSpotIndex = d->hotSpotIndex(pos); if (hotSpotIndex >= 0) { @@ -1459,10 +1469,10 @@ KReportRuler::Private::Selection selection = d->selectionAtPosition(pos); QString text; switch(selection) { - case KReportRuler::Private::FirstLineIndent: text = tr("First line indent"); break; - case KReportRuler::Private::ParagraphIndent: text = tr("Left indent"); break; - case KReportRuler::Private::EndIndent: text = tr("Right indent"); break; - case KReportRuler::Private::None: + case KReportRuler::Private::Selection::FirstLineIndent: text = tr("First line indent"); break; + case KReportRuler::Private::Selection::ParagraphIndent: text = tr("Left indent"); break; + case KReportRuler::Private::Selection::EndIndent: text = tr("Right indent"); break; + case KReportRuler::Private::Selection::None: if (ev->buttons() & Qt::LeftButton) { if (d->orientation == Qt::Horizontal && ev->pos().y() > height() + OutsideRulerThreshold) emit guideLineCreated(d->orientation, d->viewConverter->viewToDocumentY(ev->pos().y())); diff --git a/src/wrtembed/KReportSectionEditor.cpp b/src/wrtembed/KReportSectionEditor.cpp --- a/src/wrtembed/KReportSectionEditor.cpp +++ b/src/wrtembed/KReportSectionEditor.cpp @@ -112,20 +112,20 @@ // set all the properties - m_ui.cbReportHeader->setChecked(m_reportDesigner->section(KReportSectionData::ReportHeader)); - m_ui.cbReportFooter->setChecked(m_reportDesigner->section(KReportSectionData::ReportFooter)); + m_ui.cbReportHeader->setChecked(m_reportDesigner->section(KReportSectionData::Type::ReportHeader)); + m_ui.cbReportFooter->setChecked(m_reportDesigner->section(KReportSectionData::Type::ReportFooter)); - m_ui.cbHeadFirst->setChecked(m_reportDesigner->section(KReportSectionData::PageHeaderFirst)); - m_ui.cbHeadOdd->setChecked(m_reportDesigner->section(KReportSectionData::PageHeaderOdd)); - m_ui.cbHeadEven->setChecked(m_reportDesigner->section(KReportSectionData::PageHeaderEven)); - m_ui.cbHeadLast->setChecked(m_reportDesigner->section(KReportSectionData::PageHeaderLast)); - m_ui.cbHeadAny->setChecked(m_reportDesigner->section(KReportSectionData::PageHeaderAny)); + m_ui.cbHeadFirst->setChecked(m_reportDesigner->section(KReportSectionData::Type::PageHeaderFirst)); + m_ui.cbHeadOdd->setChecked(m_reportDesigner->section(KReportSectionData::Type::PageHeaderOdd)); + m_ui.cbHeadEven->setChecked(m_reportDesigner->section(KReportSectionData::Type::PageHeaderEven)); + m_ui.cbHeadLast->setChecked(m_reportDesigner->section(KReportSectionData::Type::PageHeaderLast)); + m_ui.cbHeadAny->setChecked(m_reportDesigner->section(KReportSectionData::Type::PageHeaderAny)); - m_ui.cbFootFirst->setChecked(m_reportDesigner->section(KReportSectionData::PageFooterFirst)); - m_ui.cbFootOdd->setChecked(m_reportDesigner->section(KReportSectionData::PageFooterOdd)); - m_ui.cbFootEven->setChecked(m_reportDesigner->section(KReportSectionData::PageFooterEven)); - m_ui.cbFootLast->setChecked(m_reportDesigner->section(KReportSectionData::PageFooterLast)); - m_ui.cbFootAny->setChecked(m_reportDesigner->section(KReportSectionData::PageFooterAny)); + m_ui.cbFootFirst->setChecked(m_reportDesigner->section(KReportSectionData::Type::PageFooterFirst)); + m_ui.cbFootOdd->setChecked(m_reportDesigner->section(KReportSectionData::Type::PageFooterOdd)); + m_ui.cbFootEven->setChecked(m_reportDesigner->section(KReportSectionData::Type::PageFooterEven)); + m_ui.cbFootLast->setChecked(m_reportDesigner->section(KReportSectionData::Type::PageFooterLast)); + m_ui.cbFootAny->setChecked(m_reportDesigner->section(KReportSectionData::Type::PageFooterAny)); // now set the rw value if (m_reportSectionDetail) { @@ -161,9 +161,9 @@ { if (m_reportDesigner) { if (yes) { - m_reportDesigner->insertSection(KReportSectionData::ReportHeader); + m_reportDesigner->insertSection(KReportSectionData::Type::ReportHeader); } else { - m_reportDesigner->removeSection(KReportSectionData::ReportHeader); + m_reportDesigner->removeSection(KReportSectionData::Type::ReportHeader); } } @@ -173,9 +173,9 @@ { if (m_reportDesigner) { if (yes) { - m_reportDesigner->insertSection(KReportSectionData::ReportFooter); + m_reportDesigner->insertSection(KReportSectionData::Type::ReportFooter); } else { - m_reportDesigner->removeSection(KReportSectionData::ReportFooter); + m_reportDesigner->removeSection(KReportSectionData::Type::ReportFooter); } } @@ -185,9 +185,9 @@ { if (m_reportDesigner) { if (yes) { - m_reportDesigner->insertSection(KReportSectionData::PageHeaderFirst); + m_reportDesigner->insertSection(KReportSectionData::Type::PageHeaderFirst); } else { - m_reportDesigner->removeSection(KReportSectionData::PageHeaderFirst); + m_reportDesigner->removeSection(KReportSectionData::Type::PageHeaderFirst); } } @@ -197,9 +197,9 @@ { if (m_reportDesigner) { if (yes) { - m_reportDesigner->insertSection(KReportSectionData::PageHeaderLast); + m_reportDesigner->insertSection(KReportSectionData::Type::PageHeaderLast); } else { - m_reportDesigner->removeSection(KReportSectionData::PageHeaderLast); + m_reportDesigner->removeSection(KReportSectionData::Type::PageHeaderLast); } } @@ -209,9 +209,9 @@ { if (m_reportDesigner) { if (yes) { - m_reportDesigner->insertSection(KReportSectionData::PageHeaderEven); + m_reportDesigner->insertSection(KReportSectionData::Type::PageHeaderEven); } else { - m_reportDesigner->removeSection(KReportSectionData::PageHeaderEven); + m_reportDesigner->removeSection(KReportSectionData::Type::PageHeaderEven); } } @@ -221,9 +221,9 @@ { if (m_reportDesigner) { if (yes) { - m_reportDesigner->insertSection(KReportSectionData::PageHeaderOdd); + m_reportDesigner->insertSection(KReportSectionData::Type::PageHeaderOdd); } else { - m_reportDesigner->removeSection(KReportSectionData::PageHeaderOdd); + m_reportDesigner->removeSection(KReportSectionData::Type::PageHeaderOdd); } } @@ -233,9 +233,9 @@ { if (m_reportDesigner) { if (yes) { - m_reportDesigner->insertSection(KReportSectionData::PageFooterFirst); + m_reportDesigner->insertSection(KReportSectionData::Type::PageFooterFirst); } else { - m_reportDesigner->removeSection(KReportSectionData::PageFooterFirst); + m_reportDesigner->removeSection(KReportSectionData::Type::PageFooterFirst); } } @@ -245,9 +245,9 @@ { if (m_reportDesigner) { if (yes) { - m_reportDesigner->insertSection(KReportSectionData::PageFooterLast); + m_reportDesigner->insertSection(KReportSectionData::Type::PageFooterLast); } else { - m_reportDesigner->removeSection(KReportSectionData::PageFooterLast); + m_reportDesigner->removeSection(KReportSectionData::Type::PageFooterLast); } } @@ -257,9 +257,9 @@ { if (m_reportDesigner) { if (yes) { - m_reportDesigner->insertSection(KReportSectionData::PageFooterEven); + m_reportDesigner->insertSection(KReportSectionData::Type::PageFooterEven); } else { - m_reportDesigner->removeSection(KReportSectionData::PageFooterEven); + m_reportDesigner->removeSection(KReportSectionData::Type::PageFooterEven); } } @@ -269,9 +269,9 @@ { if (m_reportDesigner) { if (yes) { - m_reportDesigner->insertSection(KReportSectionData::PageFooterOdd); + m_reportDesigner->insertSection(KReportSectionData::Type::PageFooterOdd); } else { - m_reportDesigner->removeSection(KReportSectionData::PageFooterOdd); + m_reportDesigner->removeSection(KReportSectionData::Type::PageFooterOdd); } } @@ -365,20 +365,20 @@ { if (m_reportDesigner) { if (yes) { - m_reportDesigner->insertSection(KReportSectionData::PageHeaderAny); + m_reportDesigner->insertSection(KReportSectionData::Type::PageHeaderAny); } else { - m_reportDesigner->removeSection(KReportSectionData::PageHeaderAny); + m_reportDesigner->removeSection(KReportSectionData::Type::PageHeaderAny); } } } void KReportSectionEditor::cbFootAny_toggled(bool yes) { if (m_reportDesigner) { if (yes) { - m_reportDesigner->insertSection(KReportSectionData::PageFooterAny); + m_reportDesigner->insertSection(KReportSectionData::Type::PageFooterAny); } else { - m_reportDesigner->removeSection(KReportSectionData::PageFooterAny); + m_reportDesigner->removeSection(KReportSectionData::Type::PageFooterAny); } } } diff --git a/src/wrtembed/KReportZoomHandler_p.h b/src/wrtembed/KReportZoomHandler_p.h --- a/src/wrtembed/KReportZoomHandler_p.h +++ b/src/wrtembed/KReportZoomHandler_p.h @@ -103,20 +103,21 @@ void setZoom(qreal zoom); /** - * Change the zoom mode - * @param zoomMode the zoom mode. + * Change the zoom type + * @param zoomType the zoom type. */ - inline void setZoomMode(KReportZoomMode::Mode zoomMode) { m_zoomMode = zoomMode; } + inline void setZoomMode(KReportZoomMode::Type zoomType) { m_zoomType = zoomType; } /** * @return the global zoom factor (e.g. 100 for 100%). * Only use this to display to the user, don't use in calculations */ inline int zoomInPercent() const { return qRound(zoom() * 100); } + /** - * @return the global zoom mode (e.g. KReportZoomMode::ZOOM_WIDTH). + * @return the global zoom type (e.g. KReportZoomMode::Type::Width). * use this to determine how to zoom */ - KReportZoomMode::Mode zoomMode() const { return m_zoomMode; } + KReportZoomMode::Type zoomType() const { return m_zoomType; } // Input: pt. Output: pixels. Resolution and zoom are applied. @@ -220,7 +221,7 @@ qreal zoom() const; private: - KReportZoomMode::Mode m_zoomMode; + KReportZoomMode::Type m_zoomType; qreal m_resolutionX; qreal m_resolutionY; diff --git a/src/wrtembed/KReportZoomHandler_p.cpp b/src/wrtembed/KReportZoomHandler_p.cpp --- a/src/wrtembed/KReportZoomHandler_p.cpp +++ b/src/wrtembed/KReportZoomHandler_p.cpp @@ -27,15 +27,15 @@ #include KReportZoomHandler::KReportZoomHandler() - : m_zoomMode(KReportZoomMode::ZOOM_CONSTANT) + : m_zoomType(KReportZoomMode::Type::Constant) , m_resolutionX(0) , m_resolutionY(0) , m_zoomedResolutionX(0) , m_zoomedResolutionY(0) , m_zoomLevel(1.0) { setZoom(1.0); - setZoomMode( KReportZoomMode::ZOOM_CONSTANT ); + setZoomMode(KReportZoomMode::Type::Constant); setDpi(KReportPrivate::dpiX(), KReportPrivate::dpiY()); } diff --git a/src/wrtembed/KReportZoomMode_p.h b/src/wrtembed/KReportZoomMode_p.h --- a/src/wrtembed/KReportZoomMode_p.h +++ b/src/wrtembed/KReportZoomMode_p.h @@ -21,38 +21,37 @@ #ifndef _KREPORTZOOMMODE_H_ #define _KREPORTZOOMMODE_H_ -#include +#include #include "kreport_export.h" /** * The ZoomMode container */ class KReportZoomMode { + Q_DECLARE_TR_FUNCTIONS(KReportZoomMode) public: - enum Mode + enum class Type { - ZOOM_CONSTANT = 0, ///< zoom x % - ZOOM_WIDTH = 1, ///< zoom pagewidth - ZOOM_PAGE = 2, ///< zoom to pagesize - ZOOM_PIXELS = 4, ///< zoom to actual pixels - ZOOM_TEXT = 8 ///< zoom to actual pixels + Constant, ///< zoom x % + Width, ///< zoom pagewidth + Page, ///< zoom to pagesize + Pixels, ///< zoom to actual pixels + Text ///< zoom to text }; - Q_DECLARE_FLAGS(Modes, Mode) + /// \param type name + /// \return type converted + static Type toType(const QString &string); - /// \param mode the mode name - /// \return the to Mode converted QString \c mode - static Mode toMode(const QString& mode); + /// \return QString converted and translated for type + static QString toString(Type type); - /// \return the to QString converted and translated Mode \c mode - static QString toString(Mode mode); - - /// \param mode the mode name + /// \param type name /// \return true if \c mode isn't dependent on windowsize static bool isConstant(const QString& mode) - { return toMode(mode) == ZOOM_CONSTANT; } + { return toType(mode) == Type::Constant; } /** * Return the minimum zoom possible for documents. @@ -94,13 +93,6 @@ * \param zoom The maximum zoom to use. */ static void setMaximumZoom(qreal zoom); - -private: - static const char * const modes[]; - static qreal minimumZoomValue; - static qreal maximumZoomValue; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(KReportZoomMode::Modes) - #endif diff --git a/src/wrtembed/KReportZoomMode_p.cpp b/src/wrtembed/KReportZoomMode_p.cpp --- a/src/wrtembed/KReportZoomMode_p.cpp +++ b/src/wrtembed/KReportZoomMode_p.cpp @@ -22,7 +22,8 @@ #include -const char* const KReportZoomMode::modes[] = +namespace{ +static const char* const s_types[] = { QT_TRANSLATE_NOOP("KReportZoomMode", "%1%"), QT_TRANSLATE_NOOP("KReportZoomMode", "Fit Page Width"), @@ -35,59 +36,58 @@ QT_TRANSLATE_NOOP("KReportZoomMode", "Fit Text Width") }; -qreal KReportZoomMode::minimumZoomValue = 0.2; -qreal KReportZoomMode::maximumZoomValue = 5.0; +qreal s_minimumZoomValue = 0.2; +qreal s_maximumZoomValue = 5.0; +} -QString KReportZoomMode::toString(Mode mode) +QString KReportZoomMode::toString(Type type) { - return QCoreApplication::translate("KReportZoomMode", modes[mode]); + return tr(s_types[static_cast(type)]); } -KReportZoomMode::Mode KReportZoomMode::toMode(const QString& mode) +KReportZoomMode::Type KReportZoomMode::toType(const QString& string) { - if(mode == QCoreApplication::translate("KReportZoomMode", modes[ZOOM_WIDTH])) - return ZOOM_WIDTH; - else - if(mode == QCoreApplication::translate("KReportZoomMode", modes[ZOOM_PAGE])) - return ZOOM_PAGE; - else - if(mode == QCoreApplication::translate("KReportZoomMode", modes[ZOOM_PIXELS])) - return ZOOM_PIXELS; - else - if(mode == QCoreApplication::translate("KReportZoomMode", modes[ZOOM_TEXT])) - return ZOOM_TEXT; - else - return ZOOM_CONSTANT; - // we return ZOOM_CONSTANT else because then we can pass '10%' or '15%' - // or whatever, it's automatically converted. ZOOM_CONSTANT is - // changeable, whereas all other zoom modes (non-constants) are normal - // text like "Fit to xxx". they let the view grow/shrink according - // to windowsize, hence the term 'non-constant' + if(string == toString(Type::Width)) { + return Type::Width; + } else if (string == toString(Type::Page)) { + return Type::Page; + } else if (string == toString(Type::Pixels)) { + return Type::Pixels; + } else if (string == toString(Type::Text)) { + return Type::Text; + } else { + // we return Constant else because then we can pass '10%' or '15%' + // or whatever, it's automatically converted. Constant is + // changeable, whereas all other zoom modes (non-constants) are normal + // text like "Fit to xxx". they let the view grow/shrink according + // to windowsize, hence the term 'non-constant' + return Type::Constant; + } } qreal KReportZoomMode::minimumZoom() { - return minimumZoomValue; + return s_minimumZoomValue; } qreal KReportZoomMode::maximumZoom() { - return maximumZoomValue; + return s_maximumZoomValue; } qreal KReportZoomMode::clampZoom(qreal zoom) { - return qMin(maximumZoomValue, qMax(minimumZoomValue, zoom)); + return qMin(s_maximumZoomValue, qMax(s_minimumZoomValue, zoom)); } void KReportZoomMode::setMinimumZoom(qreal zoom) { Q_ASSERT(zoom > 0.0f); - minimumZoomValue = zoom; + s_minimumZoomValue = zoom; } void KReportZoomMode::setMaximumZoom(qreal zoom) { Q_ASSERT(zoom > 0.0f); - maximumZoomValue = zoom; + s_maximumZoomValue = zoom; }