mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2025-09-23 08:39:07 +03:00
Change to subforder project model.
This commit is contained in:
147
limereport/items/editors/lrfonteditorwidget.cpp
Normal file
147
limereport/items/editors/lrfonteditorwidget.cpp
Normal file
@@ -0,0 +1,147 @@
|
||||
/***************************************************************************
|
||||
* This file is part of the Lime Report project *
|
||||
* Copyright (C) 2015 by Alexander Arin *
|
||||
* 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 "lrfonteditorwidget.h"
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
FontEditorWidget::FontEditorWidget(ReportDesignWidget *reportEditor, const QString &title, QWidget *parent)
|
||||
: ItemEditorWidget(reportEditor,title,parent), m_ignoreSlots(false) {
|
||||
initEditor();
|
||||
}
|
||||
|
||||
FontEditorWidget::FontEditorWidget(ReportDesignWidget *reportEditor, QWidget *parent)
|
||||
:ItemEditorWidget(reportEditor,parent), m_ignoreSlots(false) {
|
||||
initEditor();
|
||||
}
|
||||
|
||||
void FontEditorWidget::setItemEvent(BaseDesignIntf* item)
|
||||
{
|
||||
|
||||
QVariant font=item->property("font");
|
||||
if (font.isValid()){
|
||||
updateValues(font.value<QFont>());
|
||||
setEnabled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FontEditorWidget::initEditor()
|
||||
{
|
||||
setIconSize(QSize(24,24));
|
||||
setAllowedAreas(Qt::TopToolBarArea);
|
||||
setFloatable(false);
|
||||
|
||||
m_fontNameEditor = new QFontComboBox(this);
|
||||
m_fontNameEditor->setFontFilters(QFontComboBox::AllFonts);
|
||||
connect(m_fontNameEditor,SIGNAL(currentFontChanged(QFont)),this,SLOT(slotFontChanged(QFont)));
|
||||
addWidget(m_fontNameEditor);
|
||||
|
||||
m_fontSizeModel.setStringList(QStringList()<<"6"<<"7"<<"8"<<"9"<<"10"<<"11"<<"12"<<"14"<<"16"<<"18"<<"20"<<"24"<<"28"<<"30"<<"36"<<"48"<<"64"<<"72");
|
||||
m_fontSizeEditor = new QComboBox(this);
|
||||
m_fontSizeEditor->setModel(&m_fontSizeModel);
|
||||
m_fontSizeEditor->setEditable(true);
|
||||
connect(m_fontSizeEditor,SIGNAL(currentIndexChanged(QString)),this,SLOT(slotFontSizeChanged(QString)));
|
||||
addWidget(m_fontSizeEditor);
|
||||
|
||||
addSeparator();
|
||||
setEnabled(false);
|
||||
|
||||
m_fontBold = new QAction(tr("Font bold"),this);
|
||||
m_fontBold->setIcon(QIcon(":/report/images/textBold"));
|
||||
m_fontBold->setCheckable(true);
|
||||
connect(m_fontBold,SIGNAL(toggled(bool)),this,SLOT(slotFontAttribsChanged(bool)));
|
||||
addAction(m_fontBold);
|
||||
|
||||
m_fontItalic = new QAction(tr("Font Italic"),this);
|
||||
m_fontItalic->setIcon(QIcon(":/report/images/textItalic"));
|
||||
m_fontItalic->setCheckable(true);
|
||||
connect(m_fontItalic,SIGNAL(toggled(bool)),this,SLOT(slotFontAttribsChanged(bool)));
|
||||
addAction(m_fontItalic);
|
||||
|
||||
m_fontUnderline = new QAction(tr("Font Underline"),this);
|
||||
m_fontUnderline->setIcon(QIcon(":/report/images/textUnderline"));
|
||||
m_fontUnderline->setCheckable(true);
|
||||
connect(m_fontUnderline,SIGNAL(toggled(bool)),this,SLOT(slotFontAttribsChanged(bool)));
|
||||
addAction(m_fontUnderline);
|
||||
|
||||
if (reportEditor()){
|
||||
connect(reportEditor(),SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
|
||||
this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant)));
|
||||
}
|
||||
}
|
||||
|
||||
void FontEditorWidget::updateValues(const QFont& font)
|
||||
{
|
||||
m_ignoreSlots=true;
|
||||
m_fontNameEditor->setCurrentFont(font);
|
||||
m_fontSizeEditor->setEditText(QString::number(font.pointSize()));
|
||||
m_fontBold->setChecked(font.bold());
|
||||
m_fontItalic->setChecked(font.italic());
|
||||
m_fontUnderline->setChecked(font.underline());
|
||||
m_ignoreSlots=false;
|
||||
}
|
||||
|
||||
|
||||
void FontEditorWidget::slotFontChanged(const QFont &font)
|
||||
{
|
||||
if (reportEditor() && !m_ignoreSlots) reportEditor()->setFont(font);
|
||||
}
|
||||
|
||||
void FontEditorWidget::slotFontSizeChanged(const QString &value)
|
||||
{
|
||||
if (reportEditor() && !m_ignoreSlots){
|
||||
QFont resFont(m_fontNameEditor->currentFont());
|
||||
resFont.setPointSize(value.toInt());
|
||||
reportEditor()->setFont(resFont);
|
||||
}
|
||||
}
|
||||
|
||||
void FontEditorWidget::slotFontAttribsChanged(bool)
|
||||
{
|
||||
if (reportEditor()&& !m_ignoreSlots){
|
||||
QFont resFont(m_fontNameEditor->currentFont());
|
||||
resFont.setBold(m_fontBold->isChecked());
|
||||
resFont.setItalic(m_fontItalic->isChecked());
|
||||
resFont.setUnderline(m_fontUnderline->isChecked());
|
||||
reportEditor()->setFont(resFont);
|
||||
}
|
||||
}
|
||||
|
||||
void FontEditorWidget::slotPropertyChanged(const QString &objectName, const QString &property, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
Q_UNUSED(oldValue)
|
||||
Q_UNUSED(newValue)
|
||||
if (item()&&(item()->objectName()==objectName)&&(property=="font")){
|
||||
updateValues(item()->property("font").value<QFont>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} //namespace LimeReport
|
73
limereport/items/editors/lrfonteditorwidget.h
Normal file
73
limereport/items/editors/lrfonteditorwidget.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/***************************************************************************
|
||||
* This file is part of the Lime Report project *
|
||||
* Copyright (C) 2015 by Alexander Arin *
|
||||
* 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. *
|
||||
****************************************************************************/
|
||||
#ifndef LRFONTEDITORWIDGET_H
|
||||
#define LRFONTEDITORWIDGET_H
|
||||
|
||||
#include <QToolBar>
|
||||
#include <QFontComboBox>
|
||||
#include <QStringListModel>
|
||||
#include <QAction>
|
||||
|
||||
#include "lrreportdesignwidget.h"
|
||||
#include "lritemeditorwidget.h"
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
class FontEditorWidget :public ItemEditorWidget{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FontEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
|
||||
explicit FontEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0);
|
||||
protected:
|
||||
void setItemEvent(BaseDesignIntf *item);
|
||||
private slots:
|
||||
void slotFontChanged(const QFont& font);
|
||||
void slotFontSizeChanged(const QString& value);
|
||||
void slotFontAttribsChanged(bool);
|
||||
void slotPropertyChanged(const QString& objectName, const QString& property, const QVariant &oldValue, const QVariant &newValue);
|
||||
private:
|
||||
void initEditor();
|
||||
void updateValues(const QFont &font);
|
||||
|
||||
QFontComboBox* m_fontNameEditor;
|
||||
QComboBox* m_fontSizeEditor;
|
||||
QStringListModel m_fontSizeModel;
|
||||
|
||||
QAction* m_fontBold;
|
||||
QAction* m_fontItalic;
|
||||
QAction* m_fontUnderline;
|
||||
|
||||
bool m_ignoreSlots;
|
||||
|
||||
};
|
||||
|
||||
} //namespace LimeReport
|
||||
|
||||
#endif // LRFONTEDITORWIDGET_H
|
91
limereport/items/editors/lritemeditorwidget.cpp
Normal file
91
limereport/items/editors/lritemeditorwidget.cpp
Normal file
@@ -0,0 +1,91 @@
|
||||
/***************************************************************************
|
||||
* This file is part of the Lime Report project *
|
||||
* Copyright (C) 2015 by Alexander Arin *
|
||||
* 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 "lritemeditorwidget.h"
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
ItemEditorWidget::ItemEditorWidget(ReportDesignWidget* reportEditor, const QString& title, QWidget* parent)
|
||||
:QToolBar(title,parent), m_reportEditor(reportEditor), m_item(0), m_page(0)
|
||||
{
|
||||
}
|
||||
|
||||
ItemEditorWidget::ItemEditorWidget(ReportDesignWidget* reportEditor, QWidget* parent)
|
||||
:QToolBar(parent), m_reportEditor(reportEditor), m_item(0), m_page(0)
|
||||
{
|
||||
}
|
||||
|
||||
ItemEditorWidget::ItemEditorWidget(PageDesignIntf* page, const QString& title, QWidget* parent)
|
||||
:QToolBar(title,parent), m_reportEditor(0), m_item(0), m_page(page)
|
||||
{
|
||||
}
|
||||
|
||||
ItemEditorWidget::ItemEditorWidget(PageDesignIntf* page, QWidget* parent)
|
||||
:QToolBar(parent), m_reportEditor(0), m_item(0), m_page(page)
|
||||
{
|
||||
}
|
||||
|
||||
void ItemEditorWidget::setItem(BaseDesignIntf* item)
|
||||
{
|
||||
if (m_item!=item){
|
||||
if (m_item) m_item->disconnect(this);
|
||||
m_item=item;
|
||||
connect(m_item,SIGNAL(destroyed(QObject*)),this,SLOT(slotItemDestroyed(QObject*)));
|
||||
connect(m_item,SIGNAL(propertyChanged(QString,QVariant,QVariant)),
|
||||
this,SLOT(slotPropertyChanged(QString,QVariant,QVariant)));
|
||||
setEnabled(false);
|
||||
setItemEvent(item);
|
||||
}
|
||||
}
|
||||
|
||||
void ItemEditorWidget::properyChangedEvent(const QString& propertName, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
Q_UNUSED(propertName)
|
||||
Q_UNUSED(oldValue)
|
||||
Q_UNUSED(newValue)
|
||||
}
|
||||
|
||||
void ItemEditorWidget::slotItemDestroyed(QObject* item)
|
||||
{
|
||||
if (item==m_item) {
|
||||
m_item = 0;
|
||||
setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ItemEditorWidget::slotPropertyChanged(const QString& propertName, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
properyChangedEvent(propertName,oldValue,newValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
65
limereport/items/editors/lritemeditorwidget.h
Normal file
65
limereport/items/editors/lritemeditorwidget.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/***************************************************************************
|
||||
* This file is part of the Lime Report project *
|
||||
* Copyright (C) 2015 by Alexander Arin *
|
||||
* 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. *
|
||||
****************************************************************************/
|
||||
#ifndef LRITEMEDITORWIDGET_H
|
||||
#define LRITEMEDITORWIDGET_H
|
||||
|
||||
#include <QToolBar>
|
||||
#include "lrreportdesignwidget.h"
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
class ItemEditorWidget : public QToolBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ItemEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
|
||||
explicit ItemEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0);
|
||||
explicit ItemEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0);
|
||||
explicit ItemEditorWidget(PageDesignIntf* page, QWidget *parent = 0);
|
||||
|
||||
void setItem(BaseDesignIntf *item);
|
||||
void setReportEditor(ReportDesignWidget* editor){m_reportEditor = editor;}
|
||||
protected:
|
||||
virtual void setItemEvent(BaseDesignIntf*){}
|
||||
virtual void properyChangedEvent(const QString& propertName, const QVariant& oldValue, const QVariant& newValue);
|
||||
BaseDesignIntf* item(){return m_item;}
|
||||
ReportDesignWidget* reportEditor(){return m_reportEditor;}
|
||||
PageDesignIntf* page(){return m_page;}
|
||||
private slots:
|
||||
void slotItemDestroyed(QObject* item);
|
||||
void slotPropertyChanged(const QString& propertName, const QVariant& oldValue, const QVariant& newValue);
|
||||
private:
|
||||
ReportDesignWidget* m_reportEditor;
|
||||
BaseDesignIntf* m_item;
|
||||
PageDesignIntf* m_page;
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
#endif // LRITEMEDITORWIDGET_H
|
171
limereport/items/editors/lritemsaligneditorwidget.cpp
Normal file
171
limereport/items/editors/lritemsaligneditorwidget.cpp
Normal file
@@ -0,0 +1,171 @@
|
||||
/***************************************************************************
|
||||
* This file is part of the Lime Report project *
|
||||
* Copyright (C) 2015 by Alexander Arin *
|
||||
* 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"
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
ItemsAlignmentEditorWidget::ItemsAlignmentEditorWidget(LimeReport::ReportDesignWidget* reportEditor, const QString& title, QWidget* parent)
|
||||
:QToolBar(title,parent), m_reportEditor(reportEditor), m_page(0)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
ItemsAlignmentEditorWidget::ItemsAlignmentEditorWidget(ReportDesignWidget* reportEditor, QWidget* parent)
|
||||
:QToolBar(parent), m_reportEditor(reportEditor), m_page(0)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
ItemsAlignmentEditorWidget::ItemsAlignmentEditorWidget(PageDesignIntf* page, const QString& title, QWidget* parent)
|
||||
:QToolBar(title,parent), m_reportEditor(0), m_page(page)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
ItemsAlignmentEditorWidget::ItemsAlignmentEditorWidget(PageDesignIntf* page, QWidget* parent)
|
||||
:QToolBar(parent), m_reportEditor(0), m_page(page)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
void ItemsAlignmentEditorWidget::slotBrinToFront()
|
||||
{
|
||||
if (m_reportEditor) m_reportEditor->brinToFront();
|
||||
if (m_page) m_page->bringToFront();
|
||||
}
|
||||
|
||||
void ItemsAlignmentEditorWidget::slotSendToBack()
|
||||
{
|
||||
if (m_reportEditor) m_reportEditor->sendToBack();
|
||||
if (m_page) m_page->sendToBack();
|
||||
}
|
||||
|
||||
void ItemsAlignmentEditorWidget::slotAlignToLeft()
|
||||
{
|
||||
if (m_reportEditor) m_reportEditor->alignToLeft();
|
||||
if (m_page) m_page->alignToLeft();
|
||||
}
|
||||
|
||||
void ItemsAlignmentEditorWidget::slotAlignToRight()
|
||||
{
|
||||
if (m_reportEditor) m_reportEditor->alignToRight();
|
||||
if (m_page) m_page->alignToRigth();
|
||||
}
|
||||
|
||||
void ItemsAlignmentEditorWidget::slotAlignToVCenter()
|
||||
{
|
||||
if (m_reportEditor) m_reportEditor->alignToVCenter();
|
||||
if (m_page) m_page->alignToVCenter();
|
||||
}
|
||||
|
||||
void ItemsAlignmentEditorWidget::slotAlignToTop()
|
||||
{
|
||||
if (m_reportEditor) m_reportEditor->alignToTop();
|
||||
if (m_page) m_page->alignToTop();
|
||||
}
|
||||
|
||||
void ItemsAlignmentEditorWidget::slotAlignToBottom()
|
||||
{
|
||||
if (m_reportEditor) m_reportEditor->alignToBottom();
|
||||
if (m_page) m_page->alignToBottom();
|
||||
}
|
||||
|
||||
void ItemsAlignmentEditorWidget::slotAlignToHCenter()
|
||||
{
|
||||
if (m_reportEditor) m_reportEditor->alignToHCenter();
|
||||
if (m_page) m_page->alignToHCenter();
|
||||
}
|
||||
|
||||
void ItemsAlignmentEditorWidget::slotSameHeight()
|
||||
{
|
||||
if (m_reportEditor) m_reportEditor->sameHeight();
|
||||
if (m_page) m_page->sameHeight();
|
||||
}
|
||||
|
||||
void ItemsAlignmentEditorWidget::slotSameWidth()
|
||||
{
|
||||
if (m_reportEditor) m_reportEditor->sameWidth();
|
||||
if (m_page) m_page->sameWidth();
|
||||
}
|
||||
|
||||
void ItemsAlignmentEditorWidget::initEditor()
|
||||
{
|
||||
m_bringToFront = new QAction(tr("Bring to top"),this);
|
||||
m_bringToFront->setIcon(QIcon(":/report/images/bringToTop"));
|
||||
connect(m_bringToFront,SIGNAL(triggered()),this,SLOT(slotBrinToFront()));
|
||||
addAction(m_bringToFront);
|
||||
|
||||
m_sendToBack = new QAction(tr("Send to back"),this);
|
||||
m_sendToBack->setIcon(QIcon(":/report/images/sendToBack"));
|
||||
connect(m_sendToBack,SIGNAL(triggered()),this,SLOT(slotSendToBack()));
|
||||
addAction(m_sendToBack);
|
||||
|
||||
m_alignToLeft = new QAction(tr("Align to left"),this);
|
||||
m_alignToLeft->setIcon(QIcon(":/report/images/alignToLeft"));
|
||||
connect(m_alignToLeft,SIGNAL(triggered()),this,SLOT(slotAlignToLeft()));
|
||||
addAction(m_alignToLeft);
|
||||
|
||||
m_alignToRight = new QAction(tr("Align to right"),this);
|
||||
m_alignToRight->setIcon(QIcon(":/report/images/alignToRight"));
|
||||
connect(m_alignToRight,SIGNAL(triggered()),this,SLOT(slotAlignToRight()));
|
||||
addAction(m_alignToRight);
|
||||
|
||||
m_alignToVCenter = new QAction(tr("Align to vertical center"),this);
|
||||
m_alignToVCenter->setIcon(QIcon(":/report/images/alignToVCenter"));
|
||||
connect(m_alignToVCenter,SIGNAL(triggered()),this,SLOT(slotAlignToVCenter()));
|
||||
addAction(m_alignToVCenter);
|
||||
|
||||
m_alignToTop = new QAction(tr("Align to top"),this);
|
||||
m_alignToTop->setIcon(QIcon(":/report/images/alignToTop"));
|
||||
connect(m_alignToTop,SIGNAL(triggered()),this,SLOT(slotAlignToTop()));
|
||||
addAction(m_alignToTop);
|
||||
|
||||
m_alignToBottom = new QAction(tr("Align to bottom"),this);
|
||||
m_alignToBottom->setIcon(QIcon(":/report/images/alignToBottom"));
|
||||
connect(m_alignToBottom,SIGNAL(triggered()),this,SLOT(slotAlignToBottom()));
|
||||
addAction(m_alignToBottom);
|
||||
|
||||
m_alignToHCenter = new QAction(tr("Align to horizontal center"),this);
|
||||
m_alignToHCenter->setIcon(QIcon(":/report/images/alignToHCenter"));
|
||||
connect(m_alignToHCenter,SIGNAL(triggered()),this,SLOT(slotAlignToHCenter()));
|
||||
addAction(m_alignToHCenter);
|
||||
|
||||
m_sameHeight = new QAction(tr("Set same height"),this);
|
||||
m_sameHeight->setIcon(QIcon(":/report/images/sameHeight"));
|
||||
connect(m_sameHeight,SIGNAL(triggered()),this,SLOT(slotSameHeight()));
|
||||
addAction(m_sameHeight);
|
||||
|
||||
m_sameWidth = new QAction(tr("Set same width"),this);
|
||||
m_sameWidth->setIcon(QIcon(":/report/images/sameWidth"));
|
||||
connect(m_sameWidth,SIGNAL(triggered()),this,SLOT(slotSameWidth()));
|
||||
addAction(m_sameWidth);
|
||||
}
|
||||
|
||||
} //namespace LimeReport
|
77
limereport/items/editors/lritemsaligneditorwidget.h
Normal file
77
limereport/items/editors/lritemsaligneditorwidget.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/***************************************************************************
|
||||
* This file is part of the Lime Report project *
|
||||
* Copyright (C) 2015 by Alexander Arin *
|
||||
* 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. *
|
||||
****************************************************************************/
|
||||
#ifndef LRITEMSALIGNEDITORWIDGET_H
|
||||
#define LRITEMSALIGNEDITORWIDGET_H
|
||||
|
||||
#include "lrreportdesignwidget.h"
|
||||
#include <QToolBar>
|
||||
#include <QAction>
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
class ItemsAlignmentEditorWidget : public QToolBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ItemsAlignmentEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
|
||||
explicit ItemsAlignmentEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0);
|
||||
explicit ItemsAlignmentEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0);
|
||||
explicit ItemsAlignmentEditorWidget(PageDesignIntf* page, QWidget *parent = 0);
|
||||
private slots:
|
||||
void slotBrinToFront();
|
||||
void slotSendToBack();
|
||||
void slotAlignToLeft();
|
||||
void slotAlignToRight();
|
||||
void slotAlignToVCenter();
|
||||
void slotAlignToTop();
|
||||
void slotAlignToBottom();
|
||||
void slotAlignToHCenter();
|
||||
void slotSameHeight();
|
||||
void slotSameWidth();
|
||||
private:
|
||||
void initEditor();
|
||||
ReportDesignWidget* m_reportEditor;
|
||||
PageDesignIntf* m_page;
|
||||
|
||||
QAction* m_bringToFront;
|
||||
QAction* m_sendToBack;
|
||||
QAction* m_alignToLeft;
|
||||
QAction* m_alignToRight;
|
||||
QAction* m_alignToVCenter;
|
||||
QAction* m_alignToTop;
|
||||
QAction* m_alignToBottom;
|
||||
QAction* m_alignToHCenter;
|
||||
QAction* m_sameHeight;
|
||||
QAction* m_sameWidth;
|
||||
};
|
||||
|
||||
} //namespace LimeReport
|
||||
|
||||
#endif // LRITEMSALIGNEDITORWIDGET_H
|
154
limereport/items/editors/lritemsborderseditorwidget.cpp
Normal file
154
limereport/items/editors/lritemsborderseditorwidget.cpp
Normal file
@@ -0,0 +1,154 @@
|
||||
/***************************************************************************
|
||||
* This file is part of the Lime Report project *
|
||||
* Copyright (C) 2015 by Alexander Arin *
|
||||
* 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 "lritemsborderseditorwidget.h"
|
||||
#include <QAction>
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
ItemsBordersEditorWidget::ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, const QString& title, QWidget* parent)
|
||||
: ItemEditorWidget(reportEditor,title,parent), m_changing(false)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
ItemsBordersEditorWidget::ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, QWidget* parent)
|
||||
: ItemEditorWidget(reportEditor,parent), m_changing(false)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
void ItemsBordersEditorWidget::setItemEvent(BaseDesignIntf* item)
|
||||
{
|
||||
QVariant borders=item->property("borders");
|
||||
if (borders.isValid()){
|
||||
updateValues((BaseDesignIntf::BorderLines)borders.toInt());
|
||||
setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ItemsBordersEditorWidget::properyChangedEvent(const QString& property, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
Q_UNUSED(oldValue)
|
||||
if (property == "borders"){
|
||||
m_changing = true;
|
||||
updateValues((BaseDesignIntf::BorderLines)newValue.toInt());
|
||||
m_changing = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ItemsBordersEditorWidget::noBordesClicked()
|
||||
{
|
||||
if (reportEditor())
|
||||
reportEditor()->setBorders(0);
|
||||
updateValues(0);
|
||||
}
|
||||
|
||||
void ItemsBordersEditorWidget::allBordesClicked()
|
||||
{
|
||||
int borders = BaseDesignIntf::LeftLine |
|
||||
BaseDesignIntf::RightLine |
|
||||
BaseDesignIntf::TopLine |
|
||||
BaseDesignIntf::BottomLine;
|
||||
|
||||
updateValues((BaseDesignIntf::BorderLines)borders);
|
||||
if (reportEditor())
|
||||
reportEditor()->setBorders((BaseDesignIntf::BorderLines)borders);
|
||||
}
|
||||
|
||||
void ItemsBordersEditorWidget::buttonClicked(bool)
|
||||
{
|
||||
if (!m_changing&&reportEditor())
|
||||
reportEditor()->setBorders(createBorders());
|
||||
}
|
||||
|
||||
void ItemsBordersEditorWidget::initEditor()
|
||||
{
|
||||
|
||||
m_topLine = new QAction(tr("Top line"),this);
|
||||
m_topLine->setIcon(QIcon(":/report/images/topLine"));
|
||||
m_topLine->setCheckable(true);
|
||||
connect(m_topLine,SIGNAL(toggled(bool)),this,SLOT(buttonClicked(bool)));
|
||||
addAction(m_topLine);
|
||||
|
||||
m_bottomLine = new QAction(tr("Bottom line"),this);
|
||||
m_bottomLine->setIcon(QIcon(":/report/images/bottomLine"));
|
||||
m_bottomLine->setCheckable(true);
|
||||
connect(m_bottomLine,SIGNAL(toggled(bool)),this,SLOT(buttonClicked(bool)));
|
||||
addAction(m_bottomLine);
|
||||
|
||||
m_leftLine = new QAction(tr("Left line"),this);
|
||||
m_leftLine->setIcon(QIcon(":/report/images/leftLine"));
|
||||
m_leftLine->setCheckable(true);
|
||||
connect(m_leftLine,SIGNAL(toggled(bool)),this,SLOT(buttonClicked(bool)));
|
||||
addAction(m_leftLine);
|
||||
|
||||
m_rightLine = new QAction(tr("Right line"),this);
|
||||
m_rightLine->setIcon(QIcon(":/report/images/rightLine"));
|
||||
m_rightLine->setCheckable(true);
|
||||
connect(m_rightLine,SIGNAL(toggled(bool)),this,SLOT(buttonClicked(bool)));
|
||||
addAction(m_rightLine);
|
||||
|
||||
addSeparator();
|
||||
|
||||
m_noLines = new QAction(tr("No borders"),this);
|
||||
m_noLines->setIcon(QIcon(":/report/images/noLines"));
|
||||
connect(m_noLines,SIGNAL(triggered()),this,SLOT(noBordesClicked()));
|
||||
addAction(m_noLines);
|
||||
|
||||
m_allLines = new QAction(tr("All borders"),this);
|
||||
m_allLines->setIcon(QIcon(":/report/images/allLines"));
|
||||
connect(m_allLines,SIGNAL(triggered()),this,SLOT(allBordesClicked()));
|
||||
addAction(m_allLines);
|
||||
|
||||
setEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
void ItemsBordersEditorWidget::updateValues(BaseDesignIntf::BorderLines borders)
|
||||
{
|
||||
m_changing = true;
|
||||
m_topLine->setChecked(borders&BaseDesignIntf::TopLine);
|
||||
m_bottomLine->setChecked(borders&BaseDesignIntf::BottomLine);
|
||||
m_leftLine->setChecked(borders&BaseDesignIntf::LeftLine);
|
||||
m_rightLine->setChecked(borders&BaseDesignIntf::RightLine);
|
||||
m_changing = false;
|
||||
}
|
||||
|
||||
BaseDesignIntf::BorderLines ItemsBordersEditorWidget::createBorders()
|
||||
{
|
||||
int borders = 0;
|
||||
borders += (m_topLine->isChecked())?BaseDesignIntf::TopLine:0;
|
||||
borders += (m_bottomLine->isChecked())?BaseDesignIntf::BottomLine:0;
|
||||
borders += (m_leftLine->isChecked())?BaseDesignIntf::LeftLine:0;
|
||||
borders += (m_rightLine->isChecked())?BaseDesignIntf::RightLine:0;
|
||||
return (BaseDesignIntf::BorderLines)borders;
|
||||
}
|
||||
|
||||
} //namespace LimeReport
|
67
limereport/items/editors/lritemsborderseditorwidget.h
Normal file
67
limereport/items/editors/lritemsborderseditorwidget.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/***************************************************************************
|
||||
* This file is part of the Lime Report project *
|
||||
* Copyright (C) 2015 by Alexander Arin *
|
||||
* 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. *
|
||||
****************************************************************************/
|
||||
#ifndef LRITEMSBORDERSEDITORWIDGET_H
|
||||
#define LRITEMSBORDERSEDITORWIDGET_H
|
||||
|
||||
#include <QToolBar>
|
||||
#include "lrreportdesignwidget.h"
|
||||
#include "lritemeditorwidget.h"
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
class ItemsBordersEditorWidget : public ItemEditorWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
|
||||
explicit ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0);
|
||||
private slots:
|
||||
void noBordesClicked();
|
||||
void allBordesClicked();
|
||||
void buttonClicked(bool);
|
||||
protected:
|
||||
void setItemEvent(BaseDesignIntf *item);
|
||||
void properyChangedEvent(const QString &property, const QVariant &oldValue, const QVariant &newValue);
|
||||
private:
|
||||
void initEditor();
|
||||
void updateValues(BaseDesignIntf::BorderLines borders);
|
||||
BaseDesignIntf::BorderLines createBorders();
|
||||
QAction* m_noLines;
|
||||
QAction* m_leftLine;
|
||||
QAction* m_rightLine;
|
||||
QAction* m_topLine;
|
||||
QAction* m_bottomLine;
|
||||
QAction* m_allLines;
|
||||
bool m_changing;
|
||||
};
|
||||
|
||||
}//namespace LimeReport
|
||||
|
||||
#endif // LRITEMSBORDERSEDITORWIDGET_H
|
204
limereport/items/editors/lrtextalignmenteditorwidget.cpp
Normal file
204
limereport/items/editors/lrtextalignmenteditorwidget.cpp
Normal file
@@ -0,0 +1,204 @@
|
||||
/***************************************************************************
|
||||
* This file is part of the Lime Report project *
|
||||
* Copyright (C) 2015 by Alexander Arin *
|
||||
* 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 "lrtextalignmenteditorwidget.h"
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
TextAlignmentEditorWidget::TextAlignmentEditorWidget(ReportDesignWidget *reportEditor, const QString &title, QWidget *parent)
|
||||
:ItemEditorWidget(reportEditor,title,parent), m_textAttibutesIsChanging(false)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
TextAlignmentEditorWidget::TextAlignmentEditorWidget(ReportDesignWidget *reportEditor, QWidget *parent)
|
||||
:ItemEditorWidget(reportEditor,parent), m_textAttibutesIsChanging(false)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
TextAlignmentEditorWidget::TextAlignmentEditorWidget(PageDesignIntf* page, const QString& title, QWidget* parent)
|
||||
:ItemEditorWidget(page,title,parent), m_textAttibutesIsChanging(false)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
TextAlignmentEditorWidget::TextAlignmentEditorWidget(PageDesignIntf* page, QWidget* parent)
|
||||
:ItemEditorWidget(page,parent), m_textAttibutesIsChanging(false)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidget::setItemEvent(BaseDesignIntf *item)
|
||||
{
|
||||
QVariant align=item->property("alignment");
|
||||
if (align.isValid()){
|
||||
updateValues(Qt::Alignment(align.value<int>()));
|
||||
setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidget::initEditor()
|
||||
{
|
||||
m_textAliginLeft = new QAction(tr("Text align left"),this);
|
||||
m_textAliginLeft->setIcon(QIcon(":/report/images/textAlignHLeft"));
|
||||
m_textAliginLeft->setCheckable(true);
|
||||
connect(m_textAliginLeft,SIGNAL(toggled(bool)),this,SLOT(slotTextHAttribsChanged(bool)));
|
||||
addAction(m_textAliginLeft);
|
||||
|
||||
m_textAliginHCenter = new QAction(tr("Text align center"),this);
|
||||
m_textAliginHCenter->setIcon(QIcon(":/report/images/textAlignHCenter"));
|
||||
m_textAliginHCenter->setCheckable(true);
|
||||
connect(m_textAliginHCenter,SIGNAL(toggled(bool)),this,SLOT(slotTextHAttribsChanged(bool)));
|
||||
addAction(m_textAliginHCenter);
|
||||
|
||||
m_textAliginRight = new QAction(tr("Text align right"),this);
|
||||
m_textAliginRight->setIcon(QIcon(":/report/images/textAlignHRight"));
|
||||
m_textAliginRight->setCheckable(true);
|
||||
connect(m_textAliginRight,SIGNAL(toggled(bool)),this,SLOT(slotTextHAttribsChanged(bool)));
|
||||
addAction(m_textAliginRight);
|
||||
|
||||
m_textAliginJustify = new QAction(tr("Text align justify"),this);
|
||||
m_textAliginJustify->setIcon(QIcon(":/report/images/textAlignHJustify"));
|
||||
m_textAliginJustify->setCheckable(true);
|
||||
connect(m_textAliginJustify,SIGNAL(toggled(bool)),this,SLOT(slotTextHAttribsChanged(bool)));
|
||||
addAction(m_textAliginJustify);
|
||||
|
||||
addSeparator();
|
||||
|
||||
m_textAliginTop = new QAction(tr("Text align top"),this);
|
||||
m_textAliginTop->setIcon(QIcon(":/report/images/textAlignVTop"));
|
||||
m_textAliginTop->setCheckable(true);
|
||||
connect(m_textAliginTop,SIGNAL(toggled(bool)),this,SLOT(slotTextVAttribsChanged(bool)));
|
||||
addAction(m_textAliginTop);
|
||||
|
||||
m_textAliginVCenter = new QAction(tr("Text align center"),this);
|
||||
m_textAliginVCenter->setIcon(QIcon(":/report/images/textAlignVCenter"));
|
||||
m_textAliginVCenter->setCheckable(true);
|
||||
connect(m_textAliginVCenter,SIGNAL(toggled(bool)),this,SLOT(slotTextVAttribsChanged(bool)));
|
||||
addAction(m_textAliginVCenter);
|
||||
|
||||
m_textAliginBottom = new QAction(tr("Text align bottom"),this);
|
||||
m_textAliginBottom->setIcon(QIcon(":/report/images/textAlignVBottom"));
|
||||
m_textAliginBottom->setCheckable(true);
|
||||
connect(m_textAliginBottom,SIGNAL(toggled(bool)),this,SLOT(slotTextVAttribsChanged(bool)));
|
||||
addAction(m_textAliginBottom);
|
||||
|
||||
if (reportEditor()){
|
||||
connect(reportEditor(),SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
|
||||
this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant)));
|
||||
}
|
||||
if (page()){
|
||||
connect(page(),SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
|
||||
this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant)));
|
||||
}
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidget::updateValues(const Qt::Alignment &align)
|
||||
{
|
||||
m_textAttibutesIsChanging=true;
|
||||
m_textAliginLeft->setChecked((align & Qt::AlignLeft)==Qt::AlignLeft);
|
||||
m_textAliginRight->setChecked((align & Qt::AlignRight)==Qt::AlignRight);
|
||||
m_textAliginHCenter->setChecked((align & Qt::AlignHCenter)==Qt::AlignHCenter);
|
||||
m_textAliginJustify->setChecked((align & Qt::AlignJustify)==Qt::AlignJustify);
|
||||
m_textAliginTop->setChecked((align & Qt::AlignTop)==Qt::AlignTop);
|
||||
m_textAliginVCenter->setChecked((align & Qt::AlignVCenter)==Qt::AlignVCenter);
|
||||
m_textAliginBottom->setChecked((align & Qt::AlignBottom)==Qt::AlignBottom);
|
||||
m_textAttibutesIsChanging=false;
|
||||
}
|
||||
|
||||
Qt::Alignment TextAlignmentEditorWidget::createAlignment()
|
||||
{
|
||||
Qt::Alignment align = 0 ;
|
||||
if (m_textAliginLeft->isChecked()) align |= Qt::AlignLeft;
|
||||
if (m_textAliginHCenter->isChecked()) align |= Qt::AlignHCenter;
|
||||
if (m_textAliginRight->isChecked()) align |= Qt::AlignRight;
|
||||
if (m_textAliginJustify->isChecked()) align |= Qt::AlignJustify;
|
||||
if (m_textAliginTop->isChecked()) align |= Qt::AlignTop;
|
||||
if (m_textAliginVCenter->isChecked()) align |= Qt::AlignVCenter;
|
||||
if (m_textAliginBottom->isChecked()) align |= Qt::AlignBottom;
|
||||
return align;
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidget::slotTextHAttribsChanged(bool)
|
||||
{
|
||||
if (m_textAttibutesIsChanging) return;
|
||||
m_textAttibutesIsChanging = true;
|
||||
|
||||
m_textAliginLeft->setChecked(sender()==m_textAliginLeft);
|
||||
m_textAliginHCenter->setChecked(sender()==m_textAliginHCenter);
|
||||
m_textAliginRight->setChecked(sender()==m_textAliginRight);
|
||||
m_textAliginJustify->setChecked(sender()==m_textAliginJustify);
|
||||
|
||||
int flag = 0;
|
||||
if (sender()==m_textAliginLeft) flag |= Qt::AlignLeft;
|
||||
if (sender()==m_textAliginHCenter) flag |= Qt::AlignHCenter;
|
||||
if (sender()==m_textAliginRight) flag |= Qt::AlignRight;
|
||||
if (sender()==m_textAliginJustify) flag |= Qt::AlignJustify;
|
||||
|
||||
if (reportEditor()) reportEditor()->setTextAlign(true,Qt::AlignmentFlag(flag));
|
||||
if (page()) {
|
||||
//page()->setTextAlign(createAlignment());
|
||||
page()->changeSelectedGrpoupTextAlignPropperty(true,Qt::AlignmentFlag(flag));
|
||||
}
|
||||
m_textAttibutesIsChanging = false;
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidget::slotTextVAttribsChanged(bool)
|
||||
{
|
||||
if (m_textAttibutesIsChanging) return;
|
||||
m_textAttibutesIsChanging = true;
|
||||
|
||||
m_textAliginTop->setChecked(sender()==m_textAliginTop);
|
||||
m_textAliginVCenter->setChecked(sender()==m_textAliginVCenter);
|
||||
m_textAliginBottom->setChecked(sender()==m_textAliginBottom);
|
||||
|
||||
int flag = 0;
|
||||
if (sender()==m_textAliginTop) flag |= Qt::AlignTop;
|
||||
if (sender()==m_textAliginVCenter) flag |= Qt::AlignVCenter;
|
||||
if (sender()==m_textAliginBottom) flag |= Qt::AlignBottom;
|
||||
|
||||
if (reportEditor()) reportEditor()->setTextAlign(false,Qt::AlignmentFlag(flag));
|
||||
if (page()) page()->changeSelectedGrpoupTextAlignPropperty(false,Qt::AlignmentFlag(flag) );
|
||||
m_textAttibutesIsChanging = false;
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidget::slotPropertyChanged(const QString &objectName, const QString &property, const QVariant &oldValue, const QVariant &newValue)
|
||||
{
|
||||
Q_UNUSED(oldValue)
|
||||
Q_UNUSED(newValue)
|
||||
|
||||
if (item()&&(item()->objectName()==objectName)&&(property=="alignment")){
|
||||
updateValues(Qt::Alignment(item()->property("alignment").value<int>()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} //namespace LimeReport
|
73
limereport/items/editors/lrtextalignmenteditorwidget.h
Normal file
73
limereport/items/editors/lrtextalignmenteditorwidget.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/***************************************************************************
|
||||
* This file is part of the Lime Report project *
|
||||
* Copyright (C) 2015 by Alexander Arin *
|
||||
* 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. *
|
||||
****************************************************************************/
|
||||
#ifndef LRTEXTALIGNMENTEDITORWIDGET_H
|
||||
#define LRTEXTALIGNMENTEDITORWIDGET_H
|
||||
|
||||
#include "lrreportdesignwidget.h"
|
||||
#include "lritemeditorwidget.h"
|
||||
#include <QToolBar>
|
||||
#include <QAction>
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
class TextAlignmentEditorWidget:public ItemEditorWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TextAlignmentEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
|
||||
explicit TextAlignmentEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0);
|
||||
explicit TextAlignmentEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0);
|
||||
explicit TextAlignmentEditorWidget(PageDesignIntf* page, QWidget *parent = 0);
|
||||
protected:
|
||||
void setItemEvent(BaseDesignIntf *item);
|
||||
private:
|
||||
void initEditor();
|
||||
void updateValues(const Qt::Alignment& align);
|
||||
Qt::Alignment createAlignment();
|
||||
private slots:
|
||||
void slotTextHAttribsChanged(bool);
|
||||
void slotTextVAttribsChanged(bool);
|
||||
void slotPropertyChanged(const QString& objectName, const QString& property, const QVariant &oldValue, const QVariant &newValue);
|
||||
private:
|
||||
bool m_textAttibutesIsChanging;
|
||||
|
||||
QAction* m_textAliginLeft;
|
||||
QAction* m_textAliginRight;
|
||||
QAction* m_textAliginHCenter;
|
||||
QAction* m_textAliginJustify;
|
||||
QAction* m_textAliginTop;
|
||||
QAction* m_textAliginBottom;
|
||||
QAction* m_textAliginVCenter;
|
||||
|
||||
};
|
||||
|
||||
} //namespace LimeReport
|
||||
|
||||
#endif // LRTEXTALIGNMENTEDITORWIDGET_H
|
Reference in New Issue
Block a user