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