0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 00:33:02 +03:00

Ruler has been fixed

This commit is contained in:
Arin Alexander 2019-06-27 10:45:26 +03:00
parent ac154dbc03
commit 69369e3b0c
14 changed files with 14 additions and 24 deletions

View File

@ -18,7 +18,6 @@ public slots:
QLocale::Language getCurrentDefaultLanguage(); QLocale::Language getCurrentDefaultLanguage();
void currentDefaultLanguageChanged(QLocale::Language language); void currentDefaultLanguageChanged(QLocale::Language language);
private: private:
QApplication* m_app;
QSettings* m_setting; QSettings* m_setting;
}; };

View File

@ -49,7 +49,7 @@ 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(CODE128),
m_foregroundColor(Qt::black), m_backgroundColor(Qt::white), m_whitespace(10), m_angle(Angle0), 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(UNICODE_INPUT_MODE),
m_option3(0) m_hideText(false), m_option3(0)
{} {}
BarcodeItem::~BarcodeItem() BarcodeItem::~BarcodeItem()

View File

@ -515,15 +515,13 @@ void PieChart::paintChart(QPainter *painter, QRectF chartRect)
} }
qreal onePercent = sum / 100; qreal onePercent = sum / 100;
qreal currentDegree = 0; qreal currentDegree = 0;
int currentColor = 0; for(int i=0; i<si->data()->values().count(); ++i){
for(int i=0; i<si->data()->values().count();++i){
qreal value = si->data()->values().at(i); qreal value = si->data()->values().at(i);
qreal sectorDegree = (value/onePercent)*3.6; qreal sectorDegree = (value/onePercent)*3.6;
painter->setBrush(si->data()->colors().at(i)); painter->setBrush(si->data()->colors().at(i));
painter->drawPie(chartRect,currentDegree*16,sectorDegree*16); painter->drawPie(chartRect,currentDegree*16,sectorDegree*16);
drawPercent(painter, chartRect, currentDegree, sectorDegree); drawPercent(painter, chartRect, currentDegree, sectorDegree);
currentDegree += sectorDegree; currentDegree += sectorDegree;
currentColor++;
} }
} else { } else {
painter->setBrush(color_map[0]); painter->setBrush(color_map[0]);
@ -768,7 +766,6 @@ void VerticalBarChart::paintSerialLines(QPainter* painter, QRectF barsRect)
qreal topShift = (delta - (maxValue()-minValue())) * vStep +barsRect.top(); qreal topShift = (delta - (maxValue()-minValue())) * vStep +barsRect.top();
if (!m_chartItem->series().isEmpty() && !m_chartItem->series().at(0)->data()->labels().isEmpty()){ if (!m_chartItem->series().isEmpty() && !m_chartItem->series().at(0)->data()->labels().isEmpty()){
int curSeries = 0;
foreach (SeriesItem* series, m_chartItem->series()) { foreach (SeriesItem* series, m_chartItem->series()) {
if (series->preferredType() == SeriesItem::Line){ if (series->preferredType() == SeriesItem::Line){
QPen pen(series->color()); QPen pen(series->color());
@ -791,7 +788,6 @@ void VerticalBarChart::paintSerialLines(QPainter* painter, QRectF barsRect)
} }
} }
curSeries++;
} }
} }
painter->restore(); painter->restore();
@ -803,7 +799,6 @@ void VerticalBarChart::paintLabels(QPainter *painter, QRectF labelsRect)
{ {
painter->save(); painter->save();
qreal hStep = (labelsRect.width() / valuesCount()); qreal hStep = (labelsRect.width() / valuesCount());
int curLabel = 0;
if (!m_chartItem->labels().isEmpty()){ if (!m_chartItem->labels().isEmpty()){
painter->rotate(270); painter->rotate(270);
@ -811,7 +806,6 @@ void VerticalBarChart::paintLabels(QPainter *painter, QRectF labelsRect)
foreach (QString label, m_chartItem->labels()) { foreach (QString label, m_chartItem->labels()) {
painter->drawText(QRectF(QPoint(0,0), painter->drawText(QRectF(QPoint(0,0),
QSize(labelsRect.height()-4,hStep)),Qt::AlignVCenter|Qt::AlignRight,label); QSize(labelsRect.height()-4,hStep)),Qt::AlignVCenter|Qt::AlignRight,label);
curLabel++;
painter->translate(0,hStep); painter->translate(0,hStep);
} }
painter->rotate(-270); painter->rotate(-270);

View File

@ -134,8 +134,8 @@ BaseDesignIntf* VerticalLayout::cloneBottomPart(int height, QObject* owner, QGra
} }
} }
int currentHeight = 0;
if (!bottomPart->isEmpty()){ if (!bottomPart->isEmpty()){
int currentHeight = 0;
foreach (BaseDesignIntf* item, bottomPart->childBaseItems()) { foreach (BaseDesignIntf* item, bottomPart->childBaseItems()) {
currentHeight+=item->height(); currentHeight+=item->height();
} }

View File

@ -662,7 +662,6 @@ BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGrap
} }
} }
upperPart->setHeight(height); upperPart->setHeight(height);
height = maxBottom;
return upperPart; return upperPart;
} }

View File

@ -718,10 +718,10 @@ QVariant CallbackDatasource::dataByRowIndex(const QString &columnName, int rowIn
QVariant CallbackDatasource::dataByKeyField(const QString& columnName, const QString& keyColumnName, QVariant keyData) QVariant CallbackDatasource::dataByKeyField(const QString& columnName, const QString& keyColumnName, QVariant keyData)
{ {
int backupCurrentRow = m_currentRow; int backupCurrentRow = m_currentRow;
int currentRow = 0;
QVariant result = QVariant(); QVariant result = QVariant();
first(); first();
if (!checkIfEmpty()){ if (!checkIfEmpty()){
int currentRow = 0;
do { do {
QVariant key = callbackData(keyColumnName, currentRow); QVariant key = callbackData(keyColumnName, currentRow);
if (key == keyData){ if (key == keyData){

View File

@ -485,8 +485,8 @@ QString DataSourceManager::replaceVariables(QString query, QMap<QString,QString>
QString DataSourceManager::replaceFields(QString query, QMap<QString,QString> &aliasesToParam, QString masterDatasource) QString DataSourceManager::replaceFields(QString query, QMap<QString,QString> &aliasesToParam, QString masterDatasource)
{ {
QRegExp rx(Const::FIELD_RX); QRegExp rx(Const::FIELD_RX);
int curentAliasIndex=0;
if (query.contains(rx)){ if (query.contains(rx)){
int curentAliasIndex=0;
int pos; int pos;
while ((pos=rx.indexIn(query))!=-1){ while ((pos=rx.indexIn(query))!=-1){
QString field=rx.cap(0); QString field=rx.cap(0);
@ -719,7 +719,7 @@ void DataSourceManager::removeConnection(const QString &connectionName)
delete (*cit); delete (*cit);
cit = m_connections.erase(cit); cit = m_connections.erase(cit);
} else { } else {
cit++; ++cit;
} }
} }
m_hasChanges = true; m_hasChanges = true;

View File

@ -118,9 +118,8 @@ QVariant GroupFunction::multiplication(QVariant value1, QVariant value2)
} }
GroupFunction::GroupFunction(const QString &expression, const QString &dataBandName, DataSourceManager* dataManager) GroupFunction::GroupFunction(const QString &expression, const QString &dataBandName, DataSourceManager* dataManager)
:m_dataBandName(dataBandName), m_dataManager(dataManager),m_isValid(true), m_errorMessage("") :m_data(expression), m_dataBandName(dataBandName), m_dataManager(dataManager), m_isValid(true), m_errorMessage("")
{ {
m_data = expression;
QRegExp rxField(Const::FIELD_RX,Qt::CaseInsensitive); QRegExp rxField(Const::FIELD_RX,Qt::CaseInsensitive);
QRegExp rxVariable(Const::VARIABLE_RX,Qt::CaseInsensitive); QRegExp rxVariable(Const::VARIABLE_RX,Qt::CaseInsensitive);
QRegExp rxScript(Const::SCRIPT_RX,Qt::CaseInsensitive); QRegExp rxScript(Const::SCRIPT_RX,Qt::CaseInsensitive);

View File

@ -1334,9 +1334,9 @@ BaseDesignIntf* PageDesignIntf::findDestObject(BaseDesignIntf* item){
void PageDesignIntf::paste() void PageDesignIntf::paste()
{ {
QClipboard *clipboard = QApplication::clipboard(); QClipboard *clipboard = QApplication::clipboard();
BaseDesignIntf* destItem = 0;
ItemsReaderIntf::Ptr reader = StringXMLreader::create(clipboard->text()); ItemsReaderIntf::Ptr reader = StringXMLreader::create(clipboard->text());
if (reader->first() && reader->itemType() == "Object"){ if (reader->first() && reader->itemType() == "Object"){
BaseDesignIntf* destItem = 0;
if (!selectedItems().isEmpty()) if (!selectedItems().isEmpty())
destItem = findDestObject(dynamic_cast<BaseDesignIntf*>(selectedItems().at(0))); destItem = findDestObject(dynamic_cast<BaseDesignIntf*>(selectedItems().at(0)));
else else

View File

@ -778,7 +778,6 @@ void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToS
BandDesignIntf* firstMoveBand = (bandToSwap->bandIndex() > band->bandIndex()) ? bandToSwap: band; BandDesignIntf* firstMoveBand = (bandToSwap->bandIndex() > band->bandIndex()) ? bandToSwap: band;
firstMoveBand->changeBandIndex(firstIndex, true); firstMoveBand->changeBandIndex(firstIndex, true);
moveIndex = firstMoveBand->maxChildIndex() + 1;
moveIndex = firstIndex; moveIndex = firstIndex;
qSort(bandToMove.begin(), bandToMove.end(), bandIndexLessThen); qSort(bandToMove.begin(), bandToMove.end(), bandIndexLessThen);

View File

@ -1119,7 +1119,7 @@ void Ruler::paintEvent(QPaintEvent *event){
QString::number(i)); QString::number(i));
} }
} }
painter.setPen(Qt::black); painter.setPen(palette().foreground().color());
painter.drawLine(m_mousePos.x() - (hStartPos > 0 ? hStartPos : 0) , 0, painter.drawLine(m_mousePos.x() - (hStartPos > 0 ? hStartPos : 0) , 0,
m_mousePos.x() - (hStartPos > 0 ? hStartPos : 0) , 20); m_mousePos.x() - (hStartPos > 0 ? hStartPos : 0) , 20);
break; break;
@ -1148,7 +1148,7 @@ void Ruler::paintEvent(QPaintEvent *event){
painter.drawLine(10, vs5, 20, vs5); painter.drawLine(10, vs5, 20, vs5);
} }
} }
painter.setPen(Qt::black); painter.setPen(palette().foreground().color());
painter.drawLine(0, m_mousePos.y() - (vStartPos > 0 ? vStartPos : 0), painter.drawLine(0, m_mousePos.y() - (vStartPos > 0 ? vStartPos : 0),
20, m_mousePos.y() - (vStartPos > 0 ? vStartPos : 0)); 20, m_mousePos.y() - (vStartPos > 0 ? vStartPos : 0));
break; break;

View File

@ -514,6 +514,7 @@ bool ReportEnginePrivate::showPreviewWindow(ReportPages pages, PreviewHints hint
w->setSettings(settings()); w->setSettings(settings());
w->setPages(pages); w->setPages(pages);
w->setLayoutDirection(m_previewLayoutDirection); w->setLayoutDirection(m_previewLayoutDirection);
w->setStyleSheet(styleSheet());
if (!dataManager()->errorsList().isEmpty()){ if (!dataManager()->errorsList().isEmpty()){
w->setErrorMessages(dataManager()->errorsList()); w->setErrorMessages(dataManager()->errorsList());

View File

@ -901,7 +901,7 @@ void ReportRender::closeGroup(BandDesignIntf *band)
bl->clear(); bl->clear();
delete bl; delete bl;
} }
it++; ++it;
} }
m_childBands.remove(band); m_childBands.remove(band);
@ -931,7 +931,7 @@ void ReportRender::closeDataGroup(BandDesignIntf *band)
if ((*it)->bandIndex()>band->bandIndex()) if ((*it)->bandIndex()>band->bandIndex())
it = m_reprintableBands.erase(it); it = m_reprintableBands.erase(it);
else else
it++; ++it;
} }
} }
recalcIfNeeded(band); recalcIfNeeded(band);
@ -1573,7 +1573,7 @@ void PagesRanges::addTOCPage()
if (tocRange.firstPage == 0) { if (tocRange.firstPage == 0) {
tocRange.firstPage = tocRange.lastPage == 0 ? 1 : tocRange.lastPage; tocRange.firstPage = tocRange.lastPage == 0 ? 1 : tocRange.lastPage;
tocRange.lastPage = tocRange.lastPage == 0 ? 1 : tocRange.lastPage; tocRange.lastPage = tocRange.lastPage == 0 ? 1 : tocRange.lastPage;
if (tocRange.lastPage == 1 && tocRange.lastPage == 1) if (tocRange.firstPage == 1 && tocRange.lastPage == 1)
shiftRangesNextToTOC(); shiftRangesNextToTOC();
} else { } else {
tocRange.lastPage++; tocRange.lastPage++;

View File

@ -146,7 +146,6 @@ QWidget * LimeReport::RectUnitValuePropItem::createProperyEditor(QWidget *parent
QDoubleSpinBox *editor= new QDoubleSpinBox(parent); QDoubleSpinBox *editor= new QDoubleSpinBox(parent);
editor->setMaximum(100000); editor->setMaximum(100000);
editor->setSuffix(" "+unitShortName()); editor->setSuffix(" "+unitShortName());
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(object());
return editor; return editor;
} }