0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-10-09 14:04:43 +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

@@ -30,15 +30,22 @@
#include "lrtextitempropertyeditor.h"
#include "ui_ltextitempropertyeditor.h"
#include <QCompleter>
#include <QListWidget>
namespace LimeReport{
TextItemPropertyEditor::TextItemPropertyEditor(QWidget *parent) :
TextItemPropertyEditor::TextItemPropertyEditor(QWidget *parent, const QStringList &availVars) :
QDialog(parent),
ui(new Ui::TextItemPropertyEditor)
{
ui->setupUi(this);
ui->textEdit->setAcceptRichText(false);
ui->listVars->setVisible(!availVars.isEmpty());
ui->listVars->addItems(availVars);
connect(ui->listVars, &QListWidget::itemClicked, this,
[this](QListWidgetItem *item) {
ui->textEdit->setPlainText(item->text());
});
}
TextItemPropertyEditor::~TextItemPropertyEditor()

View File

@@ -43,7 +43,7 @@ class TextItemPropertyEditor : public QDialog
{
Q_OBJECT
public:
explicit TextItemPropertyEditor(QWidget *parent = 0);
explicit TextItemPropertyEditor(QWidget *parent = 0, const QStringList &availVars ={});
~TextItemPropertyEditor();
void setText(const QString &value);
QString text();

View File

@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>530</width>
<height>369</height>
</rect>
</property>
<property name="windowIcon">
@@ -25,7 +25,21 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextEdit" name="textEdit"/>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTextEdit" name="textEdit"/>
</item>
<item>
<widget class="QListWidget" name="listVars">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
@@ -38,6 +52,7 @@
</widget>
<resources>
<include location="../../items/items.qrc"/>
<include location="../../items/items.qrc"/>
</resources>
<connections>
<connection>

View File

@@ -3,6 +3,7 @@
#include "editors/lrbuttonlineeditor.h"
#include "items/lrtextitemeditor.h"
#include <QApplication>
#include <QMessageBox>
namespace{
LimeReport::ObjectPropItem * createContentPropItem(
@@ -11,6 +12,7 @@ namespace{
return new LimeReport::ContentPropItem(object, objects, name, displayName, data, parent, readonly);
}
bool VARIABLE_IS_NOT_USED registredContentProp = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("content","LimeReport::TextItem"),QObject::tr("content"),createContentPropItem);
bool VARIABLE_IS_NOT_USED registredContentBProp = LimeReport::ObjectPropFactory::instance().registerCreator(LimeReport::APropIdent("content","LimeReport::BarcodeItem"),QObject::tr("content"),createContentPropItem);
} // namespace
namespace LimeReport {
@@ -22,12 +24,17 @@ QWidget *ContentPropItem::createProperyEditor(QWidget *parent) const
void ContentEditor::editButtonClicked()
{
qDebug() << Q_FUNC_INFO;
QDialog* dialog = new QDialog(QApplication::activeWindow());
dialog->setLayout(new QVBoxLayout());
dialog->layout()->setContentsMargins(1,1,1,1);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setWindowTitle(propertyName());
QWidget* editor = dynamic_cast<BaseDesignIntf*>(m_object)->defaultEditor();
if(!editor) {
QMessageBox::critical(QApplication::activeWindow(), tr("Error"), tr("No default editor set"));
return;
}
dialog->layout()->addWidget(editor);
dialog->resize(editor->size());
connect(editor,SIGNAL(destroyed()),dialog,SLOT(close()));