mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
WIP
This commit is contained in:
parent
53683a8c89
commit
7dad9d700b
@ -3,7 +3,11 @@
|
|||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
#else
|
||||||
|
#include <QScreen>
|
||||||
|
#endif
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
@ -40,10 +44,17 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
connect(ui->actionOne_to_One, SIGNAL(triggered()), this, SLOT(slotOneToOne()));
|
connect(ui->actionOne_to_One, SIGNAL(triggered()), this, SLOT(slotOneToOne()));
|
||||||
initPercentCombobox();
|
initPercentCombobox();
|
||||||
enableUI(false);
|
enableUI(false);
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
QDesktopWidget *desktop = QApplication::desktop();
|
QDesktopWidget *desktop = QApplication::desktop();
|
||||||
|
|
||||||
int screenWidth = desktop->screenGeometry().width();
|
int screenWidth = desktop->screenGeometry().width();
|
||||||
int screenHeight = desktop->screenGeometry().height();
|
int screenHeight = desktop->screenGeometry().height();
|
||||||
|
#else
|
||||||
|
QScreen *screen = QGuiApplication::primaryScreen();
|
||||||
|
|
||||||
|
int screenWidth = screen->geometry().width();
|
||||||
|
int screenHeight = screen->geometry().height();
|
||||||
|
#endif
|
||||||
|
|
||||||
int x = screenWidth*0.1;
|
int x = screenWidth*0.1;
|
||||||
int y = screenHeight*0.1;
|
int y = screenHeight*0.1;
|
||||||
|
@ -1 +1 @@
|
|||||||
#include "lrcallbackdatasourceintf.h"
|
#include "lrcallbackdatasourceintf.h"
|
||||||
|
@ -104,7 +104,11 @@ namespace Const{
|
|||||||
QString extractClassName(QString className);
|
QString extractClassName(QString className);
|
||||||
QString escapeSimbols(const QString& value);
|
QString escapeSimbols(const QString& value);
|
||||||
QString replaceHTMLSymbols(const QString &value);
|
QString replaceHTMLSymbols(const QString &value);
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
QVector<QString> normalizeCaptures(const QRegExp ®);
|
QVector<QString> normalizeCaptures(const QRegExp ®);
|
||||||
|
#else
|
||||||
|
QVector<QString> normalizeCaptures(const QRegularExpression ®);
|
||||||
|
#endif
|
||||||
bool isColorDark(QColor color);
|
bool isColorDark(QColor color);
|
||||||
|
|
||||||
enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
|
enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
|
||||||
@ -148,7 +152,7 @@ namespace Const{
|
|||||||
virtual ~IPainterProxy();
|
virtual ~IPainterProxy();
|
||||||
};
|
};
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
#if QT_VERSION < 0x050000
|
||||||
typedef QStyleOptionViewItemV4 StyleOptionViewItem;
|
typedef QStyleOptionViewItemV4 StyleOptionViewItem;
|
||||||
#else
|
#else
|
||||||
typedef QStyleOptionViewItem StyleOptionViewItem;
|
typedef QStyleOptionViewItem StyleOptionViewItem;
|
||||||
|
@ -63,7 +63,8 @@ DataBrowser::DataBrowser(QWidget *parent) :
|
|||||||
connect(ui->changeConnection,SIGNAL(clicked()),this,SLOT(slotChangeConnection()));
|
connect(ui->changeConnection,SIGNAL(clicked()),this,SLOT(slotChangeConnection()));
|
||||||
connect(ui->pbConnect,SIGNAL(clicked()),this,SLOT(slotChangeConnectionState()));
|
connect(ui->pbConnect,SIGNAL(clicked()),this,SLOT(slotChangeConnectionState()));
|
||||||
|
|
||||||
ui->verticalLayout_2->setMargin(Const::DOCKWIDGET_MARGINS);
|
int margin = Const::DOCKWIDGET_MARGINS;
|
||||||
|
ui->verticalLayout_2->setContentsMargins(margin, margin, margin, margin);
|
||||||
|
|
||||||
ui->dataTree->setHeaderLabel(tr("Datasources"));
|
ui->dataTree->setHeaderLabel(tr("Datasources"));
|
||||||
ui->pbConnect->setEnabled(false);
|
ui->pbConnect->setEnabled(false);
|
||||||
@ -413,7 +414,7 @@ void DataBrowser::initConnections()
|
|||||||
connections.append(connectionName);
|
connections.append(connectionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qSort(connections);
|
std::sort(connections.begin(), connections.end());
|
||||||
foreach (QString connectionName, connections) {
|
foreach (QString connectionName, connections) {
|
||||||
QTreeWidgetItem *item=new QTreeWidgetItem(
|
QTreeWidgetItem *item=new QTreeWidgetItem(
|
||||||
ui->dataTree,
|
ui->dataTree,
|
||||||
@ -443,7 +444,7 @@ void DataBrowser::initConnections()
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// connections = m_report->dataManager()->connectionNames();
|
// connections = m_report->dataManager()->connectionNames();
|
||||||
// qSort(connections);
|
// std::sort(connections);
|
||||||
// foreach(QString connectionName,connectionName){
|
// foreach(QString connectionName,connectionName){
|
||||||
// if (!QSqlDatabase::contains(connectionName)){
|
// if (!QSqlDatabase::contains(connectionName)){
|
||||||
// QTreeWidgetItem *item=new QTreeWidgetItem(
|
// QTreeWidgetItem *item=new QTreeWidgetItem(
|
||||||
|
@ -78,11 +78,10 @@ void LRVariableDialog::showEvent(QShowEvent *)
|
|||||||
QMetaEnum enumerator = LimeReport::Enums::staticMetaObject.enumerator(enumIndex);
|
QMetaEnum enumerator = LimeReport::Enums::staticMetaObject.enumerator(enumIndex);
|
||||||
if (!m_variableName.isEmpty()&&m_variablesContainer&&m_variablesContainer->containsVariable(m_variableName)){
|
if (!m_variableName.isEmpty()&&m_variablesContainer&&m_variablesContainer->containsVariable(m_variableName)){
|
||||||
ui->leValue->setPlainText(m_variablesContainer->variable(m_variableName).toString());
|
ui->leValue->setPlainText(m_variablesContainer->variable(m_variableName).toString());
|
||||||
#ifdef HAVE_QT5
|
#if QT_VERSION < 0x050000
|
||||||
ui->cbbType->setCurrentText(enumerator.valueToKey(m_variablesContainer->variableDataType(m_variableName)));
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_QT4
|
|
||||||
ui->cbbType->setCurrentIndex(ui->cbbType->findText(enumerator.valueToKey(m_variablesContainer->variableDataType(m_variableName))));
|
ui->cbbType->setCurrentIndex(ui->cbbType->findText(enumerator.valueToKey(m_variablesContainer->variableDataType(m_variableName))));
|
||||||
|
#else
|
||||||
|
ui->cbbType->setCurrentText(enumerator.valueToKey(m_variablesContainer->variableDataType(m_variableName)));
|
||||||
#endif
|
#endif
|
||||||
ui->cbbMandatory->setChecked(m_variablesContainer->variableIsMandatory(m_variableName));
|
ui->cbbMandatory->setChecked(m_variablesContainer->variableIsMandatory(m_variableName));
|
||||||
}
|
}
|
||||||
|
@ -55,12 +55,13 @@ FormResizer::FormResizer(QWidget *parent) :
|
|||||||
setBackgroundRole(QPalette::Base);
|
setBackgroundRole(QPalette::Base);
|
||||||
|
|
||||||
QVBoxLayout *handleLayout = new QVBoxLayout(this);
|
QVBoxLayout *handleLayout = new QVBoxLayout(this);
|
||||||
handleLayout->setMargin(SELECTION_MARGIN);
|
int margin = SELECTION_MARGIN;
|
||||||
|
handleLayout->setContentsMargins(margin, margin, margin, margin);
|
||||||
handleLayout->addWidget(m_frame);
|
handleLayout->addWidget(m_frame);
|
||||||
|
|
||||||
m_frame->setFrameStyle(QFrame::Panel | QFrame::Raised);
|
m_frame->setFrameStyle(QFrame::Panel | QFrame::Raised);
|
||||||
QVBoxLayout *layout = new QVBoxLayout(m_frame);
|
QVBoxLayout *layout = new QVBoxLayout(m_frame);
|
||||||
layout->setMargin(0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
// handles
|
// handles
|
||||||
m_handles.reserve(SizeHandleRect::Left);
|
m_handles.reserve(SizeHandleRect::Left);
|
||||||
for (int i = SizeHandleRect::LeftTop; i <= SizeHandleRect::Left; ++i) {
|
for (int i = SizeHandleRect::LeftTop; i <= SizeHandleRect::Left; ++i) {
|
||||||
|
@ -70,7 +70,7 @@ void WidgetHost::setFormWindow(QDesignerFormWindowInterface *fw)
|
|||||||
|
|
||||||
setBackgroundRole(QPalette::Base);
|
setBackgroundRole(QPalette::Base);
|
||||||
m_formWindow->setAutoFillBackground(true);
|
m_formWindow->setAutoFillBackground(true);
|
||||||
m_formWindow->setBackgroundRole(QPalette::Background);
|
m_formWindow->setBackgroundRole(QPalette::Window);
|
||||||
|
|
||||||
connect(m_formResizer, SIGNAL(formWindowSizeChanged(QRect, QRect)),
|
connect(m_formResizer, SIGNAL(formWindowSizeChanged(QRect, QRect)),
|
||||||
this, SLOT(fwSizeWasChanged(QRect, QRect)));
|
this, SLOT(fwSizeWasChanged(QRect, QRect)));
|
||||||
|
@ -104,10 +104,9 @@ DialogDesignerManager::DialogDesignerManager(QObject *parent) : QObject(parent)
|
|||||||
m_designerToolWindows.append(m_actionEditor);
|
m_designerToolWindows.append(m_actionEditor);
|
||||||
connect(m_actionEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
|
connect(m_actionEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
|
||||||
|
|
||||||
#ifdef HAVE_QT4
|
#if QT_VERSION < 0x050000
|
||||||
m_designerIntegration = new qdesigner_internal::QDesignerIntegration(m_formEditor,this);
|
m_designerIntegration = new qdesigner_internal::QDesignerIntegration(m_formEditor,this);
|
||||||
#endif
|
#else
|
||||||
#ifdef HAVE_QT5
|
|
||||||
m_designerIntegration = new QDesignerIntegration(m_formEditor,this);
|
m_designerIntegration = new QDesignerIntegration(m_formEditor,this);
|
||||||
#endif
|
#endif
|
||||||
m_formEditor->setIntegration(m_designerIntegration);
|
m_formEditor->setIntegration(m_designerIntegration);
|
||||||
|
@ -36,7 +36,7 @@ void HorizontalBarChart::paintHorizontalBars(QPainter *painter, QRectF barsRect)
|
|||||||
delta = genNextValue(delta);
|
delta = genNextValue(delta);
|
||||||
|
|
||||||
qreal vStep = (barsRect.height()-painter->fontMetrics().height()) / valuesCount() / seriesCount();
|
qreal vStep = (barsRect.height()-painter->fontMetrics().height()) / valuesCount() / seriesCount();
|
||||||
qreal hStep = (barsRect.width()-painter->fontMetrics().width(QString::number(maxValue()))) / delta;
|
qreal hStep = (barsRect.width()-painter->fontMetrics().boundingRect(QString::number(maxValue())).width()) / delta;
|
||||||
|
|
||||||
if (!m_chartItem->series().isEmpty() && (m_chartItem->itemMode() != DesignMode)){
|
if (!m_chartItem->series().isEmpty() && (m_chartItem->itemMode() != DesignMode)){
|
||||||
int curSeries = 0;
|
int curSeries = 0;
|
||||||
|
@ -8,13 +8,12 @@ void PieChart::drawPercent(QPainter *painter, QRectF chartRect, qreal startAngle
|
|||||||
|
|
||||||
QPointF center(chartRect.left()+chartRect.width()/2,chartRect.top()+chartRect.height()/2);
|
QPointF center(chartRect.left()+chartRect.width()/2,chartRect.top()+chartRect.height()/2);
|
||||||
qreal percent = angle/3.6;
|
qreal percent = angle/3.6;
|
||||||
#ifdef HAVE_QT4
|
#if QT_VERSION < 0x050000
|
||||||
qreal radAngle = (angle/2+startAngle)*(M_PI/180);
|
qreal radAngle = (angle/2+startAngle)*(M_PI/180);
|
||||||
#endif
|
#else
|
||||||
#ifdef HAVE_QT5
|
|
||||||
qreal radAngle = qDegreesToRadians(angle/2+startAngle);
|
qreal radAngle = qDegreesToRadians(angle/2+startAngle);
|
||||||
#endif
|
#endif
|
||||||
qreal radius = painter->fontMetrics().width("99,9%");
|
qreal radius = painter->fontMetrics().boundingRect("99,9%").width();
|
||||||
qreal border = chartRect.height()*0.02;
|
qreal border = chartRect.height()*0.02;
|
||||||
qreal length = (chartRect.height())/2-(radius/2+border);
|
qreal length = (chartRect.height())/2-(radius/2+border);
|
||||||
qreal x,y;
|
qreal x,y;
|
||||||
@ -155,14 +154,14 @@ QSizeF PieChart::calcChartLegendSize(const QFont &font)
|
|||||||
SeriesItem* si = m_chartItem->series().at(0);
|
SeriesItem* si = m_chartItem->series().at(0);
|
||||||
foreach(QString label, si->data()->labels()){
|
foreach(QString label, si->data()->labels()){
|
||||||
cw += fm.height();
|
cw += fm.height();
|
||||||
if (maxWidth<fm.width(label))
|
if (maxWidth<fm.boundingRect(label).width())
|
||||||
maxWidth = fm.width(label)+10;
|
maxWidth = fm.boundingRect(label).width()+10;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach(QString label, m_designLabels){
|
foreach(QString label, m_designLabels){
|
||||||
cw += fm.height();
|
cw += fm.height();
|
||||||
if (maxWidth<fm.width(label))
|
if (maxWidth<fm.boundingRect(label).width())
|
||||||
maxWidth = fm.width(label)+10;
|
maxWidth = fm.boundingRect(label).width()+10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cw += fm.height();
|
cw += fm.height();
|
||||||
|
@ -53,7 +53,7 @@ void ItemsBordersEditorWidget::properyChangedEvent(const QString& property, cons
|
|||||||
|
|
||||||
void ItemsBordersEditorWidget::noBordesClicked()
|
void ItemsBordersEditorWidget::noBordesClicked()
|
||||||
{
|
{
|
||||||
updateValues(0);
|
updateValues({});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemsBordersEditorWidget::allBordesClicked()
|
void ItemsBordersEditorWidget::allBordesClicked()
|
||||||
@ -148,7 +148,7 @@ void ItemsBordersEditorWidgetForDesigner::buttonClicked(bool)
|
|||||||
|
|
||||||
void ItemsBordersEditorWidgetForDesigner::noBordesClicked()
|
void ItemsBordersEditorWidgetForDesigner::noBordesClicked()
|
||||||
{
|
{
|
||||||
m_reportEditor->setBorders(0);
|
m_reportEditor->setBorders({});
|
||||||
ItemsBordersEditorWidget::noBordesClicked();
|
ItemsBordersEditorWidget::noBordesClicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ void TextAlignmentEditorWidget::updateValues(const Qt::Alignment &align)
|
|||||||
|
|
||||||
Qt::Alignment TextAlignmentEditorWidget::createAlignment()
|
Qt::Alignment TextAlignmentEditorWidget::createAlignment()
|
||||||
{
|
{
|
||||||
Qt::Alignment align = 0 ;
|
Qt::Alignment align = Qt::Alignment();
|
||||||
if (m_textAliginLeft->isChecked()) align |= Qt::AlignLeft;
|
if (m_textAliginLeft->isChecked()) align |= Qt::AlignLeft;
|
||||||
if (m_textAliginHCenter->isChecked()) align |= Qt::AlignHCenter;
|
if (m_textAliginHCenter->isChecked()) align |= Qt::AlignHCenter;
|
||||||
if (m_textAliginRight->isChecked()) align |= Qt::AlignRight;
|
if (m_textAliginRight->isChecked()) align |= Qt::AlignRight;
|
||||||
|
@ -30,9 +30,9 @@ namespace LimeReport{
|
|||||||
|
|
||||||
QColor generateColor()
|
QColor generateColor()
|
||||||
{
|
{
|
||||||
int red = (qrand()%(256 - 1)) + 1;
|
int red = (rand()%(256 - 1)) + 1;
|
||||||
int green = (qrand()%(256 - 1)) + 1;
|
int green = (rand()%(256 - 1)) + 1;
|
||||||
int blue = (qrand()%(256 - 1)) + 1;;
|
int blue = (rand()%(256 - 1)) + 1;;
|
||||||
return QColor(red,green,blue);
|
return QColor(red,green,blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ void ChartItem::paintChartTitle(QPainter *painter, QRectF titleRect)
|
|||||||
painter->save();
|
painter->save();
|
||||||
QFont tmpFont = painter->font();
|
QFont tmpFont = painter->font();
|
||||||
QFontMetrics fm(tmpFont);
|
QFontMetrics fm(tmpFont);
|
||||||
while ((fm.height()>titleRect.height() || fm.width(m_title)>titleRect.width())
|
while ((fm.height()>titleRect.height() || fm.boundingRect(m_title).width()>titleRect.width())
|
||||||
&& tmpFont.pixelSize()>1) {
|
&& tmpFont.pixelSize()>1) {
|
||||||
tmpFont.setPixelSize(tmpFont.pixelSize()-1);
|
tmpFont.setPixelSize(tmpFont.pixelSize()-1);
|
||||||
fm = QFontMetrics(tmpFont);
|
fm = QFontMetrics(tmpFont);
|
||||||
@ -570,14 +570,14 @@ QSizeF AbstractSeriesChart::calcChartLegendSize(const QFont &font)
|
|||||||
if (!m_chartItem->series().isEmpty()){
|
if (!m_chartItem->series().isEmpty()){
|
||||||
foreach(SeriesItem* series, m_chartItem->series()){
|
foreach(SeriesItem* series, m_chartItem->series()){
|
||||||
cw += fm.height();
|
cw += fm.height();
|
||||||
if (maxWidth<fm.width(series->name()))
|
if (maxWidth<fm.boundingRect(series->name()).width())
|
||||||
maxWidth = fm.width(series->name())+10;
|
maxWidth = fm.boundingRect(series->name()).width()+10;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach(QString label, m_designLabels){
|
foreach(QString label, m_designLabels){
|
||||||
cw += fm.height();
|
cw += fm.height();
|
||||||
if (maxWidth<fm.width(label))
|
if (maxWidth<fm.boundingRect(label).width())
|
||||||
maxWidth = fm.width(label)+10;
|
maxWidth = fm.boundingRect(label).width()+10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cw += fm.height();
|
cw += fm.height();
|
||||||
@ -591,7 +591,7 @@ bool AbstractSeriesChart::verticalLabels(QPainter* painter, QRectF labelsRect)
|
|||||||
qreal hStep = (labelsRect.width() / valuesCount());
|
qreal hStep = (labelsRect.width() / valuesCount());
|
||||||
QFontMetrics fm = painter->fontMetrics();
|
QFontMetrics fm = painter->fontMetrics();
|
||||||
foreach(QString label, m_chartItem->labels()){
|
foreach(QString label, m_chartItem->labels()){
|
||||||
if (fm.width(label) > hStep){
|
if (fm.boundingRect(label).width() > hStep){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -656,7 +656,7 @@ void AbstractSeriesChart::paintHorizontalGrid(QPainter *painter, QRectF gridRect
|
|||||||
delta = genNextValue(delta);
|
delta = genNextValue(delta);
|
||||||
|
|
||||||
painter->setRenderHint(QPainter::Antialiasing,false);
|
painter->setRenderHint(QPainter::Antialiasing,false);
|
||||||
qreal hStep = (gridRect.width() - painter->fontMetrics().width(QString::number(maxValue()))) / 4;
|
qreal hStep = (gridRect.width() - painter->fontMetrics().boundingRect(QString::number(maxValue())).width()) / 4;
|
||||||
|
|
||||||
painter->setFont(adaptValuesFont(hStep-4, painter->font()));
|
painter->setFont(adaptValuesFont(hStep-4, painter->font()));
|
||||||
|
|
||||||
@ -708,7 +708,7 @@ qreal AbstractSeriesChart::valuesHMargin(QPainter *painter)
|
|||||||
{
|
{
|
||||||
int delta = int(maxValue()-minValue());
|
int delta = int(maxValue()-minValue());
|
||||||
delta = genNextValue(delta);
|
delta = genNextValue(delta);
|
||||||
return painter->fontMetrics().width(QString::number(delta))+4;
|
return painter->fontMetrics().boundingRect(QString::number(delta)).width()+4;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal AbstractSeriesChart::valuesVMargin(QPainter *painter)
|
qreal AbstractSeriesChart::valuesVMargin(QPainter *painter)
|
||||||
@ -722,17 +722,21 @@ QFont AbstractSeriesChart::adaptLabelsFont(QRectF rect, QFont font)
|
|||||||
QFontMetrics fm(font);
|
QFontMetrics fm(font);
|
||||||
|
|
||||||
foreach(QString label, m_chartItem->labels()){
|
foreach(QString label, m_chartItem->labels()){
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
foreach (QString currentWord, label.split(QRegExp("\\W+"))){
|
foreach (QString currentWord, label.split(QRegExp("\\W+"))){
|
||||||
if (fm.width(maxWord) < fm.width(currentWord)) maxWord = currentWord;
|
#else
|
||||||
|
foreach (QString currentWord, label.split(QRegularExpression("\\W+"))){
|
||||||
|
#endif
|
||||||
|
if (fm.boundingRect(maxWord).width() < fm.boundingRect(currentWord).width()) maxWord = currentWord;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal curWidth = fm.width(maxWord);
|
qreal curWidth = fm.boundingRect(maxWord).width();
|
||||||
QFont tmpFont = font;
|
QFont tmpFont = font;
|
||||||
while (curWidth>rect.width() && tmpFont.pixelSize() > 1){
|
while (curWidth>rect.width() && tmpFont.pixelSize() > 1){
|
||||||
tmpFont.setPixelSize(tmpFont.pixelSize() - 1);
|
tmpFont.setPixelSize(tmpFont.pixelSize() - 1);
|
||||||
QFontMetricsF tmpFM(tmpFont);
|
QFontMetricsF tmpFM(tmpFont);
|
||||||
curWidth = tmpFM.width(maxWord);
|
curWidth = tmpFM.boundingRect(maxWord).width();
|
||||||
}
|
}
|
||||||
return tmpFont;
|
return tmpFont;
|
||||||
}
|
}
|
||||||
@ -742,11 +746,11 @@ QFont AbstractSeriesChart::adaptValuesFont(qreal width, QFont font)
|
|||||||
QString strValue = QString::number(maxValue());
|
QString strValue = QString::number(maxValue());
|
||||||
QFont tmpFont = font;
|
QFont tmpFont = font;
|
||||||
QScopedPointer<QFontMetricsF> fm(new QFontMetricsF(tmpFont));
|
QScopedPointer<QFontMetricsF> fm(new QFontMetricsF(tmpFont));
|
||||||
qreal curWidth = fm->width(strValue);
|
qreal curWidth = fm->boundingRect(strValue).width();
|
||||||
while (curWidth > width && tmpFont.pixelSize() > 1){
|
while (curWidth > width && tmpFont.pixelSize() > 1){
|
||||||
tmpFont.setPixelSize(tmpFont.pixelSize() - 1);
|
tmpFont.setPixelSize(tmpFont.pixelSize() - 1);
|
||||||
fm.reset(new QFontMetricsF(tmpFont));
|
fm.reset(new QFontMetricsF(tmpFont));
|
||||||
curWidth = fm->width(strValue);
|
curWidth = fm->boundingRect(strValue).width();
|
||||||
}
|
}
|
||||||
return tmpFont;
|
return tmpFont;
|
||||||
}
|
}
|
||||||
@ -803,8 +807,8 @@ QRectF AbstractBarChart::verticalLabelsRect(QPainter *painter, QRectF labelsRect
|
|||||||
qreal maxWidth = 0;
|
qreal maxWidth = 0;
|
||||||
|
|
||||||
foreach (QString label, m_chartItem->labels()) {
|
foreach (QString label, m_chartItem->labels()) {
|
||||||
if (painter->fontMetrics().width(label)>maxWidth)
|
if (painter->fontMetrics().boundingRect(label).width()>maxWidth)
|
||||||
maxWidth = painter->fontMetrics().width(label);
|
maxWidth = painter->fontMetrics().boundingRect(label).width();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxWidth + hPadding(m_chartItem->rect()) * 2 < labelsRect.width())
|
if (maxWidth + hPadding(m_chartItem->rect()) * 2 < labelsRect.width())
|
||||||
@ -818,8 +822,8 @@ QRectF AbstractBarChart::horizontalLabelsRect(QPainter *painter, QRectF labelsRe
|
|||||||
qreal maxWidth = 0;
|
qreal maxWidth = 0;
|
||||||
|
|
||||||
foreach (QString label, m_chartItem->labels()) {
|
foreach (QString label, m_chartItem->labels()) {
|
||||||
if (painter->fontMetrics().width(label)>maxWidth)
|
if (painter->fontMetrics().boundingRect(label).width()>maxWidth)
|
||||||
maxWidth = painter->fontMetrics().width(label);
|
maxWidth = painter->fontMetrics().boundingRect(label).width();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((maxWidth + vPadding(m_chartItem->rect()) < labelsRect.height()) || !verticalLabels(painter, labelsRect))
|
if ((maxWidth + vPadding(m_chartItem->rect()) < labelsRect.height()) || !verticalLabels(painter, labelsRect))
|
||||||
|
@ -10,7 +10,7 @@ ChartItemEditor::ChartItemEditor(LimeReport::ChartItem *item, LimeReport::PageDe
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
QHBoxLayout* colorLayout = new QHBoxLayout();
|
QHBoxLayout* colorLayout = new QHBoxLayout();
|
||||||
colorLayout->setMargin(0);
|
colorLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
m_colorButton = new QToolButton();
|
m_colorButton = new QToolButton();
|
||||||
m_colorButton->setText("...");
|
m_colorButton->setText("...");
|
||||||
m_colorButton->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
|
m_colorButton->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
|
||||||
@ -118,11 +118,10 @@ void ChartItemEditor::init()
|
|||||||
ui->seriesTypeComboBox->addItem(enumerator.key(i));
|
ui->seriesTypeComboBox->addItem(enumerator.key(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_QT5
|
#if QT_VERSION < 0x050000
|
||||||
ui->labelsFieldComboBox->setCurrentText(m_charItem->labelsField());
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_QT4
|
|
||||||
ui->labelsFieldComboBox->setCurrentIndex(ui->labelsFieldComboBox->findText( m_charItem->labelsField()));
|
ui->labelsFieldComboBox->setCurrentIndex(ui->labelsFieldComboBox->findText( m_charItem->labelsField()));
|
||||||
|
#else
|
||||||
|
ui->labelsFieldComboBox->setCurrentText(m_charItem->labelsField());
|
||||||
#endif
|
#endif
|
||||||
if (!m_charItem->series().isEmpty()){
|
if (!m_charItem->series().isEmpty()){
|
||||||
enableSeriesEditor();
|
enableSeriesEditor();
|
||||||
@ -150,11 +149,10 @@ void ChartItemEditor::disableSeriesEditor()
|
|||||||
ui->valuesFieldComboBox->setDisabled(true);
|
ui->valuesFieldComboBox->setDisabled(true);
|
||||||
m_colorButton->setDisabled(true);
|
m_colorButton->setDisabled(true);
|
||||||
m_colorIndicator->setDisabled(true);
|
m_colorIndicator->setDisabled(true);
|
||||||
#ifdef HAVE_QT5
|
#if QT_VERSION < 0x050000
|
||||||
ui->valuesFieldComboBox->setCurrentText("");
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_QT4
|
|
||||||
ui->valuesFieldComboBox->setEditText("");
|
ui->valuesFieldComboBox->setEditText("");
|
||||||
|
#else
|
||||||
|
ui->valuesFieldComboBox->setCurrentText("");
|
||||||
#endif
|
#endif
|
||||||
ui->seriesTypeComboBox->setDisabled(true);
|
ui->seriesTypeComboBox->setDisabled(true);
|
||||||
}
|
}
|
||||||
@ -208,11 +206,10 @@ void ChartItemEditor::slotAddSeries()
|
|||||||
ui->tableWidget->setRowCount(m_charItem->series().count());
|
ui->tableWidget->setRowCount(m_charItem->series().count());
|
||||||
ui->tableWidget->setItem(m_charItem->series().count()-1, 0, new QTableWidgetItem(series->name()));
|
ui->tableWidget->setItem(m_charItem->series().count()-1, 0, new QTableWidgetItem(series->name()));
|
||||||
ui->tableWidget->selectRow(m_charItem->series().count()-1);
|
ui->tableWidget->selectRow(m_charItem->series().count()-1);
|
||||||
#ifdef HAVE_QT5
|
#if QT_VERSION < 0x050000
|
||||||
ui->valuesFieldComboBox->setCurrentText("");
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_QT4
|
|
||||||
ui->valuesFieldComboBox->setEditText("");
|
ui->valuesFieldComboBox->setEditText("");
|
||||||
|
#else
|
||||||
|
ui->valuesFieldComboBox->setCurrentText("");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,20 +232,18 @@ void ChartItemEditor::on_tableWidget_itemSelectionChanged()
|
|||||||
if (ui->tableWidget->selectionModel()->hasSelection()){
|
if (ui->tableWidget->selectionModel()->hasSelection()){
|
||||||
LimeReport::SeriesItem* series = m_charItem->series().at(ui->tableWidget->selectionModel()->currentIndex().row());
|
LimeReport::SeriesItem* series = m_charItem->series().at(ui->tableWidget->selectionModel()->currentIndex().row());
|
||||||
ui->seriesNameLineEdit->setText(series->name());
|
ui->seriesNameLineEdit->setText(series->name());
|
||||||
#ifdef HAVE_QT5
|
#if QT_VERSION < 0x050000
|
||||||
ui->valuesFieldComboBox->setCurrentText(series->valuesColumn());
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_QT4
|
|
||||||
ui->valuesFieldComboBox->setCurrentIndex(ui->valuesFieldComboBox->findText(series->valuesColumn()));
|
ui->valuesFieldComboBox->setCurrentIndex(ui->valuesFieldComboBox->findText(series->valuesColumn()));
|
||||||
|
#else
|
||||||
|
ui->valuesFieldComboBox->setCurrentText(series->valuesColumn());
|
||||||
#endif
|
#endif
|
||||||
m_colorIndicator->setColor(series->color());
|
m_colorIndicator->setColor(series->color());
|
||||||
static int enumIndex = LimeReport::SeriesItem::staticMetaObject.indexOfEnumerator("SeriesItemPreferredType");
|
static int enumIndex = LimeReport::SeriesItem::staticMetaObject.indexOfEnumerator("SeriesItemPreferredType");
|
||||||
QMetaEnum enumerator = LimeReport::SeriesItem::staticMetaObject.enumerator(enumIndex);
|
QMetaEnum enumerator = LimeReport::SeriesItem::staticMetaObject.enumerator(enumIndex);
|
||||||
#ifdef HAVE_QT5
|
#if QT_VERSION < 0x050000
|
||||||
ui->seriesTypeComboBox->setCurrentText(enumerator.valueToKey(series->preferredType()));
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_QT4
|
|
||||||
ui->seriesTypeComboBox->setCurrentIndex(ui->seriesTypeComboBox->findText(enumerator.valueToKey(series->preferredType())));
|
ui->seriesTypeComboBox->setCurrentIndex(ui->seriesTypeComboBox->findText(enumerator.valueToKey(series->preferredType())));
|
||||||
|
#else
|
||||||
|
ui->seriesTypeComboBox->setCurrentText(enumerator.valueToKey(series->preferredType()));
|
||||||
#endif
|
#endif
|
||||||
enableSeriesEditor();
|
enableSeriesEditor();
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ void HorizontalLayout::setItemAlign(const BaseDesignIntf::ItemAlign &itemAlign)
|
|||||||
|
|
||||||
void HorizontalLayout::sortChildren()
|
void HorizontalLayout::sortChildren()
|
||||||
{
|
{
|
||||||
qSort(layoutsChildren().begin(),layoutsChildren().end(),horizontalLessThen);
|
std::sort(layoutsChildren().begin(),layoutsChildren().end(),horizontalLessThen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HorizontalLayout::updateLayoutSize()
|
void HorizontalLayout::updateLayoutSize()
|
||||||
@ -177,7 +177,7 @@ void HorizontalLayout::relocateChildren()
|
|||||||
layoutsChildren().append(item);
|
layoutsChildren().append(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qSort(layoutsChildren().begin(),layoutsChildren().end(),horizontalLessThen);
|
std::sort(layoutsChildren().begin(),layoutsChildren().end(),horizontalLessThen);
|
||||||
qreal curX = spaceBorder;
|
qreal curX = spaceBorder;
|
||||||
setIsRelocating(true);
|
setIsRelocating(true);
|
||||||
foreach (BaseDesignIntf* item, layoutsChildren()) {
|
foreach (BaseDesignIntf* item, layoutsChildren()) {
|
||||||
|
@ -63,7 +63,7 @@ void VerticalLayout::relocateChildren()
|
|||||||
layoutsChildren().append(item);
|
layoutsChildren().append(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qSort(layoutsChildren().begin(),layoutsChildren().end(), verticalLessThen);
|
std::sort(layoutsChildren().begin(),layoutsChildren().end(), verticalLessThen);
|
||||||
qreal curY = spaceBorder;
|
qreal curY = spaceBorder;
|
||||||
setIsRelocating(true);
|
setIsRelocating(true);
|
||||||
foreach (BaseDesignIntf* item, layoutsChildren()) {
|
foreach (BaseDesignIntf* item, layoutsChildren()) {
|
||||||
@ -140,7 +140,7 @@ BaseDesignIntf* VerticalLayout::cloneBottomPart(int height, QObject* owner, QGra
|
|||||||
|
|
||||||
void VerticalLayout::sortChildren()
|
void VerticalLayout::sortChildren()
|
||||||
{
|
{
|
||||||
qSort(layoutsChildren().begin(),layoutsChildren().end(),verticalLessThen);
|
std::sort(layoutsChildren().begin(),layoutsChildren().end(),verticalLessThen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerticalLayout::divideSpace()
|
void VerticalLayout::divideSpace()
|
||||||
|
@ -266,7 +266,7 @@ void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
|
|||||||
QFontMetrics fontMetrics(font);
|
QFontMetrics fontMetrics(font);
|
||||||
|
|
||||||
QVector<QRectF> bandNameRects;
|
QVector<QRectF> bandNameRects;
|
||||||
bandNameRects.push_back(QRectF(8,8,fontMetrics.width(" "+bandText+" "),fontMetrics.height()));
|
bandNameRects.push_back(QRectF(8,8,fontMetrics.boundingRect(" "+bandText+" ").width(),fontMetrics.height()));
|
||||||
//bandNameRects.push_back(QRectF(width()-fontMetrics.width(" "+bandText+" "),2,fontMetrics.width(" "+bandText+" "),fontMetrics.height()));
|
//bandNameRects.push_back(QRectF(width()-fontMetrics.width(" "+bandText+" "),2,fontMetrics.width(" "+bandText+" "),fontMetrics.height()));
|
||||||
//bandNameRects.push_back(QRectF(2,height()-fontMetrics.height(),fontMetrics.width(" "+bandText+" "),fontMetrics.height()));
|
//bandNameRects.push_back(QRectF(2,height()-fontMetrics.height(),fontMetrics.width(" "+bandText+" "),fontMetrics.height()));
|
||||||
//bandNameRects.push_back(QRectF(width()-fontMetrics.width(" "+bandText+" "),height()-fontMetrics.height(),fontMetrics.width(" "+bandText+" "),fontMetrics.height()));
|
//bandNameRects.push_back(QRectF(width()-fontMetrics.width(" "+bandText+" "),height()-fontMetrics.height(),fontMetrics.width(" "+bandText+" "),fontMetrics.height()));
|
||||||
@ -487,7 +487,7 @@ QList<BandDesignIntf *> BandDesignIntf::childrenByType(BandDesignIntf::BandsType
|
|||||||
foreach(BandDesignIntf* item,childBands()){
|
foreach(BandDesignIntf* item,childBands()){
|
||||||
if (item->bandType()==type) resList<<item;
|
if (item->bandType()==type) resList<<item;
|
||||||
}
|
}
|
||||||
qSort(resList.begin(),resList.end(),bandIndexLessThen);
|
std::sort(resList.begin(),resList.end(),bandIndexLessThen);
|
||||||
return resList;
|
return resList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1223,7 +1223,7 @@ void BandNameLabel::updateLabel(const QString& bandName)
|
|||||||
m_rect = QRectF(
|
m_rect = QRectF(
|
||||||
m_band->pos().x()+10,
|
m_band->pos().x()+10,
|
||||||
m_band->pos().y()-(fontMetrics.height()+10),
|
m_band->pos().y()-(fontMetrics.height()+10),
|
||||||
fontMetrics.width(bandName)+20,fontMetrics.height()+10
|
fontMetrics.boundingRect(bandName).width()+20,fontMetrics.height()+10
|
||||||
);
|
);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,11 @@ namespace Const{
|
|||||||
QString extractClassName(QString className);
|
QString extractClassName(QString className);
|
||||||
QString escapeSimbols(const QString& value);
|
QString escapeSimbols(const QString& value);
|
||||||
QString replaceHTMLSymbols(const QString &value);
|
QString replaceHTMLSymbols(const QString &value);
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
QVector<QString> normalizeCaptures(const QRegExp ®);
|
QVector<QString> normalizeCaptures(const QRegExp ®);
|
||||||
|
#else
|
||||||
|
QVector<QString> normalizeCaptures(const QRegularExpression ®);
|
||||||
|
#endif
|
||||||
bool isColorDark(QColor color);
|
bool isColorDark(QColor color);
|
||||||
|
|
||||||
enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
|
enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
|
||||||
@ -148,7 +152,7 @@ namespace Const{
|
|||||||
virtual ~IPainterProxy();
|
virtual ~IPainterProxy();
|
||||||
};
|
};
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
#if QT_VERSION < 0x050000
|
||||||
typedef QStyleOptionViewItemV4 StyleOptionViewItem;
|
typedef QStyleOptionViewItemV4 StyleOptionViewItem;
|
||||||
#else
|
#else
|
||||||
typedef QStyleOptionViewItem StyleOptionViewItem;
|
typedef QStyleOptionViewItem StyleOptionViewItem;
|
||||||
|
@ -35,7 +35,9 @@
|
|||||||
#include "lrglobal.h"
|
#include "lrglobal.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
|
#endif
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
namespace LimeReport{
|
namespace LimeReport{
|
||||||
|
@ -48,7 +48,7 @@ void ItemsContainerDesignInft::snapshotItemsLayout(SnapshotType type)
|
|||||||
} else
|
} else
|
||||||
m_containerItems.append(PItemSortContainer(new ItemSortContainer(childItem)));
|
m_containerItems.append(PItemSortContainer(new ItemSortContainer(childItem)));
|
||||||
}
|
}
|
||||||
qSort(m_containerItems.begin(),m_containerItems.end(),itemSortContainerLessThen);
|
std::sort(m_containerItems.begin(),m_containerItems.end(),itemSortContainerLessThen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemsContainerDesignInft::arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type)
|
void ItemsContainerDesignInft::arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type)
|
||||||
|
@ -1723,7 +1723,7 @@ HorizontalLayout* PageDesignIntf::internalAddHLayout()
|
|||||||
|
|
||||||
QList<QGraphicsItem *> si = selectedItems();
|
QList<QGraphicsItem *> si = selectedItems();
|
||||||
QList<QGraphicsItem *>::iterator it = si.begin();
|
QList<QGraphicsItem *>::iterator it = si.begin();
|
||||||
qSort(si.begin(), si.end(), hLayoutLessThen);
|
std::sort(si.begin(), si.end(), hLayoutLessThen);
|
||||||
it = si.begin();
|
it = si.begin();
|
||||||
|
|
||||||
if (si.count() > 1) {
|
if (si.count() > 1) {
|
||||||
@ -1767,7 +1767,7 @@ VerticalLayout* PageDesignIntf::internalAddVLayout()
|
|||||||
|
|
||||||
QList<QGraphicsItem *> si = selectedItems();
|
QList<QGraphicsItem *> si = selectedItems();
|
||||||
QList<QGraphicsItem *>::iterator it = si.begin();
|
QList<QGraphicsItem *>::iterator it = si.begin();
|
||||||
qSort(si.begin(), si.end(), vLayoutLessThen);
|
std::sort(si.begin(), si.end(), vLayoutLessThen);
|
||||||
it = si.begin();
|
it = si.begin();
|
||||||
|
|
||||||
if (si.count() > 1) {
|
if (si.count() > 1) {
|
||||||
|
@ -233,7 +233,7 @@ int PageItemDesignIntf::calcBandIndex(BandDesignIntf::BandsType bandType, BandDe
|
|||||||
groupFooterIgnoredBands << BandDesignIntf::DataFooter << BandDesignIntf::GroupHeader;
|
groupFooterIgnoredBands << BandDesignIntf::DataFooter << BandDesignIntf::GroupHeader;
|
||||||
|
|
||||||
int bandIndex = -1;
|
int bandIndex = -1;
|
||||||
qSort(m_bands.begin(), m_bands.end(), bandSortBandLessThenByIndex);
|
std::sort(m_bands.begin(), m_bands.end(), bandSortBandLessThenByIndex);
|
||||||
if (bandType != BandDesignIntf::Data){
|
if (bandType != BandDesignIntf::Data){
|
||||||
foreach(BandDesignIntf* band,m_bands){
|
foreach(BandDesignIntf* band,m_bands){
|
||||||
if ((band->bandType() == BandDesignIntf::GroupHeader) && ( band->bandType() > bandType)) break;
|
if ((band->bandType() == BandDesignIntf::GroupHeader) && ( band->bandType() > bandType)) break;
|
||||||
@ -547,7 +547,7 @@ void PageItemDesignIntf::relocateBands()
|
|||||||
|
|
||||||
QVector<qreal> posByColumn;
|
QVector<qreal> posByColumn;
|
||||||
|
|
||||||
qSort(m_bands.begin(), m_bands.end(), bandSortBandLessThenByIndex);
|
std::sort(m_bands.begin(), m_bands.end(), bandSortBandLessThenByIndex);
|
||||||
|
|
||||||
int bandIndex = 0;
|
int bandIndex = 0;
|
||||||
if (!(itemMode() & DesignMode)){
|
if (!(itemMode() & DesignMode)){
|
||||||
@ -623,7 +623,7 @@ int PageItemDesignIntf::dataBandCount()
|
|||||||
BandDesignIntf *PageItemDesignIntf::dataBandAt(int index)
|
BandDesignIntf *PageItemDesignIntf::dataBandAt(int index)
|
||||||
{
|
{
|
||||||
int count=0;
|
int count=0;
|
||||||
qSort(m_bands.begin(),m_bands.end(),bandSortBandLessThenByIndex);
|
std::sort(m_bands.begin(),m_bands.end(),bandSortBandLessThenByIndex);
|
||||||
foreach(BandDesignIntf* band,m_bands){
|
foreach(BandDesignIntf* band,m_bands){
|
||||||
if (band->bandType()==BandDesignIntf::Data){
|
if (band->bandType()==BandDesignIntf::Data){
|
||||||
if(count==index) return band;
|
if(count==index) return band;
|
||||||
@ -829,7 +829,7 @@ void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToS
|
|||||||
|
|
||||||
firstMoveBand->changeBandIndex(firstIndex, true);
|
firstMoveBand->changeBandIndex(firstIndex, true);
|
||||||
moveIndex = firstIndex;
|
moveIndex = firstIndex;
|
||||||
qSort(bandToMove.begin(), bandToMove.end(), bandIndexLessThen);
|
std::sort(bandToMove.begin(), bandToMove.end(), bandIndexLessThen);
|
||||||
|
|
||||||
foreach(BandDesignIntf* curBand, bandToMove){
|
foreach(BandDesignIntf* curBand, bandToMove){
|
||||||
curBand->changeBandIndex(moveIndex,true);
|
curBand->changeBandIndex(moveIndex,true);
|
||||||
@ -852,7 +852,7 @@ QList<BandDesignIntf*> PageItemDesignIntf::createBandGroup(int beginIndex, int e
|
|||||||
if ( curBand->bandIndex() >= beginIndex && curBand->bandIndex() <= endIndex)
|
if ( curBand->bandIndex() >= beginIndex && curBand->bandIndex() <= endIndex)
|
||||||
result.append(curBand);
|
result.append(curBand);
|
||||||
}
|
}
|
||||||
qSort(result.begin(), result.end(), bandIndexLessThen);
|
std::sort(result.begin(), result.end(), bandIndexLessThen);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ class PageItemDesignIntf : public ItemsContainerDesignInft
|
|||||||
Q_PROPERTY(bool mixWithPriorPage READ mixWithPriorPage WRITE setMixWithPriorPage)
|
Q_PROPERTY(bool mixWithPriorPage READ mixWithPriorPage WRITE setMixWithPriorPage)
|
||||||
friend class ReportRender;
|
friend class ReportRender;
|
||||||
public:
|
public:
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
enum Orientation { Portrait = QPrinter::Portrait, Landscape = QPrinter::Landscape };
|
enum Orientation { Portrait = QPrinter::Portrait, Landscape = QPrinter::Landscape };
|
||||||
|
|
||||||
enum PrintBehavior {Scale, Split};
|
enum PrintBehavior {Scale, Split};
|
||||||
@ -82,6 +83,25 @@ public:
|
|||||||
Ledger = QPrinter::Ledger, Tabloid = QPrinter::Tabloid, Custom = QPrinter::Custom,
|
Ledger = QPrinter::Ledger, Tabloid = QPrinter::Tabloid, Custom = QPrinter::Custom,
|
||||||
NPageSize = Custom
|
NPageSize = Custom
|
||||||
};
|
};
|
||||||
|
#else
|
||||||
|
enum Orientation { Portrait = QPageLayout::Portrait, Landscape = QPageLayout::Landscape };
|
||||||
|
|
||||||
|
enum PrintBehavior {Scale, Split};
|
||||||
|
|
||||||
|
enum PageSize {
|
||||||
|
A4 = QPageSize::A4, B5 = QPageSize::B5, Letter = QPageSize::Letter,
|
||||||
|
Legal = QPageSize::Legal, Executive = QPageSize::Executive,
|
||||||
|
A0 = QPageSize::A0, A1 = QPageSize::A1, A2 = QPageSize::A2, A3 = QPageSize::A3,
|
||||||
|
A5 = QPageSize::A5, A6 = QPageSize::A6, A7 = QPageSize::A7, A8 = QPageSize::A8,
|
||||||
|
A9 = QPageSize::A9, B0 = QPageSize::B0, B1 = QPageSize::B1, B10 = QPageSize::B10,
|
||||||
|
B2 = QPageSize::B2, B3 = QPageSize::B3, B4 = QPageSize::B4, B6 = QPageSize::B6,
|
||||||
|
B7 = QPageSize::B7, B8 = QPageSize::B8, B9 = QPageSize::B9, C5E = QPageSize::C5E,
|
||||||
|
Comm10E = QPageSize::Comm10E, DLE = QPageSize::DLE, Folio = QPageSize::Folio,
|
||||||
|
Ledger = QPageSize::Ledger, Tabloid = QPageSize::Tabloid, Custom = QPageSize::Custom,
|
||||||
|
NPageSize = Custom
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
|
||||||
Q_ENUM(Orientation)
|
Q_ENUM(Orientation)
|
||||||
Q_ENUM(PrintBehavior)
|
Q_ENUM(PrintBehavior)
|
||||||
|
@ -143,7 +143,11 @@ void PreviewReportWidget::initPreview()
|
|||||||
{
|
{
|
||||||
if (ui->graphicsView->scene()!=d_ptr->m_previewPage)
|
if (ui->graphicsView->scene()!=d_ptr->m_previewPage)
|
||||||
ui->graphicsView->setScene(d_ptr->m_previewPage);
|
ui->graphicsView->setScene(d_ptr->m_previewPage);
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
ui->graphicsView->resetMatrix();
|
ui->graphicsView->resetMatrix();
|
||||||
|
#else
|
||||||
|
ui->graphicsView->resetTransform();
|
||||||
|
#endif
|
||||||
ui->graphicsView->centerOn(0, 0);
|
ui->graphicsView->centerOn(0, 0);
|
||||||
ui->graphicsView->scene()->setBackgroundBrush(QColor(m_previewPageBackgroundColor));
|
ui->graphicsView->scene()->setBackgroundBrush(QColor(m_previewPageBackgroundColor));
|
||||||
setScalePercent(d_ptr->m_scalePercent);
|
setScalePercent(d_ptr->m_scalePercent);
|
||||||
@ -237,10 +241,9 @@ void PreviewReportWidget::print()
|
|||||||
QPrinter lp(QPrinter::HighResolution);
|
QPrinter lp(QPrinter::HighResolution);
|
||||||
|
|
||||||
if (!pi.defaultPrinter().isNull()){
|
if (!pi.defaultPrinter().isNull()){
|
||||||
#ifdef HAVE_QT4
|
#if QT_VERSION < 0x050000
|
||||||
lp.setPrinterName(pi.defaultPrinter().printerName());
|
lp.setPrinterName(pi.defaultPrinter().printerName());
|
||||||
#endif
|
#else
|
||||||
#ifdef HAVE_QT5
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
|
||||||
lp.setPrinterName(pi.defaultPrinterName());
|
lp.setPrinterName(pi.defaultPrinterName());
|
||||||
#else
|
#else
|
||||||
@ -300,7 +303,11 @@ void PreviewReportWidget::saveToFile()
|
|||||||
void PreviewReportWidget::setScalePercent(int percent)
|
void PreviewReportWidget::setScalePercent(int percent)
|
||||||
{
|
{
|
||||||
m_scaleChanging = true;
|
m_scaleChanging = true;
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
ui->graphicsView->resetMatrix();
|
ui->graphicsView->resetMatrix();
|
||||||
|
#else
|
||||||
|
ui->graphicsView->resetTransform();
|
||||||
|
#endif
|
||||||
d_ptr->m_scalePercent = percent;
|
d_ptr->m_scalePercent = percent;
|
||||||
qreal scaleSize = percent/100.0;
|
qreal scaleSize = percent/100.0;
|
||||||
ui->graphicsView->scale(scaleSize, scaleSize);
|
ui->graphicsView->scale(scaleSize, scaleSize);
|
||||||
@ -462,7 +469,11 @@ void PreviewReportWidget::reportEngineDestroyed(QObject *object)
|
|||||||
|
|
||||||
void PreviewReportWidget::slotZoomed(double )
|
void PreviewReportWidget::slotZoomed(double )
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
d_ptr->m_scalePercent = ui->graphicsView->matrix().m11()*100;
|
d_ptr->m_scalePercent = ui->graphicsView->matrix().m11()*100;
|
||||||
|
#else
|
||||||
|
d_ptr->m_scalePercent = ui->graphicsView->transform().m11()*100;
|
||||||
|
#endif
|
||||||
emit scalePercentChanged(d_ptr->m_scalePercent);
|
emit scalePercentChanged(d_ptr->m_scalePercent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,11 @@
|
|||||||
#include <QPrintDialog>
|
#include <QPrintDialog>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
#else
|
||||||
|
#include <QScreen>
|
||||||
|
#endif
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
@ -57,7 +61,7 @@ PreviewReportWindow::PreviewReportWindow(ReportEngine *report, QWidget *parent,
|
|||||||
|
|
||||||
m_progressWidget = new QWidget(ui->statusbar);
|
m_progressWidget = new QWidget(ui->statusbar);
|
||||||
QHBoxLayout* progressLayout = new QHBoxLayout();
|
QHBoxLayout* progressLayout = new QHBoxLayout();
|
||||||
progressLayout->setMargin(0);
|
progressLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
progressLayout->addWidget(new QLabel(tr("Printing")));
|
progressLayout->addWidget(new QLabel(tr("Printing")));
|
||||||
m_progressBar = new QProgressBar(ui->statusbar);
|
m_progressBar = new QProgressBar(ui->statusbar);
|
||||||
m_progressBar->setMaximumWidth(100);
|
m_progressBar->setMaximumWidth(100);
|
||||||
@ -139,11 +143,17 @@ void PreviewReportWindow::restoreSetting()
|
|||||||
if (v.isValid()){
|
if (v.isValid()){
|
||||||
restoreGeometry(v.toByteArray());
|
restoreGeometry(v.toByteArray());
|
||||||
} else {
|
} else {
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
QDesktopWidget *desktop = QApplication::desktop();
|
QDesktopWidget *desktop = QApplication::desktop();
|
||||||
|
|
||||||
int screenWidth = desktop->screenGeometry().width();
|
int screenWidth = desktop->screenGeometry().width();
|
||||||
int screenHeight = desktop->screenGeometry().height();
|
int screenHeight = desktop->screenGeometry().height();
|
||||||
|
#else
|
||||||
|
QScreen *screen = QGuiApplication::primaryScreen();
|
||||||
|
|
||||||
|
int screenWidth = screen->geometry().width();
|
||||||
|
int screenHeight = screen->geometry().height();
|
||||||
|
#endif
|
||||||
int x = static_cast<int>(screenWidth*0.1);
|
int x = static_cast<int>(screenWidth*0.1);
|
||||||
int y = static_cast<int>(screenHeight*0.1);
|
int y = static_cast<int>(screenHeight*0.1);
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class PreviewReportWindow : public QMainWindow
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit PreviewReportWindow(ReportEngine *report, QWidget *parent = 0, QSettings* settings=0, Qt::WindowFlags flags=0);
|
explicit PreviewReportWindow(ReportEngine *report, QWidget *parent = 0, QSettings* settings=0, Qt::WindowFlags flags=Qt::WindowFlags());
|
||||||
~PreviewReportWindow();
|
~PreviewReportWindow();
|
||||||
void setReportReader(ItemsReaderIntf::Ptr reader);
|
void setReportReader(ItemsReaderIntf::Ptr reader);
|
||||||
void setPages(ReportPages pages);
|
void setPages(ReportPages pages);
|
||||||
|
@ -59,10 +59,9 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivateInterface* report, QSe
|
|||||||
m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false),
|
m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false),
|
||||||
m_dialogChanged(false), m_theme("Default"), m_settings(settings), m_defaultUnits(BaseDesignIntf::Millimeters)
|
m_dialogChanged(false), m_theme("Default"), m_settings(settings), m_defaultUnits(BaseDesignIntf::Millimeters)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_QT4
|
#if QT_VERSION < 0x050000
|
||||||
m_tabWidget = new LimeReportTabWidget(this);
|
m_tabWidget = new LimeReportTabWidget(this);
|
||||||
#endif
|
#else
|
||||||
#ifdef HAVE_QT5
|
|
||||||
m_tabWidget = new QTabWidget(this);
|
m_tabWidget = new QTabWidget(this);
|
||||||
#endif
|
#endif
|
||||||
m_tabWidget->setTabPosition(QTabWidget::South);
|
m_tabWidget->setTabPosition(QTabWidget::South);
|
||||||
@ -1132,10 +1131,10 @@ void Ruler::setPage(PageItemDesignIntf *page)
|
|||||||
|
|
||||||
void Ruler::paintEvent(QPaintEvent *event){
|
void Ruler::paintEvent(QPaintEvent *event){
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
painter.setBrush(palette().background());
|
painter.setBrush(palette().window());
|
||||||
painter.setPen(Qt::NoPen);
|
painter.setPen(Qt::NoPen);
|
||||||
painter.drawRect(event->rect());
|
painter.drawRect(event->rect());
|
||||||
// painter.setPen(palette().foreground().color());
|
// painter.setPen(palette().windowText().color());
|
||||||
|
|
||||||
if (m_page){
|
if (m_page){
|
||||||
qreal rulerWidth = m_page->geometry().width() / m_page->unitFactor();
|
qreal rulerWidth = m_page->geometry().width() / m_page->unitFactor();
|
||||||
@ -1154,13 +1153,13 @@ void Ruler::paintEvent(QPaintEvent *event){
|
|||||||
case Horizontal:
|
case Horizontal:
|
||||||
painter.setPen(Qt::NoPen);
|
painter.setPen(Qt::NoPen);
|
||||||
|
|
||||||
if (isColorDark(palette().background().color()))
|
if (isColorDark(palette().window().color()))
|
||||||
painter.setBrush(QColor("#64893d"));
|
painter.setBrush(QColor("#64893d"));
|
||||||
else
|
else
|
||||||
painter.setBrush(QColor("#b5da91"));
|
painter.setBrush(QColor("#b5da91"));
|
||||||
|
|
||||||
drawItemWithChildren(&painter, m_page);
|
drawItemWithChildren(&painter, m_page);
|
||||||
painter.setPen(palette().foreground().color());
|
painter.setPen(palette().windowText().color());
|
||||||
|
|
||||||
for (int i = 0; i < rulerWidth / 10; ++i){
|
for (int i = 0; i < rulerWidth / 10; ++i){
|
||||||
int hs10 = view->mapFromScene(QPointF(m_page->geometry().topLeft().x() + i * 10 * m_page->unitFactor(), 0)).x();
|
int hs10 = view->mapFromScene(QPointF(m_page->geometry().topLeft().x() + i * 10 * m_page->unitFactor(), 0)).x();
|
||||||
@ -1173,24 +1172,24 @@ void Ruler::paintEvent(QPaintEvent *event){
|
|||||||
painter.drawLine(hs10, 15, hs10, 20);
|
painter.drawLine(hs10, 15, hs10, 20);
|
||||||
painter.drawLine(hs5, 10, hs5, 20);
|
painter.drawLine(hs5, 10, hs5, 20);
|
||||||
if ( i > 0)
|
if ( i > 0)
|
||||||
painter.drawText(QPoint(hs10 - (painter.fontMetrics().width(QString::number(i))/2), 12),
|
painter.drawText(QPoint(hs10 - (painter.fontMetrics().boundingRect(QString::number(i)).width()/2), 12),
|
||||||
QString::number(i));
|
QString::number(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
painter.setPen(palette().foreground().color());
|
painter.setPen(palette().windowText().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;
|
||||||
case Vertical:
|
case Vertical:
|
||||||
painter.setPen(Qt::NoPen);
|
painter.setPen(Qt::NoPen);
|
||||||
|
|
||||||
if (isColorDark(palette().background().color()))
|
if (isColorDark(palette().window().color()))
|
||||||
painter.setBrush(QColor("#64893d"));
|
painter.setBrush(QColor("#64893d"));
|
||||||
else
|
else
|
||||||
painter.setBrush(QColor("#b5da91"));
|
painter.setBrush(QColor("#b5da91"));
|
||||||
|
|
||||||
drawItemWithChildren(&painter, m_page);
|
drawItemWithChildren(&painter, m_page);
|
||||||
painter.setPen(palette().foreground().color());
|
painter.setPen(palette().windowText().color());
|
||||||
for (int i = 0; i < rulerHeight / 10; ++i){
|
for (int i = 0; i < rulerHeight / 10; ++i){
|
||||||
int vs10 = view->mapFromScene(QPointF(0, m_page->geometry().topLeft().y()+i * 10 * m_page->unitFactor())).y();
|
int vs10 = view->mapFromScene(QPointF(0, m_page->geometry().topLeft().y()+i * 10 * m_page->unitFactor())).y();
|
||||||
int vs5 = view->mapFromScene(QPointF(0, m_page->geometry().topLeft().y()+i * 10 * m_page->unitFactor() + 5 * m_page->unitFactor())).y();
|
int vs5 = view->mapFromScene(QPointF(0, m_page->geometry().topLeft().y()+i * 10 * m_page->unitFactor() + 5 * m_page->unitFactor())).y();
|
||||||
@ -1201,12 +1200,12 @@ void Ruler::paintEvent(QPaintEvent *event){
|
|||||||
}
|
}
|
||||||
painter.drawLine(15, vs10, 20, vs10);
|
painter.drawLine(15, vs10, 20, vs10);
|
||||||
if ( i > 0 )
|
if ( i > 0 )
|
||||||
painter.drawText(QPoint( (15 - painter.fontMetrics().width(QString::number(i))) / 2 ,
|
painter.drawText(QPoint( (15 - painter.fontMetrics().boundingRect(QString::number(i)).width()) / 2 ,
|
||||||
vs10 + (painter.fontMetrics().height()/2)), QString::number(i));
|
vs10 + (painter.fontMetrics().height()/2)), QString::number(i));
|
||||||
painter.drawLine(10, vs5, 20, vs5);
|
painter.drawLine(10, vs5, 20, vs5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
painter.setPen(palette().foreground().color());
|
painter.setPen(palette().windowText().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;
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include "lrreportengine_p.h"
|
#include "lrreportengine_p.h"
|
||||||
#include "lrgraphicsviewzoom.h"
|
#include "lrgraphicsviewzoom.h"
|
||||||
|
|
||||||
#ifdef HAVE_QT4
|
#if QT_VERSION < 0x050000
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class LimeReportTabWidget: public QTabWidget{
|
class LimeReportTabWidget: public QTabWidget{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -259,10 +259,9 @@ private:
|
|||||||
DialogDesignerManager* m_dialogDesignerManager;
|
DialogDesignerManager* m_dialogDesignerManager;
|
||||||
#endif
|
#endif
|
||||||
QMainWindow *m_mainWindow;
|
QMainWindow *m_mainWindow;
|
||||||
#ifdef HAVE_QT4
|
#if QT_VERSION < 0x050000
|
||||||
LimeReportTabWidget* m_tabWidget;
|
LimeReportTabWidget* m_tabWidget;
|
||||||
#endif
|
#else
|
||||||
#ifdef HAVE_QT5
|
|
||||||
QTabWidget* m_tabWidget;
|
QTabWidget* m_tabWidget;
|
||||||
#endif
|
#endif
|
||||||
GraphicsViewZoomer* m_zoomer;
|
GraphicsViewZoomer* m_zoomer;
|
||||||
|
@ -39,7 +39,11 @@
|
|||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
#else
|
||||||
|
#include <QScreen>
|
||||||
|
#endif
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
@ -69,7 +73,7 @@ void ReportDesignWindow::createProgressBar()
|
|||||||
{
|
{
|
||||||
m_progressWidget = new QWidget(m_statusBar);
|
m_progressWidget = new QWidget(m_statusBar);
|
||||||
QHBoxLayout* progressLayout = new QHBoxLayout();
|
QHBoxLayout* progressLayout = new QHBoxLayout();
|
||||||
progressLayout->setMargin(0);
|
progressLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
m_progressLabel = new QLabel(tr("Rendered %1 pages").arg(0));
|
m_progressLabel = new QLabel(tr("Rendered %1 pages").arg(0));
|
||||||
progressLayout->addWidget(m_progressLabel);
|
progressLayout->addWidget(m_progressLabel);
|
||||||
m_progressBar = new QProgressBar(m_statusBar);
|
m_progressBar = new QProgressBar(m_statusBar);
|
||||||
@ -149,7 +153,7 @@ void ReportDesignWindow::createActions()
|
|||||||
{
|
{
|
||||||
m_newReportAction = new QAction(tr("New Report"),this);
|
m_newReportAction = new QAction(tr("New Report"),this);
|
||||||
m_newReportAction->setIcon(QIcon(":/report/images/newReport"));
|
m_newReportAction->setIcon(QIcon(":/report/images/newReport"));
|
||||||
m_newReportAction->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_N));
|
m_newReportAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_N));
|
||||||
connect(m_newReportAction,SIGNAL(triggered()),this,SLOT(slotNewReport()));
|
connect(m_newReportAction,SIGNAL(triggered()),this,SLOT(slotNewReport()));
|
||||||
|
|
||||||
m_newPageAction = new QAction(tr("New Report Page"),this);
|
m_newPageAction = new QAction(tr("New Report Page"),this);
|
||||||
@ -171,28 +175,28 @@ void ReportDesignWindow::createActions()
|
|||||||
m_undoAction = new QAction(tr("Undo"),this);
|
m_undoAction = new QAction(tr("Undo"),this);
|
||||||
m_undoAction->setIcon(QIcon(":/report/images/undo"));
|
m_undoAction->setIcon(QIcon(":/report/images/undo"));
|
||||||
m_undoAction->setEnabled(false);
|
m_undoAction->setEnabled(false);
|
||||||
m_undoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
|
m_undoAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Z));
|
||||||
connect(m_undoAction,SIGNAL(triggered()),this,SLOT(slotUndo()));
|
connect(m_undoAction,SIGNAL(triggered()),this,SLOT(slotUndo()));
|
||||||
|
|
||||||
m_redoAction = new QAction(tr("Redo"),this);
|
m_redoAction = new QAction(tr("Redo"),this);
|
||||||
m_redoAction->setIcon(QIcon(":/report/images/redo"));
|
m_redoAction->setIcon(QIcon(":/report/images/redo"));
|
||||||
m_redoAction->setEnabled(false);
|
m_redoAction->setEnabled(false);
|
||||||
m_redoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z));
|
m_redoAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Z));
|
||||||
connect(m_redoAction,SIGNAL(triggered()),this,SLOT(slotRedo()));
|
connect(m_redoAction,SIGNAL(triggered()),this,SLOT(slotRedo()));
|
||||||
|
|
||||||
m_copyAction = new QAction(tr("Copy"),this);
|
m_copyAction = new QAction(tr("Copy"),this);
|
||||||
m_copyAction->setIcon(QIcon(":/report/images/copy"));
|
m_copyAction->setIcon(QIcon(":/report/images/copy"));
|
||||||
m_copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
|
m_copyAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_C));
|
||||||
connect(m_copyAction,SIGNAL(triggered()),this,SLOT(slotCopy()));
|
connect(m_copyAction,SIGNAL(triggered()),this,SLOT(slotCopy()));
|
||||||
|
|
||||||
m_pasteAction = new QAction(tr("Paste"),this);
|
m_pasteAction = new QAction(tr("Paste"),this);
|
||||||
m_pasteAction->setIcon(QIcon(":/report/images/paste"));
|
m_pasteAction->setIcon(QIcon(":/report/images/paste"));
|
||||||
m_pasteAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));
|
m_pasteAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_V));
|
||||||
connect(m_pasteAction,SIGNAL(triggered()),this,SLOT(slotPaste()));
|
connect(m_pasteAction,SIGNAL(triggered()),this,SLOT(slotPaste()));
|
||||||
|
|
||||||
m_cutAction = new QAction(tr("Cut"),this);
|
m_cutAction = new QAction(tr("Cut"),this);
|
||||||
m_cutAction->setIcon(QIcon(":/report/images/cut"));
|
m_cutAction->setIcon(QIcon(":/report/images/cut"));
|
||||||
m_cutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
|
m_cutAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_X));
|
||||||
connect(m_cutAction,SIGNAL(triggered()),this,SLOT(slotCut()));
|
connect(m_cutAction,SIGNAL(triggered()),this,SLOT(slotCut()));
|
||||||
|
|
||||||
m_settingsAction = new QAction(tr("Settings"),this);
|
m_settingsAction = new QAction(tr("Settings"),this);
|
||||||
@ -202,13 +206,13 @@ void ReportDesignWindow::createActions()
|
|||||||
m_useGridAction = new QAction(tr("Use grid"),this);
|
m_useGridAction = new QAction(tr("Use grid"),this);
|
||||||
m_useGridAction->setIcon(QIcon(":/report/images/grid"));
|
m_useGridAction->setIcon(QIcon(":/report/images/grid"));
|
||||||
m_useGridAction->setCheckable(true);
|
m_useGridAction->setCheckable(true);
|
||||||
m_useGridAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G));
|
m_useGridAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_G));
|
||||||
connect(m_useGridAction,SIGNAL(toggled(bool)),this,SLOT(slotUseGrid(bool)));
|
connect(m_useGridAction,SIGNAL(toggled(bool)),this,SLOT(slotUseGrid(bool)));
|
||||||
|
|
||||||
m_useMagnetAction = new QAction(tr("Use magnet"),this);
|
m_useMagnetAction = new QAction(tr("Use magnet"),this);
|
||||||
m_useMagnetAction->setIcon(QIcon(":/report/images/magnet"));
|
m_useMagnetAction->setIcon(QIcon(":/report/images/magnet"));
|
||||||
m_useMagnetAction->setCheckable(true);
|
m_useMagnetAction->setCheckable(true);
|
||||||
m_useMagnetAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
|
m_useMagnetAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_M));
|
||||||
connect(m_useMagnetAction,SIGNAL(toggled(bool)),this,SLOT(slotUseMagnet(bool)));
|
connect(m_useMagnetAction,SIGNAL(toggled(bool)),this,SLOT(slotUseMagnet(bool)));
|
||||||
|
|
||||||
|
|
||||||
@ -219,17 +223,17 @@ void ReportDesignWindow::createActions()
|
|||||||
|
|
||||||
m_saveReportAction = new QAction(tr("Save Report"),this);
|
m_saveReportAction = new QAction(tr("Save Report"),this);
|
||||||
m_saveReportAction->setIcon(QIcon(":/report/images/save"));
|
m_saveReportAction->setIcon(QIcon(":/report/images/save"));
|
||||||
m_saveReportAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
|
m_saveReportAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_S));
|
||||||
connect(m_saveReportAction,SIGNAL(triggered()),this,SLOT(slotSaveReport()));
|
connect(m_saveReportAction,SIGNAL(triggered()),this,SLOT(slotSaveReport()));
|
||||||
|
|
||||||
m_saveReportAsAction = new QAction(tr("Save Report As"),this);
|
m_saveReportAsAction = new QAction(tr("Save Report As"),this);
|
||||||
m_saveReportAsAction->setIcon(QIcon(":/report/images/saveas"));
|
m_saveReportAsAction->setIcon(QIcon(":/report/images/saveas"));
|
||||||
m_saveReportAsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S));
|
m_saveReportAsAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_S));
|
||||||
connect(m_saveReportAsAction,SIGNAL(triggered()),this,SLOT(slotSaveReportAs()));
|
connect(m_saveReportAsAction,SIGNAL(triggered()),this,SLOT(slotSaveReportAs()));
|
||||||
|
|
||||||
m_loadReportAction = new QAction(tr("Load Report"),this);
|
m_loadReportAction = new QAction(tr("Load Report"),this);
|
||||||
m_loadReportAction->setIcon(QIcon(":/report/images/folder"));
|
m_loadReportAction->setIcon(QIcon(":/report/images/folder"));
|
||||||
m_loadReportAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
|
m_loadReportAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_O));
|
||||||
connect(m_loadReportAction,SIGNAL(triggered()),this,SLOT(slotLoadReport()));
|
connect(m_loadReportAction,SIGNAL(triggered()),this,SLOT(slotLoadReport()));
|
||||||
|
|
||||||
m_deleteItemAction = new QAction(tr("Delete item"),this);
|
m_deleteItemAction = new QAction(tr("Delete item"),this);
|
||||||
@ -247,7 +251,7 @@ void ReportDesignWindow::createActions()
|
|||||||
|
|
||||||
m_previewReportAction = new QAction(tr("Render Report"),this);
|
m_previewReportAction = new QAction(tr("Render Report"),this);
|
||||||
m_previewReportAction->setIcon(QIcon(":/report/images/render"));
|
m_previewReportAction->setIcon(QIcon(":/report/images/render"));
|
||||||
m_previewReportAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P));
|
m_previewReportAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_P));
|
||||||
connect(m_previewReportAction,SIGNAL(triggered()),this,SLOT(slotPreviewReport()));
|
connect(m_previewReportAction,SIGNAL(triggered()),this,SLOT(slotPreviewReport()));
|
||||||
|
|
||||||
m_testAction = new QAction("test",this);
|
m_testAction = new QAction("test",this);
|
||||||
@ -274,13 +278,13 @@ void ReportDesignWindow::createActions()
|
|||||||
m_hideLeftPanel = new QAction(tr("Hide left panel | Alt+L"),this);
|
m_hideLeftPanel = new QAction(tr("Hide left panel | Alt+L"),this);
|
||||||
m_hideLeftPanel->setCheckable(true);
|
m_hideLeftPanel->setCheckable(true);
|
||||||
m_hideLeftPanel->setIcon(QIcon(":/report/images/hideLeftPanel"));
|
m_hideLeftPanel->setIcon(QIcon(":/report/images/hideLeftPanel"));
|
||||||
m_hideLeftPanel->setShortcut(QKeySequence(Qt::ALT + Qt::Key_L));
|
m_hideLeftPanel->setShortcut(QKeySequence(Qt::ALT | Qt::Key_L));
|
||||||
connect(m_hideLeftPanel,SIGNAL(toggled(bool)), this, SLOT(slotHideLeftPanel(bool)));
|
connect(m_hideLeftPanel,SIGNAL(toggled(bool)), this, SLOT(slotHideLeftPanel(bool)));
|
||||||
|
|
||||||
m_hideRightPanel = new QAction(tr("Hide right panel | Alt+R"),this);
|
m_hideRightPanel = new QAction(tr("Hide right panel | Alt+R"),this);
|
||||||
m_hideRightPanel->setCheckable(true);
|
m_hideRightPanel->setCheckable(true);
|
||||||
m_hideRightPanel->setIcon(QIcon(":/report/images/hideRightPanel"));
|
m_hideRightPanel->setIcon(QIcon(":/report/images/hideRightPanel"));
|
||||||
m_hideRightPanel->setShortcut(QKeySequence(Qt::ALT + Qt::Key_R));
|
m_hideRightPanel->setShortcut(QKeySequence(Qt::ALT | Qt::Key_R));
|
||||||
connect(m_hideRightPanel,SIGNAL(toggled(bool)), this, SLOT(slotHideRightPanel(bool)));
|
connect(m_hideRightPanel,SIGNAL(toggled(bool)), this, SLOT(slotHideRightPanel(bool)));
|
||||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||||
m_deleteDialogAction = new QAction(tr("Delete dialog"), this);
|
m_deleteDialogAction = new QAction(tr("Delete dialog"), this);
|
||||||
@ -294,19 +298,19 @@ void ReportDesignWindow::createActions()
|
|||||||
|
|
||||||
m_lockSelectedItemsAction = new QAction(tr("Lock selected items"), this);
|
m_lockSelectedItemsAction = new QAction(tr("Lock selected items"), this);
|
||||||
m_lockSelectedItemsAction->setIcon(QIcon(":/report/images/lock"));
|
m_lockSelectedItemsAction->setIcon(QIcon(":/report/images/lock"));
|
||||||
m_lockSelectedItemsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
|
m_lockSelectedItemsAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_L));
|
||||||
connect(m_lockSelectedItemsAction, SIGNAL(triggered()),
|
connect(m_lockSelectedItemsAction, SIGNAL(triggered()),
|
||||||
this, SLOT(slotLockSelectedItems()));
|
this, SLOT(slotLockSelectedItems()));
|
||||||
|
|
||||||
m_unlockSelectedItemsAction = new QAction(tr("Unlock selected items"), this);
|
m_unlockSelectedItemsAction = new QAction(tr("Unlock selected items"), this);
|
||||||
m_unlockSelectedItemsAction->setIcon(QIcon(":/report/images/unlock"));
|
m_unlockSelectedItemsAction->setIcon(QIcon(":/report/images/unlock"));
|
||||||
m_unlockSelectedItemsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_L));
|
m_unlockSelectedItemsAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_L));
|
||||||
connect(m_unlockSelectedItemsAction, SIGNAL(triggered()),
|
connect(m_unlockSelectedItemsAction, SIGNAL(triggered()),
|
||||||
this, SLOT(slotUnlockSelectedItems()));
|
this, SLOT(slotUnlockSelectedItems()));
|
||||||
|
|
||||||
m_selectOneLevelItems = new QAction(tr("Select one level items"), this);
|
m_selectOneLevelItems = new QAction(tr("Select one level items"), this);
|
||||||
//m_unlockSelectedItemsAction->setIcon(QIcon(":/report/images/unlock"));
|
//m_unlockSelectedItemsAction->setIcon(QIcon(":/report/images/unlock"));
|
||||||
m_selectOneLevelItems->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
|
m_selectOneLevelItems->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_A));
|
||||||
connect(m_selectOneLevelItems, SIGNAL(triggered()),
|
connect(m_selectOneLevelItems, SIGNAL(triggered()),
|
||||||
this, SLOT(slotSelectOneLevelItems()));
|
this, SLOT(slotSelectOneLevelItems()));
|
||||||
}
|
}
|
||||||
@ -567,7 +571,7 @@ void ReportDesignWindow::createObjectInspector()
|
|||||||
QWidget* w = new QWidget(objectDoc);
|
QWidget* w = new QWidget(objectDoc);
|
||||||
QVBoxLayout* l = new QVBoxLayout(w);
|
QVBoxLayout* l = new QVBoxLayout(w);
|
||||||
l->addWidget(m_objectInspector);
|
l->addWidget(m_objectInspector);
|
||||||
l->setMargin(0);
|
l->setContentsMargins(0, 0, 0, 0);
|
||||||
w->setLayout(l);
|
w->setLayout(l);
|
||||||
objectDoc->setWindowTitle(tr("Object Inspector"));
|
objectDoc->setWindowTitle(tr("Object Inspector"));
|
||||||
objectDoc->setWidget(w);
|
objectDoc->setWidget(w);
|
||||||
@ -833,11 +837,18 @@ void ReportDesignWindow::restoreSetting()
|
|||||||
if (v.isValid()){
|
if (v.isValid()){
|
||||||
restoreGeometry(v.toByteArray());
|
restoreGeometry(v.toByteArray());
|
||||||
} else {
|
} else {
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
QDesktopWidget *desktop = QApplication::desktop();
|
QDesktopWidget *desktop = QApplication::desktop();
|
||||||
|
|
||||||
int screenWidth = desktop->screenGeometry().width();
|
int screenWidth = desktop->screenGeometry().width();
|
||||||
int screenHeight = desktop->screenGeometry().height();
|
int screenHeight = desktop->screenGeometry().height();
|
||||||
|
|
||||||
|
#else
|
||||||
|
QScreen *screen = QGuiApplication::primaryScreen();
|
||||||
|
|
||||||
|
int screenWidth = screen->geometry().width();
|
||||||
|
int screenHeight = screen->geometry().height();
|
||||||
|
#endif
|
||||||
int x = screenWidth * 0.1;
|
int x = screenWidth * 0.1;
|
||||||
int y = screenHeight * 0.1;
|
int y = screenHeight * 0.1;
|
||||||
|
|
||||||
|
@ -32,7 +32,11 @@
|
|||||||
#include <QPrinterInfo>
|
#include <QPrinterInfo>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
#else
|
||||||
|
#include <QScreen>
|
||||||
|
#endif
|
||||||
#include <QFileSystemWatcher>
|
#include <QFileSystemWatcher>
|
||||||
#include <QPluginLoader>
|
#include <QPluginLoader>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
@ -272,10 +276,9 @@ bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer)
|
|||||||
if (!printer&&!m_printerSelected){
|
if (!printer&&!m_printerSelected){
|
||||||
QPrinterInfo pi;
|
QPrinterInfo pi;
|
||||||
if (!pi.defaultPrinter().isNull())
|
if (!pi.defaultPrinter().isNull())
|
||||||
#ifdef HAVE_QT4
|
#if QT_VERSION < 0x050000
|
||||||
m_printer.data()->setPrinterName(pi.defaultPrinter().printerName());
|
m_printer.data()->setPrinterName(pi.defaultPrinter().printerName());
|
||||||
#endif
|
#else
|
||||||
#ifdef HAVE_QT5
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
|
||||||
m_printer.data()->setPrinterName(pi.defaultPrinterName());
|
m_printer.data()->setPrinterName(pi.defaultPrinterName());
|
||||||
#else
|
#else
|
||||||
@ -394,10 +397,9 @@ bool ReportEnginePrivate::printReport(QPrinter* printer)
|
|||||||
if (!printer&&!m_printerSelected){
|
if (!printer&&!m_printerSelected){
|
||||||
QPrinterInfo pi;
|
QPrinterInfo pi;
|
||||||
if (!pi.defaultPrinter().isNull())
|
if (!pi.defaultPrinter().isNull())
|
||||||
#ifdef HAVE_QT4
|
#if QT_VERSION < 0x050000
|
||||||
m_printer.data()->setPrinterName(pi.defaultPrinter().printerName());
|
m_printer.data()->setPrinterName(pi.defaultPrinter().printerName());
|
||||||
#endif
|
#else
|
||||||
#ifdef HAVE_QT5
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
|
||||||
m_printer.data()->setPrinterName(pi.defaultPrinterName());
|
m_printer.data()->setPrinterName(pi.defaultPrinterName());
|
||||||
#else
|
#else
|
||||||
|
@ -1142,10 +1142,9 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren)
|
|||||||
band->setObjectName(band->objectName()+QString::number(++m_currentNameIndex));
|
band->setObjectName(band->objectName()+QString::number(++m_currentNameIndex));
|
||||||
renameChildItems(band);
|
renameChildItems(band);
|
||||||
if (m_lastDataBand){
|
if (m_lastDataBand){
|
||||||
#ifdef HAVE_QT4
|
#if QT_VERSION < 0x050000
|
||||||
m_lastDataBand->metaObject()->invokeMethod(m_lastDataBand,"bandRegistred");
|
m_lastDataBand->metaObject()->invokeMethod(m_lastDataBand,"bandRegistred");
|
||||||
#endif
|
#else
|
||||||
#ifdef HAVE_QT5
|
|
||||||
emit m_lastDataBand->bandRegistred();
|
emit m_lastDataBand->bandRegistred();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1428,7 +1427,7 @@ void ReportRender::checkLostHeadersOnPrevPage()
|
|||||||
|
|
||||||
if (lostHeaders.size() > 0){
|
if (lostHeaders.size() > 0){
|
||||||
m_lostHeadersMoved = true;
|
m_lostHeadersMoved = true;
|
||||||
//qSort(lostHeaders.begin(), lostHeaders.end(), bandLessThen);
|
//std::sort(lostHeaders.begin(), lostHeaders.end(), bandLessThen);
|
||||||
std::sort(lostHeaders.begin(), lostHeaders.end(), bandLessThen);
|
std::sort(lostHeaders.begin(), lostHeaders.end(), bandLessThen);
|
||||||
foreach(BandDesignIntf* header, lostHeaders){
|
foreach(BandDesignIntf* header, lostHeaders){
|
||||||
registerBand(header);
|
registerBand(header);
|
||||||
@ -1466,7 +1465,7 @@ void ReportRender::checkLostHeadersInPrevColumn()
|
|||||||
|
|
||||||
if (lostHeaders.size() > 0){
|
if (lostHeaders.size() > 0){
|
||||||
m_lostHeadersMoved = true;
|
m_lostHeadersMoved = true;
|
||||||
// qSort(lostHeaders.begin(), lostHeaders.end(), bandLessThen);
|
// std::sort(lostHeaders.begin(), lostHeaders.end(), bandLessThen);
|
||||||
std::sort(lostHeaders.begin(), lostHeaders.end(), bandLessThen);
|
std::sort(lostHeaders.begin(), lostHeaders.end(), bandLessThen);
|
||||||
foreach(BandDesignIntf* header, lostHeaders){
|
foreach(BandDesignIntf* header, lostHeaders){
|
||||||
registerBand(header);
|
registerBand(header);
|
||||||
|
@ -106,7 +106,7 @@ void SettingDialog::setScritpTabIndention(int size)
|
|||||||
|
|
||||||
void SettingDialog::setTheme(const QString &theme)
|
void SettingDialog::setTheme(const QString &theme)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_QT4
|
#if QT_VERSION < 0x050000
|
||||||
ui->cbTheme->setCurrentIndex(ui->cbTheme->findText(theme));
|
ui->cbTheme->setCurrentIndex(ui->cbTheme->findText(theme));
|
||||||
#else
|
#else
|
||||||
ui->cbTheme->setCurrentText(theme);
|
ui->cbTheme->setCurrentText(theme);
|
||||||
@ -128,7 +128,7 @@ void SettingDialog::setDesignerLanguages(QList<QLocale::Language> languages, QLo
|
|||||||
if (language != currentLanguage)
|
if (language != currentLanguage)
|
||||||
ui->designerLanguage->addItem(QLocale::languageToString(language));
|
ui->designerLanguage->addItem(QLocale::languageToString(language));
|
||||||
}
|
}
|
||||||
#ifdef HAVE_QT4
|
#if QT_VERSION < 0x050000
|
||||||
ui->designerLanguage->setCurrentIndex(ui->designerLanguage->findText(QLocale::languageToString(currentLanguage)));
|
ui->designerLanguage->setCurrentIndex(ui->designerLanguage->findText(QLocale::languageToString(currentLanguage)));
|
||||||
#else
|
#else
|
||||||
ui->designerLanguage->setCurrentText(QLocale::languageToString(currentLanguage));
|
ui->designerLanguage->setCurrentText(QLocale::languageToString(currentLanguage));
|
||||||
@ -139,7 +139,7 @@ void SettingDialog::setDesignerThemes(QList<QString> themes, const QString &curr
|
|||||||
{
|
{
|
||||||
ui->cbTheme->clear();
|
ui->cbTheme->clear();
|
||||||
ui->cbTheme->addItems(themes);
|
ui->cbTheme->addItems(themes);
|
||||||
#ifdef HAVE_QT4
|
#if QT_VERSION < 0x050000
|
||||||
ui->cbTheme->setCurrentIndex(ui->cbTheme->findText(currentTheme));
|
ui->cbTheme->setCurrentIndex(ui->cbTheme->findText(currentTheme));
|
||||||
#else
|
#else
|
||||||
ui->cbTheme->setCurrentText(currentTheme);
|
ui->cbTheme->setCurrentText(currentTheme);
|
||||||
@ -150,7 +150,7 @@ void SettingDialog::setDesignerUnites(QList<QString> unitTypes, const QString cu
|
|||||||
{
|
{
|
||||||
ui->reportUnits->clear();
|
ui->reportUnits->clear();
|
||||||
ui->reportUnits->addItems(unitTypes);
|
ui->reportUnits->addItems(unitTypes);
|
||||||
#ifdef HAVE_QT4
|
#if QT_VERSION < 0x050000
|
||||||
ui->cbTheme->setCurrentIndex(ui->cbTheme->findText(currentUnitType));
|
ui->cbTheme->setCurrentIndex(ui->cbTheme->findText(currentUnitType));
|
||||||
#else
|
#else
|
||||||
ui->reportUnits->setCurrentText(currentUnitType);
|
ui->reportUnits->setCurrentText(currentUnitType);
|
||||||
|
@ -34,7 +34,11 @@
|
|||||||
#include <QFocusEvent>
|
#include <QFocusEvent>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
#else
|
||||||
|
#include <QScreen>
|
||||||
|
#endif
|
||||||
#include "lrtextitempropertyeditor.h"
|
#include "lrtextitempropertyeditor.h"
|
||||||
|
|
||||||
namespace LimeReport{
|
namespace LimeReport{
|
||||||
@ -66,7 +70,11 @@ void ButtonLineEditor::editButtonClicked()
|
|||||||
{
|
{
|
||||||
TextItemPropertyEditor* editor = new TextItemPropertyEditor(QApplication::activeWindow());
|
TextItemPropertyEditor* editor = new TextItemPropertyEditor(QApplication::activeWindow());
|
||||||
editor->setAttribute(Qt::WA_DeleteOnClose);
|
editor->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
editor->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, editor->size(), QApplication::desktop()->availableGeometry()));
|
editor->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, editor->size(), QApplication::desktop()->availableGeometry()));
|
||||||
|
#else
|
||||||
|
editor->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, editor->size(), QGuiApplication::screens().first()->availableGeometry()));
|
||||||
|
#endif
|
||||||
editor->setWindowTitle(m_propertyName);
|
editor->setWindowTitle(m_propertyName);
|
||||||
editor->setText(m_lineEdit->text());
|
editor->setText(m_lineEdit->text());
|
||||||
connect(editor,SIGNAL(accepted()),this,SLOT(editingByEditorFinished()));
|
connect(editor,SIGNAL(accepted()),this,SLOT(editingByEditorFinished()));
|
||||||
|
@ -167,8 +167,12 @@ void ObjectInspectorTreeView::commitActiveEditorData(){
|
|||||||
bool PropertyFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
bool PropertyFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||||
{
|
{
|
||||||
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||||
if (sourceParent.isValid()) return true;
|
if (sourceParent.isValid()) return true;
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
return sourceModel()->data(index).toString().contains(filterRegExp());
|
return sourceModel()->data(index).toString().contains(filterRegExp());
|
||||||
|
#else
|
||||||
|
return sourceModel()->data(index).toString().contains(filterRegularExpression());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectInspectorWidget::ObjectInspectorWidget(QWidget *parent)
|
ObjectInspectorWidget::ObjectInspectorWidget(QWidget *parent)
|
||||||
@ -209,7 +213,8 @@ ObjectInspectorWidget::ObjectInspectorWidget(QWidget *parent)
|
|||||||
h->addWidget(settingButton);
|
h->addWidget(settingButton);
|
||||||
l->addLayout(h);
|
l->addLayout(h);
|
||||||
l->addWidget(m_objectInspectorView);
|
l->addWidget(m_objectInspectorView);
|
||||||
l->setMargin(Const::DOCKWIDGET_MARGINS);
|
int margin = Const::DOCKWIDGET_MARGINS;
|
||||||
|
l->setContentsMargins(margin, margin, margin, margin);
|
||||||
l->setSpacing(2);
|
l->setSpacing(2);
|
||||||
this->setLayout(l);
|
this->setLayout(l);
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ void ObjectPropItem::appendItem(ObjectPropItem *item){
|
|||||||
|
|
||||||
void ObjectPropItem::sortItem()
|
void ObjectPropItem::sortItem()
|
||||||
{
|
{
|
||||||
qSort(m_childItems.begin(), m_childItems.end(), lesThen);
|
std::sort(m_childItems.begin(), m_childItems.end(), lesThen);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant ObjectPropItem::propertyValue() const {
|
QVariant ObjectPropItem::propertyValue() const {
|
||||||
|
@ -40,7 +40,8 @@ ObjectBrowser::ObjectBrowser(QWidget *parent)
|
|||||||
{
|
{
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
layout->setMargin(Const::DOCKWIDGET_MARGINS);
|
int margin = Const::DOCKWIDGET_MARGINS;
|
||||||
|
layout->setContentsMargins(margin, margin, margin, margin);
|
||||||
m_treeView = new QTreeWidget(this);
|
m_treeView = new QTreeWidget(this);
|
||||||
layout->addWidget(m_treeView);
|
layout->addWidget(m_treeView);
|
||||||
m_treeView->headerItem()->setText(0,tr("Objects"));
|
m_treeView->headerItem()->setText(0,tr("Objects"));
|
||||||
|
@ -43,7 +43,8 @@ ScriptBrowser::ScriptBrowser(QWidget *parent) :
|
|||||||
ui(new Ui::ScriptBrowser)
|
ui(new Ui::ScriptBrowser)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->verticalLayout->setMargin(Const::DOCKWIDGET_MARGINS);
|
int margin = Const::DOCKWIDGET_MARGINS;
|
||||||
|
ui->verticalLayout->setContentsMargins(margin, margin, margin, margin);
|
||||||
#ifndef HAVE_UI_LOADER
|
#ifndef HAVE_UI_LOADER
|
||||||
ui->tpDialogs->setVisible(false);
|
ui->tpDialogs->setVisible(false);
|
||||||
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tpDialogs));
|
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tpDialogs));
|
||||||
|
@ -46,8 +46,8 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent* event)
|
|||||||
QPainter painter(lineNumberArea);
|
QPainter painter(lineNumberArea);
|
||||||
QStyleOption option;
|
QStyleOption option;
|
||||||
option.initFrom(this);
|
option.initFrom(this);
|
||||||
//painter.fillRect(event->rect(), QPalette().background().color());
|
//painter.fillRect(event->rect(), QPalette().window().color());
|
||||||
QColor bg = option.palette.background().color().darker(150);
|
QColor bg = option.palette.window().color().darker(150);
|
||||||
painter.fillRect(event->rect(), bg);
|
painter.fillRect(event->rect(), bg);
|
||||||
|
|
||||||
QTextBlock block = firstVisibleBlock();
|
QTextBlock block = firstVisibleBlock();
|
||||||
@ -79,7 +79,7 @@ int CodeEditor::lineNumberAreaWidth()
|
|||||||
++digits;
|
++digits;
|
||||||
}
|
}
|
||||||
|
|
||||||
int space = fontMetrics().width(QLatin1Char('9'))*2 + fontMetrics().width(QLatin1Char('9')) * digits;
|
int space = fontMetrics().boundingRect(QLatin1Char('9')).width()*2 + fontMetrics().boundingRect(QLatin1Char('9')).width() * digits;
|
||||||
|
|
||||||
return space;
|
return space;
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ void CodeEditor::highlightCurrentLine()
|
|||||||
if (!isReadOnly()) {
|
if (!isReadOnly()) {
|
||||||
QTextEdit::ExtraSelection selection;
|
QTextEdit::ExtraSelection selection;
|
||||||
|
|
||||||
QColor lineColor = QColor(QPalette().background().color()).darker(100);
|
QColor lineColor = QColor(QPalette().window().color()).darker(100);
|
||||||
|
|
||||||
selection.format.setBackground(lineColor);
|
selection.format.setBackground(lineColor);
|
||||||
selection.format.setProperty(QTextFormat::FullWidthSelection, true);
|
selection.format.setProperty(QTextFormat::FullWidthSelection, true);
|
||||||
|
@ -20,7 +20,11 @@ ScriptEditor::ScriptEditor(QWidget *parent) :
|
|||||||
setFocusProxy(ui->textEdit);
|
setFocusProxy(ui->textEdit);
|
||||||
m_completer = new ReportStructureCompleater(this);
|
m_completer = new ReportStructureCompleater(this);
|
||||||
ui->textEdit->setCompleter(m_completer);
|
ui->textEdit->setCompleter(m_completer);
|
||||||
ui->textEdit->setTabStopWidth(ui->textEdit->fontMetrics().width("0")*m_tabIndention);
|
#if QT_VERSION < 0x060000
|
||||||
|
ui->textEdit->setTabStopWidth(ui->textEdit->fontMetrics().boundingRect("0").width()*m_tabIndention);
|
||||||
|
#else
|
||||||
|
ui->textEdit->setTabStopDistance(ui->textEdit->fontMetrics().boundingRect("0").width()*m_tabIndention);
|
||||||
|
#endif
|
||||||
connect(ui->splitter, SIGNAL(splitterMoved(int,int)), this, SIGNAL(splitterMoved(int,int)));
|
connect(ui->splitter, SIGNAL(splitterMoved(int,int)), this, SIGNAL(splitterMoved(int,int)));
|
||||||
connect(ui->textEdit, SIGNAL(textChanged()), this, SIGNAL(textChanged()));
|
connect(ui->textEdit, SIGNAL(textChanged()), this, SIGNAL(textChanged()));
|
||||||
}
|
}
|
||||||
@ -86,7 +90,11 @@ void ScriptEditor::setPageBand(BandDesignIntf* band)
|
|||||||
void ScriptEditor::setTabIndention(int charCount)
|
void ScriptEditor::setTabIndention(int charCount)
|
||||||
{
|
{
|
||||||
if (m_tabIndention != charCount){
|
if (m_tabIndention != charCount){
|
||||||
ui->textEdit->setTabStopWidth(ui->textEdit->fontMetrics().width("W")*charCount);
|
#if QT_VERSION < 0x060000
|
||||||
|
ui->textEdit->setTabStopWidth(ui->textEdit->fontMetrics().boundingRect("W").width()*charCount);
|
||||||
|
#else
|
||||||
|
ui->textEdit->setTabStopDistance(ui->textEdit->fontMetrics().boundingRect("W").width()*charCount);
|
||||||
|
#endif
|
||||||
m_tabIndention = charCount;
|
m_tabIndention = charCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,7 @@ ScriptHighlighter::ScriptHighlighter(QTextDocument* parent):
|
|||||||
m_keywords.insert(keywords[i]);
|
m_keywords.insert(keywords[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isColorDark(QPalette().background().color())){
|
if ( isColorDark(QPalette().window().color())){
|
||||||
m_formats[NumberFormat].setForeground(Qt::darkBlue);
|
m_formats[NumberFormat].setForeground(Qt::darkBlue);
|
||||||
m_formats[StringFormat].setForeground(Qt::darkGreen);
|
m_formats[StringFormat].setForeground(Qt::darkGreen);
|
||||||
m_formats[KeywordFormat].setForeground(Qt::darkYellow);
|
m_formats[KeywordFormat].setForeground(Qt::darkYellow);
|
||||||
|
@ -197,7 +197,7 @@ QVariant XmlFontSerializator::loadValue()
|
|||||||
//#if QT_VERSION>0x040800
|
//#if QT_VERSION>0x040800
|
||||||
// font.setStyleName(node()->attribute("stylename"));
|
// font.setStyleName(node()->attribute("stylename"));
|
||||||
//#endif
|
//#endif
|
||||||
font.setWeight(node()->attribute("weight").toInt());
|
font.setWeight(static_cast<QFont::Weight>(node()->attribute("weight").toInt()));
|
||||||
if (!node()->attribute("bold").isEmpty())
|
if (!node()->attribute("bold").isEmpty())
|
||||||
font.setBold(node()->attribute("bold").toInt());
|
font.setBold(node()->attribute("bold").toInt());
|
||||||
font.setItalic(node()->attribute("italic").toInt());
|
font.setItalic(node()->attribute("italic").toInt());
|
||||||
|
@ -12,11 +12,10 @@ LanguageSelectDialog::LanguageSelectDialog(QWidget *parent) :
|
|||||||
for (int i = 2; i<QLocale::LastLanguage; ++i){
|
for (int i = 2; i<QLocale::LastLanguage; ++i){
|
||||||
ui->comboBox->addItem(QLocale::languageToString(static_cast<QLocale::Language>(i)),static_cast<QLocale::Language>(i));
|
ui->comboBox->addItem(QLocale::languageToString(static_cast<QLocale::Language>(i)),static_cast<QLocale::Language>(i));
|
||||||
}
|
}
|
||||||
#ifdef HAVE_QT5
|
#if QT_VERSION < 0x050000
|
||||||
ui->comboBox->setCurrentText("");
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_QT4
|
|
||||||
ui->comboBox->setEditText("");
|
ui->comboBox->setEditText("");
|
||||||
|
#else
|
||||||
|
ui->comboBox->setCurrentText("");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user