mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2025-10-01 11:40:02 +03:00
27/03
This commit is contained in:
@@ -34,6 +34,11 @@ namespace LimeReport{
|
||||
|
||||
void ItemsBordersEditorWidget::setItemEvent(BaseDesignIntf* item)
|
||||
{
|
||||
if(QString(item->metaObject()->className()) == "LimeReport::ShapeItem")
|
||||
{
|
||||
setDisabled(true);
|
||||
return;
|
||||
}
|
||||
QVariant borders=item->property("borders");
|
||||
if (borders.isValid()){
|
||||
updateValues((BaseDesignIntf::BorderLines)borders.toInt());
|
||||
|
@@ -114,6 +114,7 @@ void ShapeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
ItemDesignIntf::paint(painter,option,widget);
|
||||
|
||||
|
@@ -65,6 +65,7 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
|
||||
m_BGMode(OpaqueMode),
|
||||
m_opacity(100),
|
||||
m_borderLinesFlags(BorderLines()),
|
||||
m_borderStyle(Qt::SolidLine),
|
||||
m_storageTypeName(storageTypeName),
|
||||
m_itemMode(DesignMode),
|
||||
m_objectState(ObjectCreated),
|
||||
@@ -88,6 +89,7 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
|
||||
m_isChangingPos(false),
|
||||
m_isMoveable(false)
|
||||
|
||||
|
||||
{
|
||||
setGeometry(QRectF(0, 0, m_width, m_height));
|
||||
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
|
||||
@@ -764,6 +766,11 @@ void BaseDesignIntf::setIsChangingPos(bool isChangingPos)
|
||||
m_isChangingPos = isChangingPos;
|
||||
}
|
||||
|
||||
bool BaseDesignIntf::isShapeItem() const
|
||||
{
|
||||
return QString(metaObject()->className()) == "LimeReport::ShapeItem";
|
||||
}
|
||||
|
||||
bool BaseDesignIntf::isGeometryLocked() const
|
||||
{
|
||||
return m_itemGeometryLocked;
|
||||
@@ -948,6 +955,14 @@ int BaseDesignIntf::borderLineSize() const
|
||||
return m_borderLineSize;
|
||||
}
|
||||
|
||||
void BaseDesignIntf::setBorderStyle(Qt::PenStyle b)
|
||||
{
|
||||
Qt::PenStyle oldValue = m_borderStyle;
|
||||
m_borderStyle = b;
|
||||
update();
|
||||
notify("borderStyle",(BorderStyle)oldValue,(BorderStyle)b);
|
||||
}
|
||||
|
||||
void BaseDesignIntf::setBorderLineSize(int value)
|
||||
{
|
||||
int oldValue = m_borderLineSize;
|
||||
@@ -1026,32 +1041,47 @@ BaseDesignIntf::BorderLines BaseDesignIntf::borderLines() const
|
||||
return m_borderLinesFlags;
|
||||
}
|
||||
|
||||
Qt::PenStyle BaseDesignIntf::borderStyle() const
|
||||
{
|
||||
return m_borderStyle;
|
||||
}
|
||||
|
||||
void BaseDesignIntf::drawTopLine(QPainter *painter, QRectF rect) const
|
||||
{
|
||||
if(isShapeItem())
|
||||
return;
|
||||
painter->setPen(borderPen(TopLine));
|
||||
painter->drawLine(rect.x(), rect.y(), rect.width(), rect.y());
|
||||
}
|
||||
|
||||
void BaseDesignIntf::drawBootomLine(QPainter *painter, QRectF rect) const
|
||||
{
|
||||
if(isShapeItem())
|
||||
return;
|
||||
painter->setPen(borderPen(BottomLine));
|
||||
painter->drawLine(rect.x(), rect.height(), rect.width(), rect.height());
|
||||
}
|
||||
|
||||
void BaseDesignIntf::drawRightLine(QPainter *painter, QRectF rect) const
|
||||
{
|
||||
if(isShapeItem())
|
||||
return;
|
||||
painter->setPen(borderPen(RightLine));
|
||||
painter->drawLine(rect.width(), rect.y(), rect.width(), rect.height());
|
||||
}
|
||||
|
||||
void BaseDesignIntf::drawLeftLine(QPainter *painter, QRectF rect) const
|
||||
{
|
||||
if(isShapeItem())
|
||||
return;
|
||||
painter->setPen(borderPen(LeftLine));
|
||||
painter->drawLine(rect.x(), rect.y(), rect.x(), rect.height());
|
||||
}
|
||||
|
||||
void BaseDesignIntf::drawDesignModeBorder(QPainter *painter, QRectF rect) const
|
||||
{
|
||||
if(isShapeItem())
|
||||
return;
|
||||
drawTopLine(painter, rect);
|
||||
drawBootomLine(painter, rect);
|
||||
drawLeftLine(painter, rect);
|
||||
@@ -1060,7 +1090,8 @@ void BaseDesignIntf::drawDesignModeBorder(QPainter *painter, QRectF rect) const
|
||||
|
||||
void BaseDesignIntf::drawRenderModeBorder(QPainter *painter, QRectF rect) const
|
||||
{
|
||||
|
||||
if(isShapeItem())
|
||||
return;
|
||||
if (m_borderLinesFlags & RightLine) drawRightLine(painter, rect);
|
||||
if (m_borderLinesFlags & LeftLine) drawLeftLine(painter, rect);
|
||||
if (m_borderLinesFlags & TopLine ) drawTopLine(painter, rect);
|
||||
@@ -1138,8 +1169,8 @@ QPen BaseDesignIntf::borderPen(BorderSide side/*, bool selected*/) const
|
||||
QPen pen;
|
||||
if (m_borderLinesFlags & side) {
|
||||
pen.setColor(m_borderColor);
|
||||
pen.setStyle(Qt::SolidLine);
|
||||
pen.setWidth(m_borderLineSize);
|
||||
pen.setStyle(m_borderStyle);
|
||||
pen.setWidth(m_borderLineSize+1);
|
||||
} else {
|
||||
pen.setColor(Qt::darkGray);
|
||||
pen.setStyle(Qt::SolidLine);
|
||||
|
@@ -94,10 +94,18 @@ class BaseDesignIntf :
|
||||
Q_PROPERTY(bool isVisible READ isVisible WRITE setItemVisible DESIGNABLE false)
|
||||
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
|
||||
Q_PROPERTY(bool geometryLocked READ isGeometryLocked WRITE setGeometryLocked)
|
||||
Q_PROPERTY(Qt::PenStyle borderStyle READ borderStyle WRITE setBorderStyle)
|
||||
|
||||
friend class ReportRender;
|
||||
public:
|
||||
enum BGMode { TransparentMode, OpaqueMode};
|
||||
enum BorderStyle { NoStyle = Qt::NoPen,
|
||||
Solid = Qt::SolidLine,
|
||||
Dot = Qt::DotLine,
|
||||
Dashed = Qt::DashLine,
|
||||
DashDot = Qt::DashDotLine,
|
||||
DashDotDot = Qt::DashDotDotLine,
|
||||
};
|
||||
|
||||
|
||||
enum BrushStyle{ NoBrush,
|
||||
@@ -147,21 +155,25 @@ public:
|
||||
#if QT_VERSION >= 0x050500
|
||||
Q_ENUM(BGMode)
|
||||
Q_ENUM(BrushStyle)
|
||||
Q_ENUM(BorderStyle)
|
||||
Q_ENUM(ResizeFlags)
|
||||
Q_ENUM(MoveFlags)
|
||||
Q_ENUM(BorderSide)
|
||||
Q_ENUM(ObjectState)
|
||||
Q_ENUM(ItemAlign)
|
||||
Q_ENUM(UnitType)
|
||||
|
||||
#else
|
||||
Q_ENUMS(BGMode)
|
||||
Q_ENUMS(BrushStyle)
|
||||
Q_ENUM(BorderStyle)
|
||||
Q_ENUMS(ResizeFlags)
|
||||
Q_ENUMS(MoveFlags)
|
||||
Q_ENUMS(BorderSide)
|
||||
Q_ENUMS(ObjectState)
|
||||
Q_ENUMS(ItemAlign)
|
||||
Q_ENUMS(UnitType)
|
||||
|
||||
#endif
|
||||
// enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
|
||||
Q_DECLARE_FLAGS(BorderLines, BorderSide)
|
||||
@@ -240,6 +252,7 @@ public:
|
||||
PageDesignIntf* page();
|
||||
|
||||
BorderLines borderLines() const;
|
||||
Qt::PenStyle borderStyle() const;
|
||||
QString storageTypeName() const {return m_storageTypeName;}
|
||||
ReportEnginePrivate *reportEditor();
|
||||
|
||||
@@ -285,6 +298,7 @@ public:
|
||||
void setItemTypeName(const QString &itemTypeName);
|
||||
|
||||
int borderLineSize() const;
|
||||
void setBorderStyle(Qt::PenStyle b);
|
||||
void setBorderLineSize(int value);
|
||||
void showEditorDialog();
|
||||
ItemAlign itemAlign() const;
|
||||
@@ -320,6 +334,7 @@ public:
|
||||
void setGeometryLocked(bool itemLocked);
|
||||
bool isChangingPos() const;
|
||||
void setIsChangingPos(bool isChangingPos);
|
||||
bool isShapeItem() const;
|
||||
|
||||
Q_INVOKABLE QString setItemWidth(qreal width);
|
||||
Q_INVOKABLE QString setItemHeight(qreal height);
|
||||
@@ -367,6 +382,7 @@ protected:
|
||||
void drawRightLine(QPainter *painter, QRectF rect) const;
|
||||
void drawLeftLine(QPainter *painter, QRectF rect) const;
|
||||
|
||||
|
||||
void drawBorder(QPainter* painter, QRectF rect) const;
|
||||
void drawDesignModeBorder(QPainter* painter, QRectF rect) const;
|
||||
void drawRenderModeBorder(QPainter *painter, QRectF rect) const;
|
||||
@@ -434,6 +450,7 @@ private:
|
||||
BGMode m_BGMode;
|
||||
int m_opacity;
|
||||
BorderLines m_borderLinesFlags;
|
||||
Qt::PenStyle m_borderStyle;
|
||||
|
||||
QRectF m_bottomRect;
|
||||
QRectF m_topRect;
|
||||
|
@@ -407,7 +407,7 @@ bool ReportEnginePrivate::printReport(QPrinter* printer)
|
||||
if (printer&&printer->isValid()){
|
||||
try{
|
||||
bool designTime = dataManager()->designTime();
|
||||
dataManager()->setDesignTime(false);
|
||||
dataManager()->setDesignTime(false);
|
||||
ReportPages pages = renderToPages();
|
||||
dataManager()->setDesignTime(designTime);
|
||||
if (pages.count()>0){
|
||||
@@ -536,7 +536,7 @@ bool ReportEnginePrivate::showPreviewWindow(ReportPages pages, PreviewHints hint
|
||||
}
|
||||
|
||||
void ReportEnginePrivate::previewReport(PreviewHints hints)
|
||||
{
|
||||
{
|
||||
previewReport(0, hints);
|
||||
}
|
||||
|
||||
@@ -661,21 +661,21 @@ bool ReportEnginePrivate::slotLoadFromFile(const QString &fileName)
|
||||
{
|
||||
EASY_BLOCK("ReportEnginePrivate::slotLoadFromFile")
|
||||
PreviewReportWindow *currentPreview = qobject_cast<PreviewReportWindow *>(m_activePreview);
|
||||
|
||||
|
||||
if (!QFile::exists(fileName))
|
||||
{
|
||||
if ( hasActivePreview() )
|
||||
{
|
||||
{
|
||||
QMessageBox::information( NULL,
|
||||
tr( "Report File Change" ),
|
||||
tr( "The report file \"%1\" has changed names or been deleted.\n\nThis preview is no longer valid." ).arg( fileName )
|
||||
);
|
||||
|
||||
|
||||
clearReport();
|
||||
|
||||
|
||||
currentPreview->close();
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -742,8 +742,8 @@ void ReportEnginePrivate::designReport(bool showModal)
|
||||
if (designerWindow){
|
||||
dataManager()->setDesignTime(true);
|
||||
connect(designerWindow, SIGNAL(destroyed(QObject*)), this, SLOT(slotDesignerWindowDestroyed(QObject*)));
|
||||
#ifdef Q_OS_WIN
|
||||
designerWindow->setWindowModality(Qt::ApplicationModal);
|
||||
#ifdef Q_OS_WIN
|
||||
designerWindow->setWindowModality(Qt::NonModal);
|
||||
#endif
|
||||
if (!showModal){
|
||||
designerWindow->show();;
|
||||
@@ -856,7 +856,7 @@ bool ReportEnginePrivate::saveToFile(const QString &fileName)
|
||||
QScopedPointer< ItemsWriterIntf > writer(new XMLWriter());
|
||||
writer->setPassPhrase(m_passPhrase);
|
||||
writer->putItem(this);
|
||||
m_fileName=fn;
|
||||
m_fileName=fn;
|
||||
bool saved = writer->saveToFile(fn);
|
||||
|
||||
foreach (ConnectionDesc* connection, dataManager()->conections()) {
|
||||
@@ -1419,7 +1419,7 @@ ReportEngine::ReportEngine(QObject *parent)
|
||||
connect(d, SIGNAL(loadFinished()), this, SIGNAL(loadFinished()));
|
||||
connect(d, SIGNAL(cleared()), this, SIGNAL(cleared()));
|
||||
connect(d, SIGNAL(printedToPDF(QString)), this, SIGNAL(printedToPDF(QString)));
|
||||
|
||||
|
||||
connect(d, SIGNAL(getAvailableDesignerLanguages(QList<QLocale::Language>*)),
|
||||
this, SIGNAL(getAvailableDesignerLanguages(QList<QLocale::Language>*)));
|
||||
connect(d, SIGNAL(currentDefaultDesignerLanguageChanged(QLocale::Language)),
|
||||
|
Reference in New Issue
Block a user