mirror of
https://github.com/fralx/LimeReport.git
synced 2025-03-28 13:13:44 +03:00
Band names translation has been fixed
Subdetail header render has been fixed # Conflicts: # limereport/lrreportrender.cpp
This commit is contained in:
commit
7bc8092191
@ -146,6 +146,8 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q
|
||||
m_bandNameLabel->setVisible(false);
|
||||
if (scene()) scene()->addItem(m_bandNameLabel);
|
||||
m_alternateBackgroundColor = backgroundColor();
|
||||
connect(this, SIGNAL(propertyObjectNameChanged(QString, QString)),
|
||||
this, SLOT(slotPropertyObjectNameChanged(const QString&,const QString&)));
|
||||
}
|
||||
|
||||
BandDesignIntf::~BandDesignIntf()
|
||||
@ -167,7 +169,12 @@ int extractItemIndex(const BaseDesignIntf* item){
|
||||
}
|
||||
|
||||
QString BandDesignIntf::translateBandName(const BaseDesignIntf* item) const{
|
||||
return tr(extractClassName(item->metaObject()->className()).toLatin1())+QString::number(extractItemIndex(item));
|
||||
QString defaultBandName = extractClassName(item->metaObject()->className()).toLatin1()+QString::number(extractItemIndex(item));
|
||||
if (item->objectName().compare(defaultBandName) == 0){
|
||||
return tr(extractClassName(item->metaObject()->className()).toLatin1())+QString::number(extractItemIndex(item));
|
||||
} else {
|
||||
return item->objectName();
|
||||
}
|
||||
}
|
||||
|
||||
void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
@ -626,7 +633,7 @@ void BandDesignIntf::trimToMaxHeight(int maxHeight)
|
||||
|
||||
void BandDesignIntf::setBandTypeText(const QString &value){
|
||||
m_bandTypeText=value;
|
||||
m_bandNameLabel->updateLabel();
|
||||
m_bandNameLabel->updateLabel(bandTitle());
|
||||
}
|
||||
|
||||
QSet<BandDesignIntf::BandsType> BandDesignIntf::groupBands()
|
||||
@ -684,7 +691,7 @@ QVariant BandDesignIntf::itemChange(QGraphicsItem::GraphicsItemChange change, co
|
||||
m_bandMarker->update(0,0,
|
||||
m_bandMarker->boundingRect().width(),
|
||||
m_bandMarker->boundingRect().width());
|
||||
m_bandNameLabel->updateLabel();
|
||||
m_bandNameLabel->updateLabel(bandTitle());
|
||||
m_bandNameLabel->setVisible(value.toBool());
|
||||
|
||||
}
|
||||
@ -758,6 +765,13 @@ void BandDesignIntf::setAlternateBackgroundColor(const QColor &alternateBackgrou
|
||||
}
|
||||
}
|
||||
|
||||
void BandDesignIntf::slotPropertyObjectNameChanged(const QString &, const QString& newName)
|
||||
{
|
||||
update();
|
||||
if (m_bandNameLabel)
|
||||
m_bandNameLabel->updateLabel(newName);
|
||||
}
|
||||
|
||||
bool BandDesignIntf::repeatOnEachRow() const
|
||||
{
|
||||
return m_repeatOnEachRow;
|
||||
@ -923,7 +937,7 @@ void BandDesignIntf::restoreItems()
|
||||
|
||||
void BandDesignIntf::updateBandNameLabel()
|
||||
{
|
||||
if (m_bandNameLabel) m_bandNameLabel->updateLabel();
|
||||
if (m_bandNameLabel) m_bandNameLabel->updateLabel(bandTitle());
|
||||
}
|
||||
|
||||
QColor BandDesignIntf::selectionColor() const
|
||||
@ -966,7 +980,7 @@ QRectF BandNameLabel::boundingRect() const
|
||||
return m_rect;
|
||||
}
|
||||
|
||||
void BandNameLabel::updateLabel()
|
||||
void BandNameLabel::updateLabel(const QString& bandName)
|
||||
{
|
||||
QFont font("Arial",7*Const::fontFACTOR,-1,true);
|
||||
QFontMetrics fontMetrics(font);
|
||||
@ -974,7 +988,7 @@ void BandNameLabel::updateLabel()
|
||||
m_rect = QRectF(
|
||||
m_band->pos().x()+10,
|
||||
m_band->pos().y()-(fontMetrics.height()+10),
|
||||
fontMetrics.width(m_band->bandTitle())+20,fontMetrics.height()+10
|
||||
fontMetrics.width(bandName)+20,fontMetrics.height()+10
|
||||
);
|
||||
update();
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
explicit BandNameLabel(BandDesignIntf* band, QGraphicsItem* parent=0);
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
QRectF boundingRect() const;
|
||||
void updateLabel();
|
||||
void updateLabel(const QString &bandName);
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||
private:
|
||||
QRectF m_rect;
|
||||
@ -225,7 +225,7 @@ public:
|
||||
void setUseAlternateBackgroundColor(bool useAlternateBackgroundColor);
|
||||
void replaceGroupsFunction(BandDesignIntf *band);
|
||||
signals:
|
||||
void bandRendered(BandDesignIntf* band);
|
||||
void bandRendered(BandDesignIntf* band);
|
||||
protected:
|
||||
void trimToMaxHeight(int maxHeight);
|
||||
void setBandTypeText(const QString& value);
|
||||
@ -249,6 +249,7 @@ protected:
|
||||
QString translateBandName(const BaseDesignIntf *item) const;
|
||||
private slots:
|
||||
void childBandDeleted(QObject* band);
|
||||
void slotPropertyObjectNameChanged(const QString&,const QString&);
|
||||
private:
|
||||
QString m_bandTypeText;
|
||||
BandsType m_bandType;
|
||||
|
@ -484,6 +484,7 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand)
|
||||
|
||||
IDataSource* bandDatasource = 0;
|
||||
m_lastRenderedFooter = 0;
|
||||
|
||||
if (!dataBand->datasourceName().isEmpty())
|
||||
bandDatasource = datasources()->dataSource(dataBand->datasourceName());
|
||||
|
||||
@ -644,7 +645,8 @@ void ReportRender::renderChildHeader(BandDesignIntf *parent, BandPrintMode print
|
||||
if (band->metaObject()->indexOfProperty("printAlways")>0){
|
||||
printAlways=band->property("printAlways").toBool();
|
||||
}
|
||||
if (printAlways == (printMode==PrintAlwaysPrintable) ) renderBand(band, 0, StartNewPageAsNeeded);
|
||||
if ((band != m_lastRenderedHeader) && (printAlways == (printMode == PrintAlwaysPrintable)) )
|
||||
renderBand(band, 0, StartNewPageAsNeeded);
|
||||
}
|
||||
}
|
||||
|
||||
@ -668,9 +670,9 @@ void ReportRender::renderChildBands(BandDesignIntf *parentBand)
|
||||
if (!band->datasourceName().isEmpty())
|
||||
ds = m_datasources->dataSource(band->datasourceName());
|
||||
if (ds) ds->first();
|
||||
renderChildHeader(band,PrintAlwaysPrintable);
|
||||
//renderChildHeader(band,PrintAlwaysPrintable);
|
||||
renderDataBand(band);
|
||||
renderChildFooter(band,PrintAlwaysPrintable);
|
||||
//renderChildFooter(band,PrintAlwaysPrintable);
|
||||
closeFooterGroup(band);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user