0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-12-14 08:50:58 +03:00

Add barcodeVariablesList

This commit is contained in:
Sanych
2024-11-26 17:41:53 +03:00
parent b59dd19555
commit da3e8f302f
11 changed files with 67 additions and 10 deletions

View File

@@ -31,6 +31,9 @@
#include "lrdesignelementsfactory.h"
#include "qzint.h"
#include "lrglobal.h"
#include "objectinspector/editors/lrtextitempropertyeditor.h"
#include <QApplication>
#include "lrreportdesignwindow.h"
namespace{
@@ -46,9 +49,9 @@ bool VARIABLE_IS_NOT_USED registred = LimeReport::DesignElementsFactory::instanc
namespace LimeReport{
BarcodeItem::BarcodeItem(QObject* owner,QGraphicsItem* parent)
: ContentItemDesignIntf(xmlTag,owner,parent),m_designTestValue("1"), m_barcodeType(CODE128),
: ContentItemDesignIntf(xmlTag,owner,parent),m_designTestValue("1"), m_barcodeType(EAN128),
m_foregroundColor(Qt::black), m_backgroundColor(Qt::white), m_whitespace(10), m_angle(Angle0),
m_barcodeWidth(0), m_securityLevel(0), m_pdf417CodeWords(928), m_inputMode(UNICODE_INPUT_MODE),
m_barcodeWidth(0), m_securityLevel(0), m_pdf417CodeWords(928), m_inputMode(GS1_INPUT_MODE),
m_escapeMode(false), m_hideText(false), m_option3(0), m_hideIfEmpty(false)
{}
@@ -353,6 +356,21 @@ bool BarcodeItem::isEmpty() const
return m_content.isEmpty();
}
QWidget *BarcodeItem::defaultEditor()
{
ReportDesignWindow* dw = nullptr;
auto re = reportEditor();
if(re)
dw = dynamic_cast<ReportDesignWindow*>(re->getDesignerWindow());
qDebug() << re << dw;
auto editor =
new TextItemPropertyEditor(QApplication::activeWindow(),
dw ? dw->barcodeVariables() : QStringList{});
editor->setText(m_content);
editor->setAttribute(Qt::WA_DeleteOnClose);
return editor;
}
void BarcodeItem::expandContent(QString data, DataSourceManager* dataManager, RenderPass pass)
{
setContent(expandUserVariables(data, pass, NoEscapeSymbols, dataManager));

View File

@@ -203,7 +203,7 @@ public:
bool hideIfEmpty() const;
void setHideIfEmpty(bool hideIfEmpty);
bool isEmpty() const;
QWidget * defaultEditor();
private:
void expandContent(QString data, DataSourceManager *dataManager, RenderPass pass);

View File

@@ -51,7 +51,6 @@ LimeReport::BaseDesignIntf * createTextItem(QObject* owner, LimeReport::BaseDesi
return new LimeReport::TextItem(owner,parent);
}
bool VARIABLE_IS_NOT_USED registred = LimeReport::DesignElementsFactory::instance().registerCreator(xmlTag, LimeReport::ItemAttribs(QObject::tr("Text Item"),"TextItem"), createTextItem);
}
namespace LimeReport{