mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-25 00:54:39 +03:00
Ruler ha been fixed
This commit is contained in:
parent
4e6c860929
commit
5cc1312dd9
@ -287,30 +287,31 @@ void ReportDesignWidget::loadState()
|
|||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PageView* ReportDesignWidget::createPageView(PageDesignIntf* page){
|
||||||
|
PageView* view = new PageView(this);
|
||||||
|
view->setBackgroundBrush(QBrush(Qt::gray));
|
||||||
|
view->setFrameShape(QFrame::NoFrame);
|
||||||
|
view->setScene(page);
|
||||||
|
view->setPageItem(page->pageItem());
|
||||||
|
view->scale(0.5, 0.5);
|
||||||
|
view->centerOn(0, 0);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
void ReportDesignWidget::createTabs(){
|
void ReportDesignWidget::createTabs(){
|
||||||
m_tabWidget->clear();
|
m_tabWidget->clear();
|
||||||
int pageIndex = -1;
|
int pageIndex = -1;
|
||||||
|
|
||||||
for (int i = 0; i < m_report->pageCount(); ++i){
|
for (int i = 0; i < m_report->pageCount(); ++i){
|
||||||
PageView* view = new PageView(qobject_cast<QWidget*>(this));
|
PageDesignIntf* page = m_report->pageAt(i);
|
||||||
view->setBackgroundBrush(QBrush(Qt::gray));
|
page->clearSelection();
|
||||||
view->setFrameShape(QFrame::NoFrame);
|
connectPage(page);
|
||||||
view->setScene(m_report->pageAt(i));
|
PageView* view = createPageView(page);
|
||||||
view->setPageItem(m_report->pageAt(i)->pageItem());
|
int pageIndex = m_tabWidget->addTab(view, QIcon(), page->pageItem()->objectName());
|
||||||
|
|
||||||
m_report->pageAt(i)->clearSelection();
|
|
||||||
|
|
||||||
view->centerOn(0,0);
|
|
||||||
view->scale(0.5,0.5);
|
|
||||||
connectPage(m_report->pageAt(i));
|
|
||||||
pageIndex = m_tabWidget->addTab(view,QIcon(),m_report->pageAt(i)->pageItem()->objectName());
|
|
||||||
m_tabWidget->setTabWhatsThis(pageIndex, "page");
|
m_tabWidget->setTabWhatsThis(pageIndex, "page");
|
||||||
connect(m_report->pageAt(i)->pageItem(), SIGNAL(propertyObjectNameChanged(QString,QString)),
|
|
||||||
this, SLOT(slotPagePropertyObjectNameChanged(QString,QString)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scriptEditor = new ScriptEditor(this);
|
m_scriptEditor = new ScriptEditor(this);
|
||||||
|
|
||||||
connect(m_scriptEditor, SIGNAL(textChanged()), this, SLOT(slotScriptTextChanged()));
|
connect(m_scriptEditor, SIGNAL(textChanged()), this, SLOT(slotScriptTextChanged()));
|
||||||
m_scriptEditor->setReportEngine(m_report);
|
m_scriptEditor->setReportEngine(m_report);
|
||||||
pageIndex = m_tabWidget->addTab(m_scriptEditor,QIcon(),tr("Script"));
|
pageIndex = m_tabWidget->addTab(m_scriptEditor,QIcon(),tr("Script"));
|
||||||
@ -377,7 +378,8 @@ void ReportDesignWidget::connectPage(PageDesignIntf *page)
|
|||||||
this, SIGNAL(bandDeleted(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)));
|
this, SIGNAL(bandDeleted(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)));
|
||||||
connect(page, SIGNAL(pageUpdateFinished(LimeReport::PageDesignIntf*)),
|
connect(page, SIGNAL(pageUpdateFinished(LimeReport::PageDesignIntf*)),
|
||||||
this, SIGNAL(activePageUpdated(LimeReport::PageDesignIntf*)));
|
this, SIGNAL(activePageUpdated(LimeReport::PageDesignIntf*)));
|
||||||
|
connect(page->pageItem(), SIGNAL(propertyObjectNameChanged(QString,QString)),
|
||||||
|
this, SLOT(slotPagePropertyObjectNameChanged(QString,QString)));
|
||||||
emit activePageChanged();
|
emit activePageChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -737,19 +739,13 @@ void ReportDesignWidget::printReport()
|
|||||||
|
|
||||||
void ReportDesignWidget::addPage()
|
void ReportDesignWidget::addPage()
|
||||||
{
|
{
|
||||||
QGraphicsView* view = new QGraphicsView(qobject_cast<QWidget*>(this));
|
|
||||||
view->setBackgroundBrush(QBrush(Qt::gray));
|
|
||||||
view->setFrameShape(QFrame::NoFrame);
|
|
||||||
PageDesignIntf* page = m_report->appendPage("page"+QString::number(m_report->pageCount()+1));
|
PageDesignIntf* page = m_report->appendPage("page"+QString::number(m_report->pageCount()+1));
|
||||||
view->setScene(page);
|
connectPage(page);
|
||||||
|
PageView* view = createPageView(page);
|
||||||
int index = m_report->pageCount()-1;
|
int index = m_report->pageCount()-1;
|
||||||
m_tabWidget->insertTab(index, view, QIcon(), page->pageItem()->objectName());
|
m_tabWidget->insertTab(index, view, QIcon(), page->pageItem()->objectName());
|
||||||
|
m_tabWidget->setTabWhatsThis(index, "page");
|
||||||
m_tabWidget->setCurrentIndex(index);
|
m_tabWidget->setCurrentIndex(index);
|
||||||
connect(page->pageItem(), SIGNAL(propertyObjectNameChanged(QString,QString)),
|
|
||||||
this, SLOT(slotPagePropertyObjectNameChanged(QString,QString)));
|
|
||||||
connectPage(page);
|
|
||||||
view->scale(0.5,0.5);
|
|
||||||
view->centerOn(0,0);
|
|
||||||
applyUseGrid();
|
applyUseGrid();
|
||||||
emit pageAdded(page);
|
emit pageAdded(page);
|
||||||
}
|
}
|
||||||
@ -1071,14 +1067,16 @@ bool PageView::viewportEvent(QEvent *event)
|
|||||||
{
|
{
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
case QEvent::MouseMove:
|
case QEvent::MouseMove:
|
||||||
|
if (m_horizontalRuller && m_verticalRuller){
|
||||||
m_horizontalRuller->setMousePos(dynamic_cast<QMouseEvent*>(event)->pos());
|
m_horizontalRuller->setMousePos(dynamic_cast<QMouseEvent*>(event)->pos());
|
||||||
m_verticalRuller->setMousePos(dynamic_cast<QMouseEvent*>(event)->pos());
|
m_verticalRuller->setMousePos(dynamic_cast<QMouseEvent*>(event)->pos());
|
||||||
m_horizontalRuller->update();
|
m_horizontalRuller->update();
|
||||||
m_verticalRuller->update();
|
m_verticalRuller->update();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
//case QEvent::Resize:
|
//case QEvent::Resize:
|
||||||
case QEvent::Paint:
|
case QEvent::Paint:
|
||||||
if (m_horizontalRuller){
|
if (m_horizontalRuller && m_verticalRuller){
|
||||||
int x = mapFromScene(m_pageItem->boundingRect().x(),m_pageItem->boundingRect().y()).x();
|
int x = mapFromScene(m_pageItem->boundingRect().x(),m_pageItem->boundingRect().y()).x();
|
||||||
int y = mapFromScene(m_pageItem->boundingRect().x(),m_pageItem->boundingRect().y()).y();
|
int y = mapFromScene(m_pageItem->boundingRect().x(),m_pageItem->boundingRect().y()).y();
|
||||||
int width = mapFromScene(m_pageItem->boundingRect().bottomRight().x(),m_pageItem->boundingRect().bottomRight().y()).x();
|
int width = mapFromScene(m_pageItem->boundingRect().bottomRight().x(),m_pageItem->boundingRect().bottomRight().y()).x();
|
||||||
|
@ -241,6 +241,7 @@ signals:
|
|||||||
void pageAdded(PageDesignIntf* page);
|
void pageAdded(PageDesignIntf* page);
|
||||||
void pageDeleted();
|
void pageDeleted();
|
||||||
protected:
|
protected:
|
||||||
|
PageView *createPageView(PageDesignIntf *page);
|
||||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||||
void createNewDialogTab(const QString& dialogName,const QByteArray& description);
|
void createNewDialogTab(const QString& dialogName,const QByteArray& description);
|
||||||
#endif
|
#endif
|
||||||
@ -275,6 +276,7 @@ private:
|
|||||||
QMap<QString, QString> m_themes;
|
QMap<QString, QString> m_themes;
|
||||||
QMap<QString, QString> m_localToEng;
|
QMap<QString, QString> m_localToEng;
|
||||||
BaseDesignIntf::UnitType m_defaultUnits;
|
BaseDesignIntf::UnitType m_defaultUnits;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace LimeReport
|
} // namespace LimeReport
|
||||||
|
Loading…
Reference in New Issue
Block a user