mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-24 00:33:02 +03:00
Border editor refactoring
This commit is contained in:
parent
ba9abc7877
commit
7bf0ce51e6
BIN
limereport/images/border_settings.png
Normal file
BIN
limereport/images/border_settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
@ -1,287 +0,0 @@
|
|||||||
#include "borderframeeditor.h"
|
|
||||||
#include "ui_borderframeeditor.h"
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QGraphicsLineItem>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QMouseEvent>
|
|
||||||
#include "lrbasedesignintf.h"
|
|
||||||
#include "lrbordereditor.h"
|
|
||||||
using namespace LimeReport;
|
|
||||||
BorderFrameEditor::BorderFrameEditor(QWidget *parent)
|
|
||||||
: QWidget(parent)
|
|
||||||
, ui(new Ui::BorderFrameEditor)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
scene = new QGraphicsScene(ui->graphicsView);
|
|
||||||
|
|
||||||
QRect vRect = rect();
|
|
||||||
|
|
||||||
//Draw corder lines
|
|
||||||
//topLeft
|
|
||||||
scene->addLine(10,5, 10,10,QPen(Qt::gray));
|
|
||||||
scene->addLine(5,10, 10,10,QPen(Qt::gray));
|
|
||||||
//bottomLeft
|
|
||||||
scene->addLine(10,vRect.bottom() -5, 10,vRect.bottom()-10,QPen(Qt::gray));
|
|
||||||
scene->addLine(5,vRect.bottom()-10,10,vRect.bottom()-10,QPen(Qt::gray));
|
|
||||||
//bottomRight
|
|
||||||
scene->addLine(vRect.right()-10,vRect.bottom() -5,vRect.right()- 10,vRect.bottom()-10,QPen(Qt::gray));
|
|
||||||
scene->addLine(vRect.right()-5,vRect.bottom()-10,vRect.right()-10,vRect.bottom()-10,QPen(Qt::gray));
|
|
||||||
//topRight
|
|
||||||
scene->addLine(vRect.width()-10,5,vRect.width()- 10,10,QPen(Qt::gray));
|
|
||||||
scene->addLine(vRect.width()-5,10, vRect.width()-10,10,QPen(Qt::gray));
|
|
||||||
scene->setSceneRect(vRect);
|
|
||||||
ui->graphicsView->setScene(scene);
|
|
||||||
QGraphicsSimpleTextItem * io = new QGraphicsSimpleTextItem();
|
|
||||||
io->setAcceptedMouseButtons(Qt::LeftButton);
|
|
||||||
io->setPos(scene->sceneRect().center());
|
|
||||||
io->setText(tr("Text"));
|
|
||||||
scene->addItem(io);
|
|
||||||
|
|
||||||
QRectF bR = io->sceneBoundingRect();
|
|
||||||
io->setPos( scene->sceneRect().center().x() - bR.width()/2, scene->sceneRect().center().y() - bR.height()/2 );
|
|
||||||
connect(this,SIGNAL(borderSideClicked(int, bool)),this,SLOT(SlotBorderSideClicked(int,bool)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
BorderFrameEditor::~BorderFrameEditor()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BorderFrameEditor::setPen(QPen pen)
|
|
||||||
{
|
|
||||||
m_pen = pen;
|
|
||||||
updateBorders();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QPen BorderFrameEditor::pen()
|
|
||||||
{
|
|
||||||
return m_pen;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BorderFrameEditor::setAllLines()
|
|
||||||
{
|
|
||||||
|
|
||||||
topLine = scene->addLine(QLineF(10,10,rect().width() - 10,10),m_pen);
|
|
||||||
|
|
||||||
|
|
||||||
leftLine = scene->addLine(QLineF(10,10,10,rect().height() - 10),m_pen);
|
|
||||||
|
|
||||||
bottomLine = scene->addLine(QLineF(10,rect().bottom() -10,rect().width() - 10
|
|
||||||
,rect().bottom() - 10),m_pen);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rightLine = scene->addLine(QLineF(rect().width() - 10,10
|
|
||||||
,rect().width() - 10,rect().height() - 10),m_pen);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void BorderFrameEditor::unSetAllLines()
|
|
||||||
{
|
|
||||||
if(topLine)
|
|
||||||
{
|
|
||||||
scene->removeItem(topLine);
|
|
||||||
|
|
||||||
}
|
|
||||||
if(leftLine)
|
|
||||||
{
|
|
||||||
scene->removeItem(leftLine);
|
|
||||||
|
|
||||||
}
|
|
||||||
if(bottomLine)
|
|
||||||
{
|
|
||||||
scene->removeItem(bottomLine);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
if(rightLine)
|
|
||||||
{
|
|
||||||
scene->removeItem(rightLine);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void BorderFrameEditor::mousePressEvent(QMouseEvent *event)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(event->x() >= 10 && event->y() <30)//Draw top border
|
|
||||||
{
|
|
||||||
|
|
||||||
if(!topLine)
|
|
||||||
{
|
|
||||||
|
|
||||||
emit borderSideClicked(1,true);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
emit borderSideClicked(1,false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if((event->x() >= 10 && event->x() < 30) && (event->y() > 10)) //Draw border left
|
|
||||||
{
|
|
||||||
if(!leftLine)
|
|
||||||
{
|
|
||||||
|
|
||||||
emit borderSideClicked(4,true);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
emit borderSideClicked(4,false);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(event->x() >= 10 && (event->y() >80 && event->y() < rect().bottom())) //Draw bottom border
|
|
||||||
{
|
|
||||||
if(!bottomLine)
|
|
||||||
{
|
|
||||||
|
|
||||||
emit borderSideClicked(2,true);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
emit borderSideClicked(2,false);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if((event->x() >= 130 && event->x() < rect().width()) && event->y() > 10) //Draw border right
|
|
||||||
{
|
|
||||||
if(!rightLine)
|
|
||||||
{
|
|
||||||
|
|
||||||
emit borderSideClicked(8,true);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
emit borderSideClicked(8,false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void BorderFrameEditor::SlotBorderSideClicked(int side, bool show)
|
|
||||||
{
|
|
||||||
|
|
||||||
switch(side)
|
|
||||||
{
|
|
||||||
case BaseDesignIntf::BorderSide::TopLine:
|
|
||||||
{
|
|
||||||
if(show)
|
|
||||||
{
|
|
||||||
topLine = scene->addLine(QLineF(10,10,rect().width() - 10,10),m_pen);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scene->removeItem(topLine);
|
|
||||||
topLine = NULL;
|
|
||||||
|
|
||||||
}
|
|
||||||
}break;
|
|
||||||
case BaseDesignIntf::LeftLine:
|
|
||||||
{
|
|
||||||
if(show)
|
|
||||||
{
|
|
||||||
leftLine = scene->addLine(QLineF(10,10,10,rect().height() - 10),m_pen);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scene->removeItem(leftLine);
|
|
||||||
leftLine = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}break;
|
|
||||||
case BaseDesignIntf::BottomLine:
|
|
||||||
{
|
|
||||||
if(show)
|
|
||||||
{
|
|
||||||
bottomLine = scene->addLine(QLineF(10,rect().bottom() -10,rect().width() - 10
|
|
||||||
,rect().bottom() - 10),m_pen);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scene->removeItem(bottomLine);
|
|
||||||
bottomLine = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}break;
|
|
||||||
case BaseDesignIntf::RightLine:
|
|
||||||
{
|
|
||||||
if(show)
|
|
||||||
{
|
|
||||||
rightLine = scene->addLine(QLineF(rect().width() - 10,10
|
|
||||||
,rect().width() - 10,rect().height() - 10),m_pen);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scene->removeItem(rightLine);
|
|
||||||
rightLine = NULL;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
updateBorders();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BorderFrameEditor::updateBorders()
|
|
||||||
{
|
|
||||||
//if a line is set we redraw it
|
|
||||||
if(topLine)
|
|
||||||
{
|
|
||||||
scene->removeItem(topLine);
|
|
||||||
topLine = scene->addLine(QLineF(10,10,rect().width() - 10,10),m_pen);
|
|
||||||
|
|
||||||
}
|
|
||||||
if(leftLine)
|
|
||||||
{
|
|
||||||
scene->removeItem(leftLine);
|
|
||||||
leftLine = scene->addLine(QLineF(10,10,10,rect().height() - 10),m_pen);
|
|
||||||
|
|
||||||
}
|
|
||||||
if(bottomLine)
|
|
||||||
{
|
|
||||||
scene->removeItem(bottomLine);
|
|
||||||
|
|
||||||
bottomLine = scene->addLine(QLineF(10,rect().bottom() -10,rect().width() - 10
|
|
||||||
,rect().bottom() - 10),m_pen);
|
|
||||||
|
|
||||||
}
|
|
||||||
if(rightLine)
|
|
||||||
{
|
|
||||||
scene->removeItem(rightLine);
|
|
||||||
|
|
||||||
rightLine = scene->addLine(QLineF(rect().width() - 10,10
|
|
||||||
,rect().width() - 10,rect().height() - 10),m_pen);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -44,7 +44,7 @@ void ItemsBordersEditorWidget::setItemEvent(BaseDesignIntf* item)
|
|||||||
updateValues((BaseDesignIntf::BorderLines)borders.toInt());
|
updateValues((BaseDesignIntf::BorderLines)borders.toInt());
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
}
|
}
|
||||||
itm = item;
|
m_item = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemsBordersEditorWidget::properyChangedEvent(const QString& property, const QVariant& oldValue, const QVariant& newValue)
|
void ItemsBordersEditorWidget::properyChangedEvent(const QString& property, const QVariant& oldValue, const QVariant& newValue)
|
||||||
@ -72,21 +72,18 @@ void ItemsBordersEditorWidget::allBordesClicked()
|
|||||||
updateValues((BaseDesignIntf::BorderLines)borders);
|
updateValues((BaseDesignIntf::BorderLines)borders);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemsBordersEditorWidget::buttonClicked(bool)
|
void ItemsBordersEditorWidget::buttonClicked(bool){}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ItemsBordersEditorWidget::editBorderClicked()
|
void ItemsBordersEditorWidget::editBorderClicked()
|
||||||
{
|
{
|
||||||
lrbordereditor be;
|
BorderEditor be;
|
||||||
be.loadItem(itm);
|
be.loadItem(m_item);
|
||||||
if ( be.exec() == QDialog::Rejected ) return;
|
if ( be.exec() == QDialog::Rejected ) return;
|
||||||
updateValues(be.borderSides());
|
updateValues(be.borderSides());
|
||||||
itm->setBorderLinesFlags(be.borderSides());
|
m_item->setBorderLinesFlags(be.borderSides());
|
||||||
itm->setBorderLineSize(be.border_width());
|
m_item->setBorderLineSize(be.borderWidth());
|
||||||
itm->setBorderStyle((LimeReport::BaseDesignIntf::BorderStyle)be.border_style());
|
m_item->setBorderStyle((LimeReport::BaseDesignIntf::BorderStyle)be.borderStyle());
|
||||||
itm->setBorderColor(be.borderColor());
|
m_item->setBorderColor(be.borderColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemsBordersEditorWidget::initEditor()
|
void ItemsBordersEditorWidget::initEditor()
|
||||||
@ -129,7 +126,7 @@ void ItemsBordersEditorWidget::initEditor()
|
|||||||
addAction(m_allLines);
|
addAction(m_allLines);
|
||||||
addSeparator();
|
addSeparator();
|
||||||
m_BorderEditor = new QAction(tr("Edit border"),this);
|
m_BorderEditor = new QAction(tr("Edit border"),this);
|
||||||
m_BorderEditor->setIcon(QIcon(":/report/images/allLines"));
|
m_BorderEditor->setIcon(QIcon(":/report/images/borderEditor"));
|
||||||
connect(m_BorderEditor,SIGNAL(triggered()),this,SLOT(editBorderClicked()));
|
connect(m_BorderEditor,SIGNAL(triggered()),this,SLOT(editBorderClicked()));
|
||||||
addAction(m_BorderEditor);
|
addAction(m_BorderEditor);
|
||||||
|
|
||||||
@ -180,6 +177,21 @@ void ItemsBordersEditorWidgetForDesigner::allBordesClicked()
|
|||||||
ItemsBordersEditorWidget::allBordesClicked();
|
ItemsBordersEditorWidget::allBordesClicked();
|
||||||
m_reportEditor->setBorders(createBorders());
|
m_reportEditor->setBorders(createBorders());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ItemsBordersEditorWidgetForDesigner::editBorderClicked()
|
||||||
|
{
|
||||||
|
BorderEditor be;
|
||||||
|
be.loadItem(m_item);
|
||||||
|
if ( be.exec() == QDialog::Rejected ) return;
|
||||||
|
|
||||||
|
m_reportEditor->setBordersExt(
|
||||||
|
be.borderSides(),
|
||||||
|
be.borderWidth(),
|
||||||
|
(LimeReport::BaseDesignIntf::BorderStyle)be.borderStyle(),
|
||||||
|
be.borderColor()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} //namespace LimeReport
|
} //namespace LimeReport
|
||||||
|
@ -49,11 +49,12 @@ protected slots:
|
|||||||
virtual void noBordesClicked();
|
virtual void noBordesClicked();
|
||||||
virtual void allBordesClicked();
|
virtual void allBordesClicked();
|
||||||
virtual void buttonClicked(bool);
|
virtual void buttonClicked(bool);
|
||||||
void editBorderClicked();
|
virtual void editBorderClicked();
|
||||||
protected:
|
protected:
|
||||||
void setItemEvent(BaseDesignIntf *item);
|
void setItemEvent(BaseDesignIntf *item);
|
||||||
void properyChangedEvent(const QString &property, const QVariant &oldValue, const QVariant &newValue);
|
void properyChangedEvent(const QString &property, const QVariant &oldValue, const QVariant &newValue);
|
||||||
BaseDesignIntf::BorderLines createBorders();
|
BaseDesignIntf::BorderLines createBorders();
|
||||||
|
BaseDesignIntf *m_item;
|
||||||
private:
|
private:
|
||||||
void initEditor();
|
void initEditor();
|
||||||
void updateValues(BaseDesignIntf::BorderLines borders);
|
void updateValues(BaseDesignIntf::BorderLines borders);
|
||||||
@ -66,7 +67,7 @@ private:
|
|||||||
QAction* m_BorderEditor;
|
QAction* m_BorderEditor;
|
||||||
bool m_changing;
|
bool m_changing;
|
||||||
int m_borders;
|
int m_borders;
|
||||||
BaseDesignIntf *itm;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_REPORT_DESIGNER
|
#ifdef HAVE_REPORT_DESIGNER
|
||||||
@ -79,6 +80,7 @@ protected slots:
|
|||||||
void buttonClicked(bool);
|
void buttonClicked(bool);
|
||||||
void noBordesClicked();
|
void noBordesClicked();
|
||||||
void allBordesClicked();
|
void allBordesClicked();
|
||||||
|
void editBorderClicked();
|
||||||
private:
|
private:
|
||||||
ReportDesignWidget* m_reportEditor;
|
ReportDesignWidget* m_reportEditor;
|
||||||
|
|
||||||
|
BIN
limereport/items/images/border_settings.png
Normal file
BIN
limereport/items/images/border_settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
@ -2,51 +2,48 @@
|
|||||||
#include "ui_lrbordereditor.h"
|
#include "ui_lrbordereditor.h"
|
||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
#include "lrbasedesignintf.h"
|
#include "lrbasedesignintf.h"
|
||||||
lrbordereditor::lrbordereditor(QWidget *parent) :
|
|
||||||
|
namespace LimeReport{
|
||||||
|
|
||||||
|
BorderEditor::BorderEditor(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::lrbordereditor)
|
ui(new Ui::BorderEditor),
|
||||||
|
m_borderStyle(1),
|
||||||
|
m_borderWidth(1)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
connect(
|
||||||
connect(ui->borderFrame,SIGNAL(borderSideClicked(int, bool)), this, SLOT(checkToolButtons(int, bool)));
|
ui->borderFrame, SIGNAL(borderSideClicked(LimeReport::BaseDesignIntf::BorderSide, bool)),
|
||||||
|
this, SLOT(checkToolButtons(LimeReport::BaseDesignIntf::BorderSide, bool))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lrbordereditor::loadItem(LimeReport::BaseDesignIntf *i)
|
void BorderEditor::loadItem(LimeReport::BaseDesignIntf *item)
|
||||||
{
|
{
|
||||||
item = i;
|
m_item = item;
|
||||||
if(item->borderLines() & LimeReport::BaseDesignIntf::TopLine)
|
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::TopLine,
|
||||||
{
|
item->borderLines() & LimeReport::BaseDesignIntf::TopLine);
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::TopLine,true);
|
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::LeftLine,
|
||||||
|
item->borderLines() & LimeReport::BaseDesignIntf::LeftLine);
|
||||||
|
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::RightLine,
|
||||||
|
item->borderLines() & LimeReport::BaseDesignIntf::RightLine);
|
||||||
|
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::BottomLine,
|
||||||
|
item->borderLines() & LimeReport::BaseDesignIntf::BottomLine);
|
||||||
|
|
||||||
}
|
|
||||||
if(item->borderLines() & LimeReport::BaseDesignIntf::LeftLine)
|
|
||||||
{
|
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::LeftLine,true);
|
|
||||||
|
|
||||||
}
|
|
||||||
if(item->borderLines() & LimeReport::BaseDesignIntf::RightLine)
|
|
||||||
{
|
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::RightLine,true);
|
|
||||||
|
|
||||||
}
|
|
||||||
if(item->borderLines() & LimeReport::BaseDesignIntf::BottomLine)
|
|
||||||
{
|
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::BottomLine,true);
|
|
||||||
}
|
|
||||||
QPen pen;
|
QPen pen;
|
||||||
pen.setWidthF(item->borderLineSize());
|
pen.setWidthF(item->borderLineSize());
|
||||||
pen.setColor(item->borderColor());
|
pen.setColor(item->borderColor());
|
||||||
pen.setStyle((Qt::PenStyle)item->borderStyle());
|
pen.setStyle((Qt::PenStyle)item->borderStyle());
|
||||||
ui->borderFrame->setPen(pen);
|
ui->borderFrame->setPen(pen);
|
||||||
border_color = item->borderColor().name();
|
m_borderColor = item->borderColor().name();
|
||||||
ui->listWidget->setCurrentRow((Qt::PenStyle)item->borderStyle());
|
ui->listWidget->setCurrentRow((Qt::PenStyle)item->borderStyle());
|
||||||
ui->comboBox->setCurrentText(QString::number(item->borderLineSize()));
|
ui->comboBox->setCurrentText(QString::number(item->borderLineSize()));
|
||||||
borderWidth = ui->comboBox->currentText().toDouble();
|
m_borderWidth = ui->comboBox->currentText().toDouble();
|
||||||
borderStyle =ui->listWidget->currentRow();
|
m_borderStyle =ui->listWidget->currentRow();
|
||||||
ui->pushButton->setStyleSheet(QString("#pushButton{background-color:%1;}").arg(border_color));
|
ui->colorIndicator->setStyleSheet(QString("background-color:%1;").arg(m_borderColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
LimeReport::BaseDesignIntf::BorderLines lrbordereditor::borderSides()
|
LimeReport::BaseDesignIntf::BorderLines BorderEditor::borderSides()
|
||||||
{
|
{
|
||||||
int borders = 0;
|
int borders = 0;
|
||||||
borders += (ui->topLine->isChecked()) ? LimeReport::BaseDesignIntf::TopLine : 0;
|
borders += (ui->topLine->isChecked()) ? LimeReport::BaseDesignIntf::TopLine : 0;
|
||||||
@ -56,127 +53,104 @@ LimeReport::BaseDesignIntf::BorderLines lrbordereditor::borderSides()
|
|||||||
return (LimeReport::BaseDesignIntf::BorderLines) borders;
|
return (LimeReport::BaseDesignIntf::BorderLines) borders;
|
||||||
}
|
}
|
||||||
|
|
||||||
LimeReport::BaseDesignIntf::BorderStyle lrbordereditor::border_style()
|
LimeReport::BaseDesignIntf::BorderStyle BorderEditor::borderStyle()
|
||||||
{
|
{
|
||||||
return (LimeReport::BaseDesignIntf::BorderStyle)borderStyle;
|
return (LimeReport::BaseDesignIntf::BorderStyle) m_borderStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString lrbordereditor::borderColor()
|
QString BorderEditor::borderColor()
|
||||||
{
|
{
|
||||||
return border_color;
|
return m_borderColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
double lrbordereditor::border_width()
|
double BorderEditor::borderWidth()
|
||||||
{
|
{
|
||||||
return borderWidth;
|
return m_borderWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
lrbordereditor::~lrbordereditor()
|
BorderEditor::~BorderEditor()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lrbordereditor::on_listWidget_currentRowChanged(int currentRow)
|
void BorderEditor::on_listWidget_currentRowChanged(int currentRow)
|
||||||
{
|
{
|
||||||
QPen pen = ui->borderFrame->pen();
|
QPen pen = ui->borderFrame->pen();
|
||||||
pen.setStyle((Qt::PenStyle)currentRow);
|
pen.setStyle((Qt::PenStyle)currentRow);
|
||||||
borderStyle = currentRow;
|
m_borderStyle = currentRow;
|
||||||
ui->borderFrame->setPen(pen);
|
ui->borderFrame->setPen(pen);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BorderEditor::on_comboBox_currentTextChanged(const QString &arg1)
|
||||||
void lrbordereditor::on_comboBox_currentTextChanged(const QString &arg1)
|
|
||||||
{
|
{
|
||||||
QPen pen = ui->borderFrame->pen();
|
QPen pen = ui->borderFrame->pen();
|
||||||
pen.setWidthF(arg1.toDouble());
|
pen.setWidthF(arg1.toDouble());
|
||||||
ui->borderFrame->setPen(pen);
|
ui->borderFrame->setPen(pen);
|
||||||
borderWidth = arg1.toDouble();
|
m_borderWidth = arg1.toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BorderEditor::checkToolButtons(LimeReport::BaseDesignIntf::BorderSide side, bool check)
|
||||||
void lrbordereditor::on_pushButton_clicked()
|
|
||||||
{
|
{
|
||||||
QColorDialog cd(this);
|
switch(side)
|
||||||
if(cd.exec() == QDialog::Rejected)return;
|
{
|
||||||
QPen pen = ui->borderFrame->pen();
|
case BaseDesignIntf::BorderSide::TopLine:
|
||||||
pen.setColor(cd.selectedColor().name());
|
ui->topLine->setChecked(check);
|
||||||
border_color = pen.color().name();
|
break;
|
||||||
|
case BaseDesignIntf::BorderSide::BottomLine:
|
||||||
|
ui->bottomLine->setChecked(check);
|
||||||
|
break;
|
||||||
|
case BaseDesignIntf::BorderSide::LeftLine:
|
||||||
|
ui->leftLine->setChecked(check);
|
||||||
|
break;
|
||||||
|
case BaseDesignIntf::BorderSide::RightLine:
|
||||||
|
ui->rightLine->setChecked(check);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ui->pushButton->setStyleSheet(QString("#pushButton{background-color:%1;}").arg(border_color));
|
void BorderEditor::on_topLine_clicked(bool checked){
|
||||||
ui->borderFrame->setPen(pen);
|
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::TopLine, checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BorderEditor::on_bottomLine_clicked(bool checked){
|
||||||
|
emit ui->borderFrame->borderSideClicked(BaseDesignIntf::BorderSide::BottomLine, checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BorderEditor::on_leftLine_clicked(bool checked){
|
||||||
|
emit ui->borderFrame->borderSideClicked(BaseDesignIntf::BorderSide::LeftLine, checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BorderEditor::on_rightLine_clicked(bool checked){
|
||||||
|
emit ui->borderFrame->borderSideClicked(BaseDesignIntf::BorderSide::RightLine, checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void lrbordereditor::on_toolButton_4_clicked()
|
void BorderEditor::on_allLines_clicked()
|
||||||
{
|
{
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::TopLine, true);
|
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::TopLine, true);
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::BottomLine, true);
|
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::BottomLine, true);
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::LeftLine, true);
|
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::LeftLine, true);
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::RightLine, true);
|
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::RightLine, true);
|
||||||
QPen pen = ui->borderFrame->pen();
|
|
||||||
|
|
||||||
ui->borderFrame->setPen(pen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BorderEditor::on_noLines_clicked()
|
||||||
void lrbordereditor::on_noLines_clicked()
|
|
||||||
{
|
{
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::TopLine, false);
|
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::TopLine, false);
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::BottomLine, false);
|
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::BottomLine, false);
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::LeftLine, false);
|
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::LeftLine, false);
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::RightLine, false);
|
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::RightLine, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void lrbordereditor::on_topLine_clicked()
|
void BorderEditor::on_selectColor_clicked()
|
||||||
{
|
{
|
||||||
|
QColorDialog cd(this);
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::TopLine,ui->topLine->isChecked());
|
if(cd.exec() == QDialog::Rejected) return;
|
||||||
|
QPen pen = ui->borderFrame->pen();
|
||||||
}
|
pen.setColor(cd.selectedColor().name());
|
||||||
|
m_borderColor = pen.color().name();
|
||||||
void lrbordereditor::checkToolButtons(int side, bool check)
|
ui->colorIndicator->setStyleSheet(QString("background-color:%1;").arg(m_borderColor));
|
||||||
{
|
ui->borderFrame->setPen(pen);
|
||||||
|
|
||||||
switch(side)
|
|
||||||
{
|
|
||||||
case LimeReport::BaseDesignIntf::BorderSide::TopLine:
|
|
||||||
{
|
|
||||||
ui->topLine->setChecked(check);
|
|
||||||
}break;
|
|
||||||
case LimeReport::BaseDesignIntf::BorderSide::BottomLine:
|
|
||||||
{
|
|
||||||
ui->bottomLine->setChecked(check);
|
|
||||||
}break;
|
|
||||||
case LimeReport::BaseDesignIntf::BorderSide::LeftLine:
|
|
||||||
{
|
|
||||||
ui->leftLine->setChecked(check);
|
|
||||||
}break;
|
|
||||||
case LimeReport::BaseDesignIntf::BorderSide::RightLine:
|
|
||||||
{
|
|
||||||
ui->rightLine->setChecked(check);
|
|
||||||
}break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void lrbordereditor::on_bottomLine_clicked()
|
|
||||||
{
|
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::BottomLine,ui->bottomLine->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void lrbordereditor::on_leftLine_clicked()
|
|
||||||
{
|
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::LeftLine,ui->leftLine->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void lrbordereditor::on_toolButton_3_clicked()
|
|
||||||
{
|
|
||||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::RightLine,ui->rightLine->isChecked());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace LimeReport
|
||||||
|
@ -3,54 +3,45 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "lrbasedesignintf.h"
|
#include "lrbasedesignintf.h"
|
||||||
|
namespace LimeReport{
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class lrbordereditor;
|
class BorderEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
class lrbordereditor : public QDialog
|
class BorderEditor : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit lrbordereditor(QWidget *parent = nullptr);
|
explicit BorderEditor(QWidget *parent = nullptr);
|
||||||
void loadItem(LimeReport::BaseDesignIntf *i);
|
void loadItem(LimeReport::BaseDesignIntf *item);
|
||||||
LimeReport::BaseDesignIntf::BorderLines borderSides();
|
LimeReport::BaseDesignIntf::BorderLines borderSides();
|
||||||
LimeReport::BaseDesignIntf::BorderStyle border_style();
|
LimeReport::BaseDesignIntf::BorderStyle borderStyle();
|
||||||
QString borderColor();
|
QString borderColor();
|
||||||
double border_width();
|
double borderWidth();
|
||||||
|
~BorderEditor();
|
||||||
|
|
||||||
~lrbordereditor();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_listWidget_currentRowChanged(int currentRow);
|
void on_listWidget_currentRowChanged(int currentRow);
|
||||||
|
|
||||||
void on_comboBox_currentTextChanged(const QString &arg1);
|
void on_comboBox_currentTextChanged(const QString &arg1);
|
||||||
|
|
||||||
void on_pushButton_clicked();
|
|
||||||
|
|
||||||
void on_toolButton_4_clicked();
|
|
||||||
|
|
||||||
void on_noLines_clicked();
|
void on_noLines_clicked();
|
||||||
|
void on_topLine_clicked(bool checked);
|
||||||
void on_topLine_clicked();
|
void on_bottomLine_clicked(bool checked);
|
||||||
void checkToolButtons(int side, bool check);
|
void on_leftLine_clicked(bool checked);
|
||||||
|
void on_rightLine_clicked(bool checked);
|
||||||
void on_bottomLine_clicked();
|
void on_allLines_clicked();
|
||||||
|
void checkToolButtons(LimeReport::BaseDesignIntf::BorderSide side, bool check);
|
||||||
void on_leftLine_clicked();
|
void on_selectColor_clicked();
|
||||||
|
|
||||||
void on_toolButton_3_clicked();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::lrbordereditor *ui;
|
Ui::BorderEditor *ui;
|
||||||
LimeReport::BaseDesignIntf *item;
|
LimeReport::BaseDesignIntf *m_item;
|
||||||
QString border_color;
|
QString m_borderColor;
|
||||||
int borderStyle = 1;
|
int m_borderStyle;
|
||||||
double borderWidth = 1;
|
double m_borderWidth;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace LimeReport
|
||||||
|
|
||||||
#endif // LRBORDEREDITOR_H
|
#endif // LRBORDEREDITOR_H
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>lrbordereditor</class>
|
<class>LimeReport::BorderEditor</class>
|
||||||
<widget class="QDialog" name="lrbordereditor">
|
<widget class="QDialog" name="LimeReport::BorderEditor">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>381</width>
|
<width>381</width>
|
||||||
<height>311</height>
|
<height>352</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -46,7 +46,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButton_4">
|
<widget class="QToolButton" name="allLines">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Outline</string>
|
<string>Outline</string>
|
||||||
</property>
|
</property>
|
||||||
@ -119,7 +119,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="BorderFrameEditor" name="borderFrame" native="true"/>
|
<widget class="LimeReport::BorderFrameEditor" name="borderFrame" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
@ -319,15 +319,35 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<property name="styleSheet">
|
<item>
|
||||||
<string notr="true">#pushButton{background-color: black;}</string>
|
<widget class="QWidget" name="colorIndicator" native="true">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="baseSize">
|
||||||
<string>Select...</string>
|
<size>
|
||||||
|
<width>10</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(0, 0, 0);</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="selectColor">
|
||||||
|
<property name="text">
|
||||||
|
<string>Select</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -342,7 +362,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>BorderFrameEditor</class>
|
<class>LimeReport::BorderFrameEditor</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header>borderframeeditor.h</header>
|
<header>borderframeeditor.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
@ -356,32 +376,32 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>accepted()</signal>
|
<signal>accepted()</signal>
|
||||||
<receiver>lrbordereditor</receiver>
|
<receiver>LimeReport::BorderEditor</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>253</x>
|
<x>119</x>
|
||||||
<y>255</y>
|
<y>322</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>219</x>
|
<x>377</x>
|
||||||
<y>275</y>
|
<y>309</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>rejected()</signal>
|
<signal>rejected()</signal>
|
||||||
<receiver>lrbordereditor</receiver>
|
<receiver>LimeReport::BorderEditor</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>316</x>
|
<x>48</x>
|
||||||
<y>258</y>
|
<y>334</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>345</x>
|
<x>66</x>
|
||||||
<y>277</y>
|
<y>348</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
181
limereport/items/lrborderframeeditor.cpp
Normal file
181
limereport/items/lrborderframeeditor.cpp
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
#include "lrborderframeeditor.h"
|
||||||
|
#include "ui_lrborderframeeditor.h"
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QGraphicsLineItem>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include "lrbasedesignintf.h"
|
||||||
|
#include "lrbordereditor.h"
|
||||||
|
|
||||||
|
namespace LimeReport{
|
||||||
|
|
||||||
|
BorderFrameEditor::BorderFrameEditor(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
, ui(new Ui::BorderFrameEditor)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
scene = new QGraphicsScene(ui->graphicsView);
|
||||||
|
|
||||||
|
QRect vRect = rect();
|
||||||
|
|
||||||
|
//Draw corder lines
|
||||||
|
//topLeft
|
||||||
|
scene->addLine(10, 5, 10, 10, QPen(Qt::gray));
|
||||||
|
scene->addLine(5, 10, 10, 10, QPen(Qt::gray));
|
||||||
|
//bottomLeft
|
||||||
|
scene->addLine(10,vRect.bottom() -5, 10, vRect.bottom()-10, QPen(Qt::gray));
|
||||||
|
scene->addLine(5,vRect.bottom()-10, 10, vRect.bottom()-10, QPen(Qt::gray));
|
||||||
|
//bottomRight
|
||||||
|
scene->addLine(vRect.right() - 10, vRect.bottom() - 5, vRect.right()- 10, vRect.bottom() - 10, QPen(Qt::gray));
|
||||||
|
scene->addLine(vRect.right() - 5, vRect.bottom() - 10, vRect.right() - 10, vRect.bottom() - 10, QPen(Qt::gray));
|
||||||
|
//topRight
|
||||||
|
scene->addLine(vRect.width() - 10, 5, vRect.width() - 10, 10, QPen(Qt::gray));
|
||||||
|
scene->addLine(vRect.width() - 5, 10, vRect.width() - 10, 10, QPen(Qt::gray));
|
||||||
|
scene->setSceneRect(vRect);
|
||||||
|
ui->graphicsView->setScene(scene);
|
||||||
|
QGraphicsSimpleTextItem * io = new QGraphicsSimpleTextItem();
|
||||||
|
io->setAcceptedMouseButtons(Qt::LeftButton);
|
||||||
|
io->setPos(scene->sceneRect().center());
|
||||||
|
io->setText(tr("Text"));
|
||||||
|
scene->addItem(io);
|
||||||
|
|
||||||
|
QRectF bR = io->sceneBoundingRect();
|
||||||
|
io->setPos( scene->sceneRect().center().x() - bR.width()/2, scene->sceneRect().center().y() - bR.height()/2 );
|
||||||
|
connect(
|
||||||
|
this, SIGNAL(borderSideClicked(LimeReport::BaseDesignIntf::BorderSide, bool)),
|
||||||
|
this, SLOT(slotBorderSideClicked(LimeReport::BaseDesignIntf::BorderSide, bool))
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BorderFrameEditor::~BorderFrameEditor()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BorderFrameEditor::setPen(QPen pen)
|
||||||
|
{
|
||||||
|
m_pen = pen;
|
||||||
|
updateBorders();
|
||||||
|
}
|
||||||
|
|
||||||
|
QPen BorderFrameEditor::pen()
|
||||||
|
{
|
||||||
|
return m_pen;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BorderFrameEditor::setAllLines()
|
||||||
|
{
|
||||||
|
if (!topLine)
|
||||||
|
topLine = createSideLine(LimeReport::BaseDesignIntf::BorderSide::TopLine);
|
||||||
|
if (!leftLine)
|
||||||
|
leftLine = createSideLine(LimeReport::BaseDesignIntf::BorderSide::LeftLine);
|
||||||
|
if (!bottomLine)
|
||||||
|
bottomLine = createSideLine(LimeReport::BaseDesignIntf::BorderSide::BottomLine);
|
||||||
|
if (!rightLine)
|
||||||
|
rightLine = createSideLine(LimeReport::BaseDesignIntf::BorderSide::RightLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BorderFrameEditor::unSetAllLines()
|
||||||
|
{
|
||||||
|
if (topLine){
|
||||||
|
scene->removeItem(topLine);
|
||||||
|
topLine = NULL;
|
||||||
|
}
|
||||||
|
if (leftLine){
|
||||||
|
scene->removeItem(leftLine);
|
||||||
|
leftLine = NULL;
|
||||||
|
}
|
||||||
|
if (bottomLine){
|
||||||
|
scene->removeItem(bottomLine);
|
||||||
|
bottomLine = NULL;
|
||||||
|
}
|
||||||
|
if (rightLine){
|
||||||
|
scene->removeItem(rightLine);
|
||||||
|
rightLine = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void BorderFrameEditor::mousePressEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->x() >= 10 && event->y() <30)
|
||||||
|
emit borderSideClicked(BaseDesignIntf::BorderSide::TopLine, !topLine);
|
||||||
|
|
||||||
|
if ((event->x() >= 10 && event->x() < 30) && (event->y() > 10))
|
||||||
|
emit borderSideClicked(BaseDesignIntf::BorderSide::LeftLine, !leftLine);
|
||||||
|
|
||||||
|
if (event->x() >= 10 && (event->y() >80 && event->y() < rect().bottom()))
|
||||||
|
emit borderSideClicked(BaseDesignIntf::BorderSide::BottomLine, !bottomLine);
|
||||||
|
|
||||||
|
if ((event->x() >= 130 && event->x() < rect().width()) && event->y() > 10)
|
||||||
|
emit borderSideClicked(BaseDesignIntf::BorderSide::RightLine, !rightLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BorderFrameEditor::slotBorderSideClicked(BaseDesignIntf::BorderSide side, bool show)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch(side){
|
||||||
|
|
||||||
|
case BaseDesignIntf::BorderSide::TopLine:
|
||||||
|
if (show){
|
||||||
|
if (!topLine) topLine = createSideLine(side);
|
||||||
|
} else {
|
||||||
|
if (topLine) scene->removeItem(topLine);
|
||||||
|
topLine = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BaseDesignIntf::LeftLine:
|
||||||
|
if (show){
|
||||||
|
if (!leftLine) leftLine = createSideLine(side);
|
||||||
|
} else {
|
||||||
|
if (leftLine) scene->removeItem(leftLine);
|
||||||
|
leftLine = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BaseDesignIntf::BottomLine:
|
||||||
|
if (show){
|
||||||
|
if (!bottomLine) bottomLine = createSideLine(side);
|
||||||
|
} else {
|
||||||
|
if (bottomLine) scene->removeItem(bottomLine);
|
||||||
|
bottomLine = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BaseDesignIntf::RightLine:
|
||||||
|
if (show){
|
||||||
|
if (!rightLine) rightLine = createSideLine(side);
|
||||||
|
} else {
|
||||||
|
if(rightLine) scene->removeItem(rightLine);
|
||||||
|
rightLine = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
updateBorders();
|
||||||
|
}
|
||||||
|
|
||||||
|
QGraphicsLineItem *BorderFrameEditor::createSideLine(LimeReport::BaseDesignIntf::BorderSide side)
|
||||||
|
{
|
||||||
|
switch(side){
|
||||||
|
case BaseDesignIntf::BorderSide::TopLine:
|
||||||
|
return scene->addLine(QLineF(10, 10, rect().width() - 10, 10), m_pen);
|
||||||
|
case BaseDesignIntf::BorderSide::LeftLine:
|
||||||
|
return scene->addLine(QLineF(10, 10, 10, rect().height() - 10), m_pen);
|
||||||
|
case BaseDesignIntf::BorderSide::RightLine:
|
||||||
|
return scene->addLine(QLineF(rect().width() - 10, 10 ,rect().width() - 10, rect().height() - 10), m_pen);
|
||||||
|
case BaseDesignIntf::BorderSide::BottomLine:
|
||||||
|
return scene->addLine(QLineF(10, rect().bottom() - 10, rect().width() - 10, rect().bottom() - 10), m_pen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BorderFrameEditor::updateBorders()
|
||||||
|
{
|
||||||
|
if (topLine) topLine->setPen(m_pen);
|
||||||
|
if (leftLine) leftLine->setPen(m_pen);
|
||||||
|
if (bottomLine) bottomLine->setPen(m_pen);
|
||||||
|
if (rightLine) rightLine->setPen(m_pen);
|
||||||
|
}
|
||||||
|
|
||||||
|
} //namespace LimeReport
|
@ -5,9 +5,9 @@
|
|||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QGraphicsLineItem>
|
#include <QGraphicsLineItem>
|
||||||
#include "lrbasedesignintf.h"
|
#include "lrbasedesignintf.h"
|
||||||
QT_BEGIN_NAMESPACE
|
namespace LimeReport{
|
||||||
|
|
||||||
namespace Ui { class BorderFrameEditor; }
|
namespace Ui { class BorderFrameEditor; }
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
class BorderFrameEditor : public QWidget
|
class BorderFrameEditor : public QWidget
|
||||||
{
|
{
|
||||||
@ -23,10 +23,13 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
signals:
|
signals:
|
||||||
void borderSideClicked(int side,bool show);
|
void borderSideClicked(LimeReport::BaseDesignIntf::BorderSide side, bool show);
|
||||||
private slots:
|
private slots:
|
||||||
void SlotBorderSideClicked(int side, bool show);
|
void slotBorderSideClicked(LimeReport::BaseDesignIntf::BorderSide side, bool show);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QGraphicsLineItem *createSideLine(LimeReport::BaseDesignIntf::BorderSide side);
|
||||||
|
void updateBorders();
|
||||||
private:
|
private:
|
||||||
Ui::BorderFrameEditor *ui;
|
Ui::BorderFrameEditor *ui;
|
||||||
QGraphicsScene *scene;
|
QGraphicsScene *scene;
|
||||||
@ -35,8 +38,9 @@ private:
|
|||||||
,*leftLine = NULL
|
,*leftLine = NULL
|
||||||
,*rightLine = NULL;
|
,*rightLine = NULL;
|
||||||
QPen m_pen;
|
QPen m_pen;
|
||||||
void updateBorders();
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
} // namespace LimeReport
|
||||||
#endif // WIDGET
|
#endif // WIDGET
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>BorderFrameEditor</class>
|
<class>LimeReport::BorderFrameEditor</class>
|
||||||
<widget class="QWidget" name="BorderFrameEditor">
|
<widget class="QWidget" name="LimeReport::BorderFrameEditor">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
@ -1,9 +1,11 @@
|
|||||||
#include "lrpageeditor.h"
|
#include "lrpageeditor.h"
|
||||||
#include "ui_lrpageeditor.h"
|
#include "ui_lrpageeditor.h"
|
||||||
#include "lrpagedesignintf.h"
|
#include "lrpagedesignintf.h"
|
||||||
|
#include "lrpageitemdesignintf.h"
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QPageSize>
|
#include <QPageSize>
|
||||||
lrpageeditor::lrpageeditor(QWidget *parent, LimeReport::PageItemDesignIntf *page) :
|
|
||||||
|
PageEditor::PageEditor(QWidget *parent, LimeReport::PageItemDesignIntf *page) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::lrpageeditor)
|
ui(new Ui::lrpageeditor)
|
||||||
{
|
{
|
||||||
@ -16,8 +18,8 @@ lrpageeditor::lrpageeditor(QWidget *parent, LimeReport::PageItemDesignIntf *page
|
|||||||
ui->format->addItem(pageSizes.key(i));
|
ui->format->addItem(pageSizes.key(i));
|
||||||
}
|
}
|
||||||
ui->format->setCurrentIndex(m_page->pageSize());
|
ui->format->setCurrentIndex(m_page->pageSize());
|
||||||
ui->width->setValue(m_page->width() / LimeReport::Const::mmFACTOR);
|
ui->width->setValue(m_page->width() / m_page->unitFactor());
|
||||||
ui->height->setValue(m_page->height() / LimeReport::Const::mmFACTOR);
|
ui->height->setValue(m_page->height() / m_page->unitFactor());
|
||||||
ui->portrait->setChecked(m_page->pageOrientation() == LimeReport::PageItemDesignIntf::Portrait);
|
ui->portrait->setChecked(m_page->pageOrientation() == LimeReport::PageItemDesignIntf::Portrait);
|
||||||
ui->landscape->setChecked(m_page->pageOrientation() == LimeReport::PageItemDesignIntf::Landscape);
|
ui->landscape->setChecked(m_page->pageOrientation() == LimeReport::PageItemDesignIntf::Landscape);
|
||||||
//Margins
|
//Margins
|
||||||
@ -33,18 +35,17 @@ lrpageeditor::lrpageeditor(QWidget *parent, LimeReport::PageItemDesignIntf *page
|
|||||||
ui->fullPage->setChecked(m_page->fullPage());
|
ui->fullPage->setChecked(m_page->fullPage());
|
||||||
}
|
}
|
||||||
|
|
||||||
lrpageeditor::~lrpageeditor()
|
PageEditor::~PageEditor()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lrpageeditor::applyChanges()
|
void PageEditor::applyChanges()
|
||||||
{
|
{
|
||||||
m_page->setPageSize(static_cast<LimeReport::PageItemDesignIntf::PageSize>(ui->format->currentIndex()));
|
m_page->setPageSize(static_cast<LimeReport::PageItemDesignIntf::PageSize>(ui->format->currentIndex()));
|
||||||
m_page->setWidth(ui->width->value() * LimeReport::Const::mmFACTOR);
|
m_page->setWidth(ui->width->value() * LimeReport::Const::mmFACTOR);
|
||||||
m_page->setHeight(ui->height->value() * LimeReport::Const::mmFACTOR);
|
m_page->setHeight(ui->height->value() * LimeReport::Const::mmFACTOR);
|
||||||
m_page->setPageOrientation(ui->portrait->isChecked()? LimeReport::PageItemDesignIntf::Portrait : LimeReport::PageItemDesignIntf::Landscape);
|
m_page->setPageOrientation(ui->portrait->isChecked()? LimeReport::PageItemDesignIntf::Portrait : LimeReport::PageItemDesignIntf::Landscape);
|
||||||
|
|
||||||
m_page->setTopMargin(ui->marginTop->value());
|
m_page->setTopMargin(ui->marginTop->value());
|
||||||
m_page->setBottomMargin(ui->marginBottom->value());
|
m_page->setBottomMargin(ui->marginBottom->value());
|
||||||
m_page->setRightMargin(ui->marginRight->value());
|
m_page->setRightMargin(ui->marginRight->value());
|
||||||
@ -52,16 +53,11 @@ void lrpageeditor::applyChanges()
|
|||||||
m_page->setDropPrinterMargins(ui->dropPrinterMargins->isChecked());
|
m_page->setDropPrinterMargins(ui->dropPrinterMargins->isChecked());
|
||||||
ui->endlessHeight->setChecked(ui->endlessHeight->isChecked());
|
ui->endlessHeight->setChecked(ui->endlessHeight->isChecked());
|
||||||
m_page->setExtendedHeight(ui->extendedHeight->value());
|
m_page->setExtendedHeight(ui->extendedHeight->value());
|
||||||
|
ui->width->setValue(m_page->getItemWidth());
|
||||||
|
ui->height->setValue(m_page->getItemHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
void lrpageeditor::on_buttonBox_accepted()
|
QSizeF PageEditor::getRectByPageSize(const LimeReport::PageItemDesignIntf::PageSize& size)
|
||||||
{
|
|
||||||
applyChanges();
|
|
||||||
accept();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QSizeF lrpageeditor::getRectByPageSize(const LimeReport::PageItemDesignIntf::PageSize& size)
|
|
||||||
{
|
{
|
||||||
if (size != LimeReport::PageItemDesignIntf::Custom) {
|
if (size != LimeReport::PageItemDesignIntf::Custom) {
|
||||||
QPrinter printer;
|
QPrinter printer;
|
||||||
@ -69,36 +65,43 @@ QSizeF lrpageeditor::getRectByPageSize(const LimeReport::PageItemDesignIntf::Pag
|
|||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 1))
|
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 1))
|
||||||
printer.setOrientation(ui->portrait->isChecked() ? QPrinter::Portrait : QPrinter::Landscape);
|
printer.setOrientation(ui->portrait->isChecked() ? QPrinter::Portrait : QPrinter::Landscape);
|
||||||
printer.setPaperSize((QPrinter::PageSize)size);
|
printer.setPaperSize((QPrinter::PageSize)size);
|
||||||
return QSizeF(printer.paperSize(QPrinter::Millimeter).width() * 10,
|
return QSizeF(printer.paperSize(QPrinter::Millimeter).width() * m_page->unitFactor(),
|
||||||
printer.paperSize(QPrinter::Millimeter).height() * 10);
|
printer.paperSize(QPrinter::Millimeter).height() * m_page->unitFactor());
|
||||||
|
|
||||||
#else
|
#else
|
||||||
QPageSize pageSize = QPageSize((QPageSize::PageSizeId)size);
|
printer.setPageOrientation((QPageLayout::Orientation)m_page->pageOrientation());
|
||||||
qreal width = pageSize.size(QPageSize::Millimeter).width() * 10;
|
printer.setPageSize(QPageSize((QPageSize::PageSizeId)size));
|
||||||
qreal height = pageSize.size(QPageSize::Millimeter).height() * 10;
|
return QSizeF(printer.pageLayout().pageSize().size(QPageSize::Millimeter).width() * m_page->unitFactor(),
|
||||||
return QSizeF(pageOrientation() == Portrait ? width : height,
|
printer.pageLayout().pageSize().size(QPageSize::Millimeter).height() * m_page->unitFactor());
|
||||||
pageOrientation() == Portrait ? height : width);
|
|
||||||
|
|
||||||
// printer.setPageOrientation((QPageLayout::Orientation)pageOrientation());
|
|
||||||
// printer.setPageSize(QPageSize((QPageSize::PageSizeId)size));
|
|
||||||
// return QSizeF(printer.pageLayout().pageSize().size(QPageSize::Millimeter).width() * 10,
|
|
||||||
// printer.pageLayout().pageSize().size(QPageSize::Millimeter).height() * 10);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
} else {
|
||||||
|
return QSizeF(m_page->getItemWidth(), m_page->getItemHeight());
|
||||||
else {
|
|
||||||
return QSizeF(width(),height());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void lrpageeditor::on_format_currentIndexChanged(int index)
|
void PageEditor::on_format_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
QPageSize ps = *new QPageSize();
|
QPageSize ps = *new QPageSize();
|
||||||
if(ui->format->currentText() != "Custom")
|
if(ui->format->currentText() != "Custom")
|
||||||
{
|
{
|
||||||
QSizeF pageSize = getRectByPageSize(static_cast<LimeReport::PageItemDesignIntf::PageSize>(index));
|
QSizeF pageSize = getRectByPageSize(static_cast<LimeReport::PageItemDesignIntf::PageSize>(index));
|
||||||
ui->width->setValue(pageSize.width()/10);
|
ui->width->setValue(pageSize.width() / m_page->unitFactor());
|
||||||
ui->height->setValue(pageSize.height()/10);
|
ui->height->setValue(pageSize.height() / m_page->unitFactor());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PageEditor::on_buttonBox_clicked(QAbstractButton *button)
|
||||||
|
{
|
||||||
|
switch(ui->buttonBox->buttonRole(button)){
|
||||||
|
case QDialogButtonBox::ApplyRole:
|
||||||
|
applyChanges();
|
||||||
|
break;
|
||||||
|
case QDialogButtonBox::AcceptRole:
|
||||||
|
applyChanges();
|
||||||
|
accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -8,17 +8,18 @@ namespace Ui {
|
|||||||
class lrpageeditor;
|
class lrpageeditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
class lrpageeditor : public QDialog
|
class PageEditor : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit lrpageeditor(QWidget *parent = nullptr,LimeReport::PageItemDesignIntf *page = nullptr);
|
explicit PageEditor(QWidget *parent = nullptr,LimeReport::PageItemDesignIntf *page = nullptr);
|
||||||
~lrpageeditor();
|
~PageEditor();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_buttonBox_accepted();
|
// void on_buttonBox_accepted();
|
||||||
void on_format_currentIndexChanged(int index);
|
void on_format_currentIndexChanged(int index);
|
||||||
|
void on_buttonBox_clicked(QAbstractButton *button);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::lrpageeditor *ui;
|
Ui::lrpageeditor *ui;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>306</width>
|
<width>306</width>
|
||||||
<height>322</height>
|
<height>350</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -297,7 +297,7 @@
|
|||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Apply|QDialogButtonBox::Close|QDialogButtonBox::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -312,8 +312,8 @@
|
|||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>325</x>
|
<x>296</x>
|
||||||
<y>312</y>
|
<y>340</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>286</x>
|
<x>286</x>
|
||||||
@ -328,12 +328,12 @@
|
|||||||
<slot>setEnabled(bool)</slot>
|
<slot>setEnabled(bool)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>60</x>
|
<x>72</x>
|
||||||
<y>50</y>
|
<y>81</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>130</x>
|
<x>131</x>
|
||||||
<y>85</y>
|
<y>134</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
@ -80,7 +80,7 @@ SOURCES += \
|
|||||||
$$REPORT_PATH/lraxisdata.cpp \
|
$$REPORT_PATH/lraxisdata.cpp \
|
||||||
$$REPORT_PATH/lrpreparedpages.cpp \
|
$$REPORT_PATH/lrpreparedpages.cpp \
|
||||||
$$REPORT_PATH/items/lrpageeditor.cpp \
|
$$REPORT_PATH/items/lrpageeditor.cpp \
|
||||||
$$REPORT_PATH/items/borderframeeditor.cpp \
|
$$REPORT_PATH/items/lrborderframeeditor.cpp \
|
||||||
$$REPORT_PATH/items/lrbordereditor.cpp
|
$$REPORT_PATH/items/lrbordereditor.cpp
|
||||||
|
|
||||||
CONFIG(staticlib) {
|
CONFIG(staticlib) {
|
||||||
@ -181,7 +181,7 @@ HEADERS += \
|
|||||||
$$REPORT_PATH/lraxisdata.h \
|
$$REPORT_PATH/lraxisdata.h \
|
||||||
$$REPORT_PATH/lrpreparedpagesintf.h \
|
$$REPORT_PATH/lrpreparedpagesintf.h \
|
||||||
$$REPORT_PATH/items/lrpageeditor.h \
|
$$REPORT_PATH/items/lrpageeditor.h \
|
||||||
$$REPORT_PATH/items/borderframeeditor.h \
|
$$REPORT_PATH/items/lrborderframeeditor.h \
|
||||||
$$REPORT_PATH/items/lrbordereditor.h
|
$$REPORT_PATH/items/lrbordereditor.h
|
||||||
|
|
||||||
CONFIG(staticlib) {
|
CONFIG(staticlib) {
|
||||||
@ -207,7 +207,7 @@ FORMS += \
|
|||||||
$$REPORT_PATH/items/lrimageitemeditor.ui \
|
$$REPORT_PATH/items/lrimageitemeditor.ui \
|
||||||
$$REPORT_PATH/scripteditor/lrscripteditor.ui \
|
$$REPORT_PATH/scripteditor/lrscripteditor.ui \
|
||||||
$$REPORT_PATH/items/lrpageeditor.ui \
|
$$REPORT_PATH/items/lrpageeditor.ui \
|
||||||
$$REPORT_PATH/items/borderframeeditor.ui \
|
$$REPORT_PATH/items/lrborderframeeditor.ui \
|
||||||
$$REPORT_PATH/items/lrbordereditor.ui
|
$$REPORT_PATH/items/lrbordereditor.ui
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
|
@ -431,7 +431,7 @@ void BaseDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *o
|
|||||||
setupPainter(ppainter);
|
setupPainter(ppainter);
|
||||||
drawBorder(ppainter, rect());
|
drawBorder(ppainter, rect());
|
||||||
if(m_shadow)
|
if(m_shadow)
|
||||||
drawShadow(ppainter, rect());
|
drawShadow(ppainter, rect(), 6);
|
||||||
// if (m_joinMarkerOn) { drawMarker(ppainter, Const::JOIN_COLOR);}
|
// if (m_joinMarkerOn) { drawMarker(ppainter, Const::JOIN_COLOR);}
|
||||||
// if (isSelected() && !m_joinMarkerOn) {drawMarker(ppainter, Const::SELECTION_COLOR);}
|
// if (isSelected() && !m_joinMarkerOn) {drawMarker(ppainter, Const::SELECTION_COLOR);}
|
||||||
drawResizeZone(ppainter);
|
drawResizeZone(ppainter);
|
||||||
@ -1145,10 +1145,9 @@ void BaseDesignIntf::drawBorder(QPainter *painter, QRectF rect) const
|
|||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDesignIntf::drawShadow(QPainter *painter, QRectF rect) const
|
void BaseDesignIntf::drawShadow(QPainter *painter, QRectF rect, qreal shadowSize) const
|
||||||
{
|
{
|
||||||
|
qreal shWidth = shadowSize;
|
||||||
qreal shWidth = rect.width()/100;
|
|
||||||
QRectF rshadow(rect.topRight() + QPointF(0, shWidth),
|
QRectF rshadow(rect.topRight() + QPointF(0, shWidth),
|
||||||
rect.bottomRight() + QPointF(shWidth, 0));
|
rect.bottomRight() + QPointF(shWidth, 0));
|
||||||
QLinearGradient rgrad(rshadow.topLeft(), rshadow.topRight());
|
QLinearGradient rgrad(rshadow.topLeft(), rshadow.topRight());
|
||||||
@ -1167,8 +1166,6 @@ void BaseDesignIntf::drawShadow(QPainter *painter, QRectF rect) const
|
|||||||
cgrad.setColorAt(0.0, QColor(0,0,0,255));
|
cgrad.setColorAt(0.0, QColor(0,0,0,255));
|
||||||
cgrad.setColorAt(1.0, QColor(0,0,0,0));
|
cgrad.setColorAt(1.0, QColor(0,0,0,0));
|
||||||
painter->fillRect(cshadow, QBrush(cgrad));
|
painter->fillRect(cshadow, QBrush(cgrad));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDesignIntf::setGeometry(QRectF rect)
|
void BaseDesignIntf::setGeometry(QRectF rect)
|
||||||
@ -1486,7 +1483,7 @@ void BaseDesignIntf::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
QAction* noBordersAction = menu.addAction(QIcon(":/report/images/noLines"), tr("No borders"));
|
QAction* noBordersAction = menu.addAction(QIcon(":/report/images/noLines"), tr("No borders"));
|
||||||
QAction* allBordersAction = menu.addAction(QIcon(":/report/images/allLines"), tr("All borders"));
|
QAction* allBordersAction = menu.addAction(QIcon(":/report/images/allLines"), tr("All borders"));
|
||||||
QAction* editBorderAction = menu.addAction(QIcon(":/report/images/allLines"), tr("Edit borders..."));
|
QAction* editBorderAction = menu.addAction(QIcon(":/report/images/borderEditor"), tr("Edit borders..."));
|
||||||
preparePopUpMenu(menu);
|
preparePopUpMenu(menu);
|
||||||
QAction* a = menu.exec(event->screenPos());
|
QAction* a = menu.exec(event->screenPos());
|
||||||
if (a){
|
if (a){
|
||||||
@ -1509,13 +1506,10 @@ void BaseDesignIntf::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||||||
page->setBorders(BaseDesignIntf::AllLines);
|
page->setBorders(BaseDesignIntf::AllLines);
|
||||||
if (a == editBorderAction)
|
if (a == editBorderAction)
|
||||||
{
|
{
|
||||||
lrbordereditor be;
|
BorderEditor be;
|
||||||
be.loadItem(this);
|
be.loadItem(this);
|
||||||
if (be.exec() == QDialog::Rejected) return;
|
if (be.exec() == QDialog::Rejected) return;
|
||||||
setBorderLinesFlags(be.borderSides());
|
page->setBordersExt(be.borderSides(), be.borderWidth(), (LimeReport::BaseDesignIntf::BorderStyle)be.borderStyle(), be.borderColor());
|
||||||
setBorderLineSize(be.border_width());
|
|
||||||
setBorderStyle((LimeReport::BaseDesignIntf::BorderStyle)be.border_style());
|
|
||||||
setBorderColor(be.borderColor());
|
|
||||||
}
|
}
|
||||||
if (a == createHLayout)
|
if (a == createHLayout)
|
||||||
page->addHLayout();
|
page->addHLayout();
|
||||||
|
@ -389,7 +389,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
void drawBorder(QPainter* painter, QRectF rect) const;
|
void drawBorder(QPainter* painter, QRectF rect) const;
|
||||||
void drawShadow(QPainter* painter, QRectF rect) const;
|
void drawShadow(QPainter* painter, QRectF rect, qreal shadowSize) const;
|
||||||
void drawDesignModeBorder(QPainter* painter, QRectF rect) const;
|
void drawDesignModeBorder(QPainter* painter, QRectF rect) const;
|
||||||
void drawRenderModeBorder(QPainter *painter, QRectF rect) const;
|
void drawRenderModeBorder(QPainter *painter, QRectF rect) const;
|
||||||
void drawResizeZone(QPainter*);
|
void drawResizeZone(QPainter*);
|
||||||
|
@ -1826,6 +1826,20 @@ void PageDesignIntf::setBorders(const BaseDesignIntf::BorderLines& border)
|
|||||||
changeSelectedGroupProperty("borders", (int)border);
|
changeSelectedGroupProperty("borders", (int)border);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PageDesignIntf::setBordersExt(
|
||||||
|
const BaseDesignIntf::BorderLines& border,
|
||||||
|
const double borderWidth,
|
||||||
|
const LimeReport::BaseDesignIntf::BorderStyle style,
|
||||||
|
const QString color
|
||||||
|
|
||||||
|
)
|
||||||
|
{
|
||||||
|
changeSelectedGroupProperty("borders", (int)border);
|
||||||
|
changeSelectedGroupProperty("borderLineSize", borderWidth);
|
||||||
|
changeSelectedGroupProperty("borderStyle", style);
|
||||||
|
changeSelectedGroupProperty("borderColor", color);
|
||||||
|
}
|
||||||
|
|
||||||
void PageDesignIntf::lockSelectedItems()
|
void PageDesignIntf::lockSelectedItems()
|
||||||
{
|
{
|
||||||
foreach(QGraphicsItem* graphicItem, selectedItems()){
|
foreach(QGraphicsItem* graphicItem, selectedItems()){
|
||||||
|
@ -254,6 +254,11 @@ namespace LimeReport {
|
|||||||
void setFont(const QFont &font);
|
void setFont(const QFont &font);
|
||||||
void setTextAlign(const Qt::Alignment& alignment);
|
void setTextAlign(const Qt::Alignment& alignment);
|
||||||
void setBorders(const BaseDesignIntf::BorderLines& border);
|
void setBorders(const BaseDesignIntf::BorderLines& border);
|
||||||
|
void setBordersExt(const BaseDesignIntf::BorderLines &border,
|
||||||
|
const double borderWidth,
|
||||||
|
const BaseDesignIntf::BorderStyle style,
|
||||||
|
const QString color
|
||||||
|
);
|
||||||
void lockSelectedItems();
|
void lockSelectedItems();
|
||||||
void unlockSelectedItems();
|
void unlockSelectedItems();
|
||||||
void selectOneLevelItems();
|
void selectOneLevelItems();
|
||||||
|
@ -98,38 +98,10 @@ void PageItemDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsIte
|
|||||||
paintGrid(ppainter, rect);
|
paintGrid(ppainter, rect);
|
||||||
ppainter->setPen(gridColor());
|
ppainter->setPen(gridColor());
|
||||||
ppainter->drawRect(boundingRect());
|
ppainter->drawRect(boundingRect());
|
||||||
//Draw shadow
|
drawShadow(ppainter, boundingRect(), 10);
|
||||||
qreal shWidth = boundingRect().width()/100;
|
|
||||||
QRectF rshadow(boundingRect().topRight() + QPointF(0, shWidth),
|
|
||||||
boundingRect().bottomRight() + QPointF(shWidth, 0));
|
|
||||||
QLinearGradient rgrad(rshadow.topLeft(), rshadow.topRight());
|
|
||||||
rgrad.setColorAt(0.0, QColor(0,0,0,255));
|
|
||||||
rgrad.setColorAt(1.0, QColor(0,0,0,0));
|
|
||||||
ppainter->fillRect(rshadow, QBrush(rgrad));
|
|
||||||
QRectF bshadow(boundingRect().bottomLeft() + QPointF(shWidth, 0),
|
|
||||||
boundingRect().bottomRight() + QPointF(0, shWidth));
|
|
||||||
QLinearGradient bgrad(bshadow.topLeft(), bshadow.bottomLeft());
|
|
||||||
bgrad.setColorAt(0.0, QColor(0,0,0,255));
|
|
||||||
bgrad.setColorAt(1.0, QColor(0,0,0,0));
|
|
||||||
ppainter->fillRect(bshadow, QBrush(bgrad));
|
|
||||||
QRectF cshadow(boundingRect().bottomRight(),
|
|
||||||
boundingRect().bottomRight() + QPointF(shWidth, shWidth));
|
|
||||||
QRadialGradient cgrad(cshadow.topLeft(), shWidth, cshadow.topLeft());
|
|
||||||
cgrad.setColorAt(0.0, QColor(0,0,0,255));
|
|
||||||
cgrad.setColorAt(1.0, QColor(0,0,0,0));
|
|
||||||
ppainter->fillRect(cshadow, QBrush(cgrad));
|
|
||||||
if (m_isExtendedInDesignMode){
|
|
||||||
QPen pen;
|
|
||||||
pen.setColor(Qt::red);
|
|
||||||
pen.setStyle(Qt::DashLine);
|
|
||||||
pen.setWidth(2);
|
|
||||||
ppainter->setPen(pen);
|
|
||||||
ppainter->drawLine(pageRect().bottomLeft(),pageRect().bottomRight());
|
|
||||||
}
|
|
||||||
ppainter->restore();
|
ppainter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (itemMode() & PreviewMode) {
|
if (itemMode() & PreviewMode) {
|
||||||
ppainter->save();
|
ppainter->save();
|
||||||
ppainter->fillRect(rect(), Qt::white);
|
ppainter->fillRect(rect(), Qt::white);
|
||||||
@ -145,8 +117,6 @@ void PageItemDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsIte
|
|||||||
BaseDesignIntf::paint(ppainter,option,widget);
|
BaseDesignIntf::paint(ppainter,option,widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseDesignIntf *PageItemDesignIntf::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
|
BaseDesignIntf *PageItemDesignIntf::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
|
||||||
@ -828,7 +798,7 @@ void PageItemDesignIntf::processPopUpAction(QAction *action)
|
|||||||
}
|
}
|
||||||
if(action->text() == tr("Edit"))
|
if(action->text() == tr("Edit"))
|
||||||
{
|
{
|
||||||
lrpageeditor pageEdit(NULL,this);
|
PageEditor pageEdit(NULL,this);
|
||||||
pageEdit.exec();
|
pageEdit.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,6 +704,16 @@ void ReportDesignWidget::setBorders(const BaseDesignIntf::BorderLines& borders)
|
|||||||
activePage()->setBorders(borders);
|
activePage()->setBorders(borders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ReportDesignWidget::setBordersExt(
|
||||||
|
const BaseDesignIntf::BorderLines& border,
|
||||||
|
const double borderWidth,
|
||||||
|
const LimeReport::BaseDesignIntf::BorderStyle style,
|
||||||
|
const QString color
|
||||||
|
){
|
||||||
|
if (activePage())
|
||||||
|
activePage()->setBordersExt(border, borderWidth, style, color);
|
||||||
|
}
|
||||||
|
|
||||||
void ReportDesignWidget::prepareReport()
|
void ReportDesignWidget::prepareReport()
|
||||||
{
|
{
|
||||||
m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
|
m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
|
||||||
|
@ -194,6 +194,8 @@ public slots:
|
|||||||
void setFont(const QFont &font);
|
void setFont(const QFont &font);
|
||||||
void setTextAlign(const bool &horizontalAlign, const Qt::AlignmentFlag &alignment);
|
void setTextAlign(const bool &horizontalAlign, const Qt::AlignmentFlag &alignment);
|
||||||
void setBorders(const BaseDesignIntf::BorderLines& borders);
|
void setBorders(const BaseDesignIntf::BorderLines& borders);
|
||||||
|
void setBordersExt(const BaseDesignIntf::BorderLines &border, const double borderWidth,
|
||||||
|
const LimeReport::BaseDesignIntf::BorderStyle style, const QString color);
|
||||||
void editSetting();
|
void editSetting();
|
||||||
void setUseGrid(bool value);
|
void setUseGrid(bool value);
|
||||||
void previewReport();
|
void previewReport();
|
||||||
|
@ -186,5 +186,6 @@
|
|||||||
<file alias="/images/logo32">images/designer.png</file>
|
<file alias="/images/logo32">images/designer.png</file>
|
||||||
<file alias="/images/lock">images/lock.png</file>
|
<file alias="/images/lock">images/lock.png</file>
|
||||||
<file>images/unlock.png</file>
|
<file>images/unlock.png</file>
|
||||||
|
<file alias="/images/borderEditor">images/border_settings.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
Loading…
Reference in New Issue
Block a user