2016-02-17 10:11:00 +03:00
|
|
|
/***************************************************************************
|
|
|
|
* This file is part of the Lime Report project *
|
2021-08-18 20:21:36 +03:00
|
|
|
* Copyright (C) 2021 by Alexander Arin *
|
2016-02-17 10:11:00 +03:00
|
|
|
* arin_a@bk.ru *
|
|
|
|
* *
|
|
|
|
** GNU General Public License Usage **
|
|
|
|
* *
|
|
|
|
* This library is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
** GNU Lesser General Public License **
|
|
|
|
* *
|
|
|
|
* This library is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Lesser General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public *
|
|
|
|
* License along with this library. *
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
* This library is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
****************************************************************************/
|
|
|
|
#include "lritemsaligneditorwidget.h"
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
namespace LimeReport {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
ItemsAlignmentEditorWidget::ItemsAlignmentEditorWidget(LimeReport::ReportDesignWidget* reportEditor,
|
|
|
|
const QString& title, QWidget* parent):
|
|
|
|
QToolBar(title, parent),
|
|
|
|
m_reportEditor(reportEditor),
|
|
|
|
m_page(0)
|
2016-02-17 10:11:00 +03:00
|
|
|
{
|
|
|
|
initEditor();
|
|
|
|
}
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
ItemsAlignmentEditorWidget::ItemsAlignmentEditorWidget(ReportDesignWidget* reportEditor,
|
|
|
|
QWidget* parent):
|
|
|
|
QToolBar(parent),
|
|
|
|
m_reportEditor(reportEditor),
|
|
|
|
m_page(0)
|
2016-02-17 10:11:00 +03:00
|
|
|
{
|
|
|
|
initEditor();
|
|
|
|
}
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
ItemsAlignmentEditorWidget::ItemsAlignmentEditorWidget(PageDesignIntf* page, const QString& title,
|
|
|
|
QWidget* parent):
|
|
|
|
QToolBar(title, parent),
|
|
|
|
m_reportEditor(0),
|
|
|
|
m_page(page)
|
2016-02-17 10:11:00 +03:00
|
|
|
{
|
|
|
|
initEditor();
|
|
|
|
}
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
ItemsAlignmentEditorWidget::ItemsAlignmentEditorWidget(PageDesignIntf* page, QWidget* parent):
|
|
|
|
QToolBar(parent),
|
|
|
|
m_reportEditor(0),
|
|
|
|
m_page(page)
|
2016-02-17 10:11:00 +03:00
|
|
|
{
|
|
|
|
initEditor();
|
|
|
|
}
|
|
|
|
|
2018-12-23 11:41:24 +03:00
|
|
|
void ItemsAlignmentEditorWidget::slotBringToFront()
|
2016-02-17 10:11:00 +03:00
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
if (m_reportEditor)
|
|
|
|
m_reportEditor->bringToFront();
|
|
|
|
if (m_page)
|
|
|
|
m_page->bringToFront();
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void ItemsAlignmentEditorWidget::slotSendToBack()
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
if (m_reportEditor)
|
|
|
|
m_reportEditor->sendToBack();
|
|
|
|
if (m_page)
|
|
|
|
m_page->sendToBack();
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void ItemsAlignmentEditorWidget::slotAlignToLeft()
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
if (m_reportEditor)
|
|
|
|
m_reportEditor->alignToLeft();
|
|
|
|
if (m_page)
|
|
|
|
m_page->alignToLeft();
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void ItemsAlignmentEditorWidget::slotAlignToRight()
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
if (m_reportEditor)
|
|
|
|
m_reportEditor->alignToRight();
|
|
|
|
if (m_page)
|
|
|
|
m_page->alignToRigth();
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void ItemsAlignmentEditorWidget::slotAlignToVCenter()
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
if (m_reportEditor)
|
|
|
|
m_reportEditor->alignToVCenter();
|
|
|
|
if (m_page)
|
|
|
|
m_page->alignToVCenter();
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void ItemsAlignmentEditorWidget::slotAlignToTop()
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
if (m_reportEditor)
|
|
|
|
m_reportEditor->alignToTop();
|
|
|
|
if (m_page)
|
|
|
|
m_page->alignToTop();
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void ItemsAlignmentEditorWidget::slotAlignToBottom()
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
if (m_reportEditor)
|
|
|
|
m_reportEditor->alignToBottom();
|
|
|
|
if (m_page)
|
|
|
|
m_page->alignToBottom();
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void ItemsAlignmentEditorWidget::slotAlignToHCenter()
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
if (m_reportEditor)
|
|
|
|
m_reportEditor->alignToHCenter();
|
|
|
|
if (m_page)
|
|
|
|
m_page->alignToHCenter();
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void ItemsAlignmentEditorWidget::slotSameHeight()
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
if (m_reportEditor)
|
|
|
|
m_reportEditor->sameHeight();
|
|
|
|
if (m_page)
|
|
|
|
m_page->sameHeight();
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void ItemsAlignmentEditorWidget::slotSameWidth()
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
if (m_reportEditor)
|
|
|
|
m_reportEditor->sameWidth();
|
|
|
|
if (m_page)
|
|
|
|
m_page->sameWidth();
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void ItemsAlignmentEditorWidget::initEditor()
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
m_bringToFront = new QAction(tr("Bring to top"), this);
|
2016-02-17 10:11:00 +03:00
|
|
|
m_bringToFront->setIcon(QIcon(":/report/images/bringToTop"));
|
2024-09-04 17:31:16 +03:00
|
|
|
connect(m_bringToFront, SIGNAL(triggered()), this, SLOT(slotBringToFront()));
|
2016-02-17 10:11:00 +03:00
|
|
|
addAction(m_bringToFront);
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
m_sendToBack = new QAction(tr("Send to back"), this);
|
2016-02-17 10:11:00 +03:00
|
|
|
m_sendToBack->setIcon(QIcon(":/report/images/sendToBack"));
|
2024-09-04 17:31:16 +03:00
|
|
|
connect(m_sendToBack, SIGNAL(triggered()), this, SLOT(slotSendToBack()));
|
2016-02-17 10:11:00 +03:00
|
|
|
addAction(m_sendToBack);
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
m_alignToLeft = new QAction(tr("Align to left"), this);
|
2016-02-17 10:11:00 +03:00
|
|
|
m_alignToLeft->setIcon(QIcon(":/report/images/alignToLeft"));
|
2024-09-04 17:31:16 +03:00
|
|
|
connect(m_alignToLeft, SIGNAL(triggered()), this, SLOT(slotAlignToLeft()));
|
2016-02-17 10:11:00 +03:00
|
|
|
addAction(m_alignToLeft);
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
m_alignToRight = new QAction(tr("Align to right"), this);
|
2016-02-17 10:11:00 +03:00
|
|
|
m_alignToRight->setIcon(QIcon(":/report/images/alignToRight"));
|
2024-09-04 17:31:16 +03:00
|
|
|
connect(m_alignToRight, SIGNAL(triggered()), this, SLOT(slotAlignToRight()));
|
2016-02-17 10:11:00 +03:00
|
|
|
addAction(m_alignToRight);
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
m_alignToVCenter = new QAction(tr("Align to vertical center"), this);
|
2016-02-17 10:11:00 +03:00
|
|
|
m_alignToVCenter->setIcon(QIcon(":/report/images/alignToVCenter"));
|
2024-09-04 17:31:16 +03:00
|
|
|
connect(m_alignToVCenter, SIGNAL(triggered()), this, SLOT(slotAlignToVCenter()));
|
2016-02-17 10:11:00 +03:00
|
|
|
addAction(m_alignToVCenter);
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
m_alignToTop = new QAction(tr("Align to top"), this);
|
2016-02-17 10:11:00 +03:00
|
|
|
m_alignToTop->setIcon(QIcon(":/report/images/alignToTop"));
|
2024-09-04 17:31:16 +03:00
|
|
|
connect(m_alignToTop, SIGNAL(triggered()), this, SLOT(slotAlignToTop()));
|
2016-02-17 10:11:00 +03:00
|
|
|
addAction(m_alignToTop);
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
m_alignToBottom = new QAction(tr("Align to bottom"), this);
|
2016-02-17 10:11:00 +03:00
|
|
|
m_alignToBottom->setIcon(QIcon(":/report/images/alignToBottom"));
|
2024-09-04 17:31:16 +03:00
|
|
|
connect(m_alignToBottom, SIGNAL(triggered()), this, SLOT(slotAlignToBottom()));
|
2016-02-17 10:11:00 +03:00
|
|
|
addAction(m_alignToBottom);
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
m_alignToHCenter = new QAction(tr("Align to horizontal center"), this);
|
2016-02-17 10:11:00 +03:00
|
|
|
m_alignToHCenter->setIcon(QIcon(":/report/images/alignToHCenter"));
|
2024-09-04 17:31:16 +03:00
|
|
|
connect(m_alignToHCenter, SIGNAL(triggered()), this, SLOT(slotAlignToHCenter()));
|
2016-02-17 10:11:00 +03:00
|
|
|
addAction(m_alignToHCenter);
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
m_sameHeight = new QAction(tr("Set same height"), this);
|
2016-02-17 10:11:00 +03:00
|
|
|
m_sameHeight->setIcon(QIcon(":/report/images/sameHeight"));
|
2024-09-04 17:31:16 +03:00
|
|
|
connect(m_sameHeight, SIGNAL(triggered()), this, SLOT(slotSameHeight()));
|
2016-02-17 10:11:00 +03:00
|
|
|
addAction(m_sameHeight);
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
m_sameWidth = new QAction(tr("Set same width"), this);
|
2016-02-17 10:11:00 +03:00
|
|
|
m_sameWidth->setIcon(QIcon(":/report/images/sameWidth"));
|
2024-09-04 17:31:16 +03:00
|
|
|
connect(m_sameWidth, SIGNAL(triggered()), this, SLOT(slotSameWidth()));
|
2016-02-17 10:11:00 +03:00
|
|
|
addAction(m_sameWidth);
|
|
|
|
}
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
} // namespace LimeReport
|