mirror of
https://github.com/fralx/LimeReport.git
synced 2025-11-25 08:28:06 +03:00
Define code style and format all source file using clang-format-14
except those placed in 3rdparty directories.
This commit is contained in:
@@ -29,10 +29,11 @@
|
||||
****************************************************************************/
|
||||
#include "lrfonteditorwidget.h"
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
FontEditorWidget::FontEditorWidget(const QString& title, QWidget* parent)
|
||||
:ItemEditorWidget(title, parent), m_ignoreSlots(false)
|
||||
FontEditorWidget::FontEditorWidget(const QString& title, QWidget* parent):
|
||||
ItemEditorWidget(title, parent),
|
||||
m_ignoreSlots(false)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
@@ -40,91 +41,107 @@ FontEditorWidget::FontEditorWidget(const QString& title, QWidget* parent)
|
||||
void FontEditorWidget::setItemEvent(BaseDesignIntf* item)
|
||||
{
|
||||
|
||||
QVariant font=item->property("font");
|
||||
if (font.isValid()){
|
||||
QVariant font = item->property("font");
|
||||
if (font.isValid()) {
|
||||
updateValues(font.value<QFont>());
|
||||
setEnabled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FontEditorWidget::initEditor()
|
||||
{
|
||||
setIconSize(QSize(24,24));
|
||||
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)));
|
||||
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_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);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3)
|
||||
connect(m_fontSizeEditor,SIGNAL(currentTextChanged(QString)),this,SLOT(slotFontSizeChanged(QString)));
|
||||
connect(m_fontSizeEditor, SIGNAL(currentTextChanged(QString)), this,
|
||||
SLOT(slotFontSizeChanged(QString)));
|
||||
#else
|
||||
connect(m_fontSizeEditor,SIGNAL(currentIndexChanged(QString)),this,SLOT(slotFontSizeChanged(QString)));
|
||||
connect(m_fontSizeEditor, SIGNAL(currentIndexChanged(QString)), this,
|
||||
SLOT(slotFontSizeChanged(QString)));
|
||||
#endif
|
||||
addWidget(m_fontSizeEditor);
|
||||
|
||||
addSeparator();
|
||||
setEnabled(false);
|
||||
|
||||
m_fontBold = new QAction(tr("Font bold"),this);
|
||||
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)));
|
||||
connect(m_fontBold, SIGNAL(toggled(bool)), this, SLOT(slotFontAttribsChanged(bool)));
|
||||
addAction(m_fontBold);
|
||||
|
||||
m_fontItalic = new QAction(tr("Font Italic"),this);
|
||||
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)));
|
||||
connect(m_fontItalic, SIGNAL(toggled(bool)), this, SLOT(slotFontAttribsChanged(bool)));
|
||||
addAction(m_fontItalic);
|
||||
|
||||
m_fontUnderline = new QAction(tr("Font Underline"),this);
|
||||
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)));
|
||||
connect(m_fontUnderline, SIGNAL(toggled(bool)), this, SLOT(slotFontAttribsChanged(bool)));
|
||||
addAction(m_fontUnderline);
|
||||
|
||||
}
|
||||
|
||||
void FontEditorWidget::updateValues(const QFont& font)
|
||||
{
|
||||
m_ignoreSlots=true;
|
||||
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;
|
||||
}
|
||||
|
||||
bool FontEditorWidget::ignoreSlots() const
|
||||
{
|
||||
return m_ignoreSlots;
|
||||
m_ignoreSlots = false;
|
||||
}
|
||||
|
||||
bool FontEditorWidget::ignoreSlots() const { return m_ignoreSlots; }
|
||||
|
||||
void FontEditorWidget::slotFontChanged(const QFont& /*font*/)
|
||||
{
|
||||
//if (page()) page()->setFont(font);
|
||||
// if (page()) page()->setFont(font);
|
||||
}
|
||||
|
||||
void FontEditorWidget::slotFontSizeChanged(const QString &value)
|
||||
void FontEditorWidget::slotFontSizeChanged(const QString& value)
|
||||
{
|
||||
if (m_ignoreSlots) return;
|
||||
if (m_ignoreSlots)
|
||||
return;
|
||||
m_resFont = fontNameEditor()->currentFont();
|
||||
m_resFont.setPointSize(value.toInt());
|
||||
}
|
||||
|
||||
void FontEditorWidget::slotFontAttribsChanged(bool)
|
||||
{
|
||||
if (m_ignoreSlots) return;
|
||||
if (m_ignoreSlots)
|
||||
return;
|
||||
m_resFont = m_fontNameEditor->currentFont();
|
||||
m_resFont.setPointSize(m_fontSizeEditor->currentText().toInt());
|
||||
m_resFont.setBold(m_fontBold->isChecked());
|
||||
@@ -132,16 +149,16 @@ void FontEditorWidget::slotFontAttribsChanged(bool)
|
||||
m_resFont.setUnderline(m_fontUnderline->isChecked());
|
||||
}
|
||||
|
||||
void FontEditorWidget::slotPropertyChanged(const QString &objectName, const QString &property, const QVariant& oldValue, const QVariant& newValue)
|
||||
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")){
|
||||
if (item() && (item()->objectName() == objectName) && (property == "font")) {
|
||||
updateValues(item()->property("font").value<QFont>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FontEditorWidgetForPage::slotFontChanged(const QFont& font)
|
||||
{
|
||||
if (!ignoreSlots())
|
||||
@@ -150,7 +167,7 @@ void FontEditorWidgetForPage::slotFontChanged(const QFont& font)
|
||||
|
||||
void FontEditorWidgetForPage::slotFontSizeChanged(const QString& value)
|
||||
{
|
||||
if (!ignoreSlots()){
|
||||
if (!ignoreSlots()) {
|
||||
FontEditorWidget::slotFontSizeChanged(value);
|
||||
m_page->setFont(resFont());
|
||||
}
|
||||
@@ -158,7 +175,7 @@ void FontEditorWidgetForPage::slotFontSizeChanged(const QString& value)
|
||||
|
||||
void FontEditorWidgetForPage::slotFontAttribsChanged(bool value)
|
||||
{
|
||||
if (!ignoreSlots()){
|
||||
if (!ignoreSlots()) {
|
||||
FontEditorWidget::slotFontAttribsChanged(value);
|
||||
m_page->setFont(resFont());
|
||||
}
|
||||
@@ -167,18 +184,19 @@ void FontEditorWidgetForPage::slotFontAttribsChanged(bool value)
|
||||
#ifdef HAVE_REPORT_DESIGNER
|
||||
void FontEditorWidgetForDesigner::initEditor()
|
||||
{
|
||||
connect(m_reportEditor,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
|
||||
this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant)));
|
||||
connect(m_reportEditor, SIGNAL(itemPropertyChanged(QString, QString, QVariant, QVariant)), this,
|
||||
SLOT(slotPropertyChanged(QString, QString, QVariant, QVariant)));
|
||||
}
|
||||
|
||||
void FontEditorWidgetForDesigner::slotFontChanged(const QFont& font)
|
||||
{
|
||||
if (!ignoreSlots()) m_reportEditor->setFont(font);
|
||||
if (!ignoreSlots())
|
||||
m_reportEditor->setFont(font);
|
||||
}
|
||||
|
||||
void FontEditorWidgetForDesigner::slotFontSizeChanged(const QString& value)
|
||||
{
|
||||
if (!ignoreSlots()){
|
||||
if (!ignoreSlots()) {
|
||||
FontEditorWidget::slotFontSizeChanged(value);
|
||||
m_reportEditor->setFont(resFont());
|
||||
}
|
||||
@@ -186,7 +204,7 @@ void FontEditorWidgetForDesigner::slotFontSizeChanged(const QString& value)
|
||||
|
||||
void FontEditorWidgetForDesigner::slotFontAttribsChanged(bool value)
|
||||
{
|
||||
if (!ignoreSlots()){
|
||||
if (!ignoreSlots()) {
|
||||
FontEditorWidget::slotFontAttribsChanged(value);
|
||||
m_reportEditor->setFont(resFont());
|
||||
}
|
||||
@@ -194,5 +212,4 @@ void FontEditorWidgetForDesigner::slotFontAttribsChanged(bool value)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
} //namespace LimeReport
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
#ifndef LRFONTEDITORWIDGET_H
|
||||
#define LRFONTEDITORWIDGET_H
|
||||
|
||||
#include <QToolBar>
|
||||
#include <QAction>
|
||||
#include <QFontComboBox>
|
||||
#include <QStringListModel>
|
||||
#include <QAction>
|
||||
#include <QToolBar>
|
||||
|
||||
#ifdef HAVE_REPORT_DESIGNER
|
||||
#include "lrreportdesignwidget.h"
|
||||
@@ -41,27 +41,30 @@
|
||||
|
||||
#include "lritemeditorwidget.h"
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
class FontEditorWidget :public ItemEditorWidget{
|
||||
class FontEditorWidget: public ItemEditorWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FontEditorWidget(const QString &title, QWidget *parent = 0);
|
||||
explicit FontEditorWidget(const QString& title, QWidget* parent = 0);
|
||||
bool ignoreSlots() const;
|
||||
|
||||
protected:
|
||||
void setItemEvent(BaseDesignIntf *item);
|
||||
QFontComboBox* fontNameEditor(){return m_fontNameEditor;}
|
||||
void setItemEvent(BaseDesignIntf* item);
|
||||
QFontComboBox* fontNameEditor() { return m_fontNameEditor; }
|
||||
void initEditor();
|
||||
protected slots:
|
||||
virtual void slotFontChanged(const QFont&);
|
||||
virtual void slotFontSizeChanged(const QString& value);
|
||||
virtual void slotFontAttribsChanged(bool);
|
||||
void slotPropertyChanged(const QString& objectName, const QString& property, const QVariant &oldValue, const QVariant &newValue);
|
||||
protected:
|
||||
QFont resFont(){return m_resFont;}
|
||||
private:
|
||||
void slotPropertyChanged(const QString& objectName, const QString& property,
|
||||
const QVariant& oldValue, const QVariant& newValue);
|
||||
|
||||
void updateValues(const QFont &font);
|
||||
protected:
|
||||
QFont resFont() { return m_resFont; }
|
||||
|
||||
private:
|
||||
void updateValues(const QFont& font);
|
||||
|
||||
QFontComboBox* m_fontNameEditor;
|
||||
QComboBox* m_fontSizeEditor;
|
||||
@@ -73,28 +76,37 @@ private:
|
||||
|
||||
bool m_ignoreSlots;
|
||||
QFont m_resFont;
|
||||
|
||||
};
|
||||
|
||||
class FontEditorWidgetForPage : public FontEditorWidget{
|
||||
class FontEditorWidgetForPage: public FontEditorWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FontEditorWidgetForPage(PageDesignIntf* page, const QString &title, QWidget *parent = 0)
|
||||
: FontEditorWidget(title, parent), m_page(page){}
|
||||
explicit FontEditorWidgetForPage(PageDesignIntf* page, const QString& title,
|
||||
QWidget* parent = 0):
|
||||
FontEditorWidget(title, parent),
|
||||
m_page(page)
|
||||
{
|
||||
}
|
||||
protected slots:
|
||||
virtual void slotFontChanged(const QFont& font);
|
||||
virtual void slotFontSizeChanged(const QString& value);
|
||||
virtual void slotFontAttribsChanged(bool value);
|
||||
|
||||
private:
|
||||
PageDesignIntf* m_page;
|
||||
};
|
||||
|
||||
#ifdef HAVE_REPORT_DESIGNER
|
||||
class FontEditorWidgetForDesigner : public FontEditorWidget{
|
||||
class FontEditorWidgetForDesigner: public FontEditorWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FontEditorWidgetForDesigner(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0)
|
||||
: FontEditorWidget(title, parent), m_reportEditor(reportEditor){initEditor();}
|
||||
explicit FontEditorWidgetForDesigner(ReportDesignWidget* reportEditor, const QString& title,
|
||||
QWidget* parent = 0):
|
||||
FontEditorWidget(title, parent),
|
||||
m_reportEditor(reportEditor)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
protected:
|
||||
void initEditor();
|
||||
@@ -102,11 +114,12 @@ protected slots:
|
||||
virtual void slotFontChanged(const QFont& font);
|
||||
virtual void slotFontSizeChanged(const QString& value);
|
||||
virtual void slotFontAttribsChanged(bool value);
|
||||
|
||||
private:
|
||||
ReportDesignWidget* m_reportEditor;
|
||||
};
|
||||
#endif
|
||||
|
||||
} //namespace LimeReport
|
||||
} // namespace LimeReport
|
||||
|
||||
#endif // LRFONTEDITORWIDGET_H
|
||||
|
||||
@@ -29,22 +29,24 @@
|
||||
****************************************************************************/
|
||||
#include "lritemeditorwidget.h"
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
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)));
|
||||
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)
|
||||
void ItemEditorWidget::properyChangedEvent(const QString& propertName, const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
Q_UNUSED(propertName)
|
||||
Q_UNUSED(oldValue)
|
||||
@@ -53,19 +55,16 @@ void ItemEditorWidget::properyChangedEvent(const QString& propertName, const QVa
|
||||
|
||||
void ItemEditorWidget::slotItemDestroyed(QObject* item)
|
||||
{
|
||||
if (item==m_item) {
|
||||
if (item == m_item) {
|
||||
m_item = 0;
|
||||
setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ItemEditorWidget::slotPropertyChanged(const QString& propertName, const QVariant& oldValue, const QVariant& newValue)
|
||||
void ItemEditorWidget::slotPropertyChanged(const QString& propertName, const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
properyChangedEvent(propertName,oldValue,newValue);
|
||||
properyChangedEvent(propertName, oldValue, newValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -39,20 +39,26 @@
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
class ItemEditorWidget : public QToolBar
|
||||
{
|
||||
class ItemEditorWidget: public QToolBar {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ItemEditorWidget(const QString &title, QWidget *parent = 0)
|
||||
: QToolBar(title, parent), m_item(0){}
|
||||
void setItem(BaseDesignIntf *item);
|
||||
explicit ItemEditorWidget(const QString& title, QWidget* parent = 0):
|
||||
QToolBar(title, parent),
|
||||
m_item(0)
|
||||
{
|
||||
}
|
||||
void setItem(BaseDesignIntf* item);
|
||||
|
||||
protected:
|
||||
virtual void setItemEvent(BaseDesignIntf*){}
|
||||
virtual void properyChangedEvent(const QString& propertName, const QVariant& oldValue, const QVariant& newValue);
|
||||
BaseDesignIntf* item(){return m_item;}
|
||||
virtual void setItemEvent(BaseDesignIntf*) { }
|
||||
virtual void properyChangedEvent(const QString& propertName, const QVariant& oldValue,
|
||||
const QVariant& newValue);
|
||||
BaseDesignIntf* item() { return m_item; }
|
||||
private slots:
|
||||
void slotItemDestroyed(QObject* item);
|
||||
void slotPropertyChanged(const QString& propertName, const QVariant& oldValue, const QVariant& newValue);
|
||||
void slotPropertyChanged(const QString& propertName, const QVariant& oldValue,
|
||||
const QVariant& newValue);
|
||||
|
||||
private:
|
||||
BaseDesignIntf* m_item;
|
||||
};
|
||||
|
||||
@@ -29,143 +29,174 @@
|
||||
****************************************************************************/
|
||||
#include "lritemsaligneditorwidget.h"
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
ItemsAlignmentEditorWidget::ItemsAlignmentEditorWidget(LimeReport::ReportDesignWidget* reportEditor, const QString& title, QWidget* parent)
|
||||
:QToolBar(title,parent), m_reportEditor(reportEditor), m_page(0)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
ItemsAlignmentEditorWidget::ItemsAlignmentEditorWidget(PageDesignIntf* page, QWidget* parent):
|
||||
QToolBar(parent),
|
||||
m_reportEditor(0),
|
||||
m_page(page)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
void ItemsAlignmentEditorWidget::slotBringToFront()
|
||||
{
|
||||
if (m_reportEditor) m_reportEditor->bringToFront();
|
||||
if (m_page) m_page->bringToFront();
|
||||
if (m_reportEditor)
|
||||
m_reportEditor->bringToFront();
|
||||
if (m_page)
|
||||
m_page->bringToFront();
|
||||
}
|
||||
|
||||
void ItemsAlignmentEditorWidget::slotSendToBack()
|
||||
{
|
||||
if (m_reportEditor) m_reportEditor->sendToBack();
|
||||
if (m_page) m_page->sendToBack();
|
||||
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();
|
||||
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();
|
||||
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();
|
||||
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();
|
||||
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();
|
||||
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();
|
||||
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();
|
||||
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();
|
||||
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 = new QAction(tr("Bring to top"), this);
|
||||
m_bringToFront->setIcon(QIcon(":/report/images/bringToTop"));
|
||||
connect(m_bringToFront,SIGNAL(triggered()),this,SLOT(slotBringToFront()));
|
||||
connect(m_bringToFront, SIGNAL(triggered()), this, SLOT(slotBringToFront()));
|
||||
addAction(m_bringToFront);
|
||||
|
||||
m_sendToBack = new QAction(tr("Send to back"),this);
|
||||
m_sendToBack = new QAction(tr("Send to back"), this);
|
||||
m_sendToBack->setIcon(QIcon(":/report/images/sendToBack"));
|
||||
connect(m_sendToBack,SIGNAL(triggered()),this,SLOT(slotSendToBack()));
|
||||
connect(m_sendToBack, SIGNAL(triggered()), this, SLOT(slotSendToBack()));
|
||||
addAction(m_sendToBack);
|
||||
|
||||
m_alignToLeft = new QAction(tr("Align to left"),this);
|
||||
m_alignToLeft = new QAction(tr("Align to left"), this);
|
||||
m_alignToLeft->setIcon(QIcon(":/report/images/alignToLeft"));
|
||||
connect(m_alignToLeft,SIGNAL(triggered()),this,SLOT(slotAlignToLeft()));
|
||||
connect(m_alignToLeft, SIGNAL(triggered()), this, SLOT(slotAlignToLeft()));
|
||||
addAction(m_alignToLeft);
|
||||
|
||||
m_alignToRight = new QAction(tr("Align to right"),this);
|
||||
m_alignToRight = new QAction(tr("Align to right"), this);
|
||||
m_alignToRight->setIcon(QIcon(":/report/images/alignToRight"));
|
||||
connect(m_alignToRight,SIGNAL(triggered()),this,SLOT(slotAlignToRight()));
|
||||
connect(m_alignToRight, SIGNAL(triggered()), this, SLOT(slotAlignToRight()));
|
||||
addAction(m_alignToRight);
|
||||
|
||||
m_alignToVCenter = new QAction(tr("Align to vertical center"),this);
|
||||
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()));
|
||||
connect(m_alignToVCenter, SIGNAL(triggered()), this, SLOT(slotAlignToVCenter()));
|
||||
addAction(m_alignToVCenter);
|
||||
|
||||
m_alignToTop = new QAction(tr("Align to top"),this);
|
||||
m_alignToTop = new QAction(tr("Align to top"), this);
|
||||
m_alignToTop->setIcon(QIcon(":/report/images/alignToTop"));
|
||||
connect(m_alignToTop,SIGNAL(triggered()),this,SLOT(slotAlignToTop()));
|
||||
connect(m_alignToTop, SIGNAL(triggered()), this, SLOT(slotAlignToTop()));
|
||||
addAction(m_alignToTop);
|
||||
|
||||
m_alignToBottom = new QAction(tr("Align to bottom"),this);
|
||||
m_alignToBottom = new QAction(tr("Align to bottom"), this);
|
||||
m_alignToBottom->setIcon(QIcon(":/report/images/alignToBottom"));
|
||||
connect(m_alignToBottom,SIGNAL(triggered()),this,SLOT(slotAlignToBottom()));
|
||||
connect(m_alignToBottom, SIGNAL(triggered()), this, SLOT(slotAlignToBottom()));
|
||||
addAction(m_alignToBottom);
|
||||
|
||||
m_alignToHCenter = new QAction(tr("Align to horizontal center"),this);
|
||||
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()));
|
||||
connect(m_alignToHCenter, SIGNAL(triggered()), this, SLOT(slotAlignToHCenter()));
|
||||
addAction(m_alignToHCenter);
|
||||
|
||||
m_sameHeight = new QAction(tr("Set same height"),this);
|
||||
m_sameHeight = new QAction(tr("Set same height"), this);
|
||||
m_sameHeight->setIcon(QIcon(":/report/images/sameHeight"));
|
||||
connect(m_sameHeight,SIGNAL(triggered()),this,SLOT(slotSameHeight()));
|
||||
connect(m_sameHeight, SIGNAL(triggered()), this, SLOT(slotSameHeight()));
|
||||
addAction(m_sameHeight);
|
||||
|
||||
m_sameWidth = new QAction(tr("Set same width"),this);
|
||||
m_sameWidth = new QAction(tr("Set same width"), this);
|
||||
m_sameWidth->setIcon(QIcon(":/report/images/sameWidth"));
|
||||
connect(m_sameWidth,SIGNAL(triggered()),this,SLOT(slotSameWidth()));
|
||||
connect(m_sameWidth, SIGNAL(triggered()), this, SLOT(slotSameWidth()));
|
||||
addAction(m_sameWidth);
|
||||
}
|
||||
|
||||
} //namespace LimeReport
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -31,19 +31,21 @@
|
||||
#define LRITEMSALIGNEDITORWIDGET_H
|
||||
|
||||
#include "lrreportdesignwidget.h"
|
||||
#include <QToolBar>
|
||||
|
||||
#include <QAction>
|
||||
#include <QToolBar>
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
class ItemsAlignmentEditorWidget : public QToolBar
|
||||
{
|
||||
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);
|
||||
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 slotBringToFront();
|
||||
void slotSendToBack();
|
||||
@@ -55,6 +57,7 @@ private slots:
|
||||
void slotAlignToHCenter();
|
||||
void slotSameHeight();
|
||||
void slotSameWidth();
|
||||
|
||||
private:
|
||||
void initEditor();
|
||||
ReportDesignWidget* m_reportEditor;
|
||||
@@ -72,6 +75,6 @@ private:
|
||||
QAction* m_sameWidth;
|
||||
};
|
||||
|
||||
} //namespace LimeReport
|
||||
} // namespace LimeReport
|
||||
|
||||
#endif // LRITEMSALIGNEDITORWIDGET_H
|
||||
|
||||
@@ -28,57 +28,56 @@
|
||||
* GNU General Public License for more details. *
|
||||
****************************************************************************/
|
||||
#include "lritemsborderseditorwidget.h"
|
||||
#include <QAction>
|
||||
|
||||
#include "lrbordereditor.h"
|
||||
namespace LimeReport{
|
||||
|
||||
#include <QAction>
|
||||
namespace LimeReport {
|
||||
|
||||
void ItemsBordersEditorWidget::setItemEvent(BaseDesignIntf* item)
|
||||
{
|
||||
if(QString(item->metaObject()->className()) == "LimeReport::ShapeItem")
|
||||
{
|
||||
if (QString(item->metaObject()->className()) == "LimeReport::ShapeItem") {
|
||||
setDisabled(true);
|
||||
return;
|
||||
}
|
||||
QVariant borders=item->property("borders");
|
||||
if (borders.isValid()){
|
||||
QVariant borders = item->property("borders");
|
||||
if (borders.isValid()) {
|
||||
updateValues((BaseDesignIntf::BorderLines)borders.toInt());
|
||||
setEnabled(true);
|
||||
}
|
||||
m_item = item;
|
||||
}
|
||||
|
||||
void ItemsBordersEditorWidget::properyChangedEvent(const QString& property, const QVariant& oldValue, const QVariant& newValue)
|
||||
void ItemsBordersEditorWidget::properyChangedEvent(const QString& property,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
Q_UNUSED(oldValue)
|
||||
if (property == "borders"){
|
||||
if (property == "borders") {
|
||||
m_changing = true;
|
||||
updateValues((BaseDesignIntf::BorderLines)newValue.toInt());
|
||||
m_changing = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ItemsBordersEditorWidget::noBordesClicked()
|
||||
{
|
||||
updateValues({});
|
||||
}
|
||||
void ItemsBordersEditorWidget::noBordesClicked() { updateValues({}); }
|
||||
|
||||
void ItemsBordersEditorWidget::allBordesClicked()
|
||||
{
|
||||
int borders = BaseDesignIntf::LeftLine |
|
||||
BaseDesignIntf::RightLine |
|
||||
BaseDesignIntf::TopLine |
|
||||
BaseDesignIntf::BottomLine;
|
||||
int borders = BaseDesignIntf::LeftLine | BaseDesignIntf::RightLine | BaseDesignIntf::TopLine
|
||||
| BaseDesignIntf::BottomLine;
|
||||
|
||||
updateValues((BaseDesignIntf::BorderLines)borders);
|
||||
}
|
||||
|
||||
void ItemsBordersEditorWidget::buttonClicked(bool){}
|
||||
void ItemsBordersEditorWidget::buttonClicked(bool) { }
|
||||
|
||||
void ItemsBordersEditorWidget::editBorderClicked()
|
||||
{
|
||||
BorderEditor be;
|
||||
be.loadItem(m_item);
|
||||
if ( be.exec() == QDialog::Rejected ) return;
|
||||
if (be.exec() == QDialog::Rejected)
|
||||
return;
|
||||
updateValues(be.borderSides());
|
||||
m_item->setBorderLinesFlags(be.borderSides());
|
||||
m_item->setBorderLineSize(be.borderWidth());
|
||||
@@ -89,49 +88,48 @@ void ItemsBordersEditorWidget::editBorderClicked()
|
||||
void ItemsBordersEditorWidget::initEditor()
|
||||
{
|
||||
|
||||
m_topLine = new QAction(tr("Top line"),this);
|
||||
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)));
|
||||
connect(m_topLine, SIGNAL(toggled(bool)), this, SLOT(buttonClicked(bool)));
|
||||
addAction(m_topLine);
|
||||
|
||||
m_bottomLine = new QAction(tr("Bottom line"),this);
|
||||
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)));
|
||||
connect(m_bottomLine, SIGNAL(toggled(bool)), this, SLOT(buttonClicked(bool)));
|
||||
addAction(m_bottomLine);
|
||||
|
||||
m_leftLine = new QAction(tr("Left line"),this);
|
||||
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)));
|
||||
connect(m_leftLine, SIGNAL(toggled(bool)), this, SLOT(buttonClicked(bool)));
|
||||
addAction(m_leftLine);
|
||||
|
||||
m_rightLine = new QAction(tr("Right line"),this);
|
||||
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)));
|
||||
connect(m_rightLine, SIGNAL(toggled(bool)), this, SLOT(buttonClicked(bool)));
|
||||
addAction(m_rightLine);
|
||||
|
||||
addSeparator();
|
||||
|
||||
m_noLines = new QAction(tr("No borders"),this);
|
||||
m_noLines = new QAction(tr("No borders"), this);
|
||||
m_noLines->setIcon(QIcon(":/report/images/noLines"));
|
||||
connect(m_noLines,SIGNAL(triggered()),this,SLOT(noBordesClicked()));
|
||||
connect(m_noLines, SIGNAL(triggered()), this, SLOT(noBordesClicked()));
|
||||
addAction(m_noLines);
|
||||
|
||||
m_allLines = new QAction(tr("All borders"),this);
|
||||
m_allLines = new QAction(tr("All borders"), this);
|
||||
m_allLines->setIcon(QIcon(":/report/images/allLines"));
|
||||
connect(m_allLines,SIGNAL(triggered()),this,SLOT(allBordesClicked()));
|
||||
connect(m_allLines, SIGNAL(triggered()), this, SLOT(allBordesClicked()));
|
||||
addAction(m_allLines);
|
||||
addSeparator();
|
||||
m_BorderEditor = new QAction(tr("Edit border"),this);
|
||||
m_BorderEditor = new QAction(tr("Edit border"), this);
|
||||
m_BorderEditor->setIcon(QIcon(":/report/images/borderEditor"));
|
||||
connect(m_BorderEditor,SIGNAL(triggered()),this,SLOT(editBorderClicked()));
|
||||
connect(m_BorderEditor, SIGNAL(triggered()), this, SLOT(editBorderClicked()));
|
||||
addAction(m_BorderEditor);
|
||||
|
||||
setEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
void ItemsBordersEditorWidget::updateValues(BaseDesignIntf::BorderLines borders)
|
||||
@@ -147,17 +145,14 @@ void ItemsBordersEditorWidget::updateValues(BaseDesignIntf::BorderLines borders)
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
bool ItemsBordersEditorWidget::changing() const
|
||||
{
|
||||
return m_changing;
|
||||
}
|
||||
bool ItemsBordersEditorWidget::changing() const { return m_changing; }
|
||||
|
||||
#ifdef HAVE_REPORT_DESIGNER
|
||||
void ItemsBordersEditorWidgetForDesigner::buttonClicked(bool)
|
||||
@@ -182,16 +177,14 @@ void ItemsBordersEditorWidgetForDesigner::editBorderClicked()
|
||||
{
|
||||
BorderEditor be;
|
||||
be.loadItem(m_item);
|
||||
if ( be.exec() == QDialog::Rejected ) return;
|
||||
if (be.exec() == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
m_reportEditor->setBordersExt(
|
||||
be.borderSides(),
|
||||
be.borderWidth(),
|
||||
(LimeReport::BaseDesignIntf::BorderStyle)be.borderStyle(),
|
||||
be.borderColor()
|
||||
);
|
||||
m_reportEditor->setBordersExt(be.borderSides(), be.borderWidth(),
|
||||
(LimeReport::BaseDesignIntf::BorderStyle)be.borderStyle(),
|
||||
be.borderColor());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} //namespace LimeReport
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -30,18 +30,21 @@
|
||||
#ifndef LRITEMSBORDERSEDITORWIDGET_H
|
||||
#define LRITEMSBORDERSEDITORWIDGET_H
|
||||
|
||||
#include <QToolBar>
|
||||
#include "lrreportdesignwidget.h"
|
||||
#include "lritemeditorwidget.h"
|
||||
#include "lrreportdesignwidget.h"
|
||||
|
||||
namespace LimeReport{
|
||||
#include <QToolBar>
|
||||
|
||||
class ItemsBordersEditorWidget : public ItemEditorWidget
|
||||
{
|
||||
namespace LimeReport {
|
||||
|
||||
class ItemsBordersEditorWidget: public ItemEditorWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ItemsBordersEditorWidget(const QString &title, QWidget *parent = 0)
|
||||
: ItemEditorWidget(title, parent), m_changing(false), m_borders(0){
|
||||
explicit ItemsBordersEditorWidget(const QString& title, QWidget* parent = 0):
|
||||
ItemEditorWidget(title, parent),
|
||||
m_changing(false),
|
||||
m_borders(0)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
bool changing() const;
|
||||
@@ -50,11 +53,14 @@ protected slots:
|
||||
virtual void allBordesClicked();
|
||||
virtual void buttonClicked(bool);
|
||||
virtual void editBorderClicked();
|
||||
|
||||
protected:
|
||||
void setItemEvent(BaseDesignIntf *item);
|
||||
void properyChangedEvent(const QString &property, const QVariant &oldValue, const QVariant &newValue);
|
||||
void setItemEvent(BaseDesignIntf* item);
|
||||
void properyChangedEvent(const QString& property, const QVariant& oldValue,
|
||||
const QVariant& newValue);
|
||||
BaseDesignIntf::BorderLines createBorders();
|
||||
BaseDesignIntf *m_item;
|
||||
BaseDesignIntf* m_item;
|
||||
|
||||
private:
|
||||
void initEditor();
|
||||
void updateValues(BaseDesignIntf::BorderLines borders);
|
||||
@@ -67,26 +73,29 @@ private:
|
||||
QAction* m_BorderEditor;
|
||||
bool m_changing;
|
||||
int m_borders;
|
||||
|
||||
};
|
||||
|
||||
#ifdef HAVE_REPORT_DESIGNER
|
||||
class ItemsBordersEditorWidgetForDesigner : public ItemsBordersEditorWidget{
|
||||
class ItemsBordersEditorWidgetForDesigner: public ItemsBordersEditorWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ItemsBordersEditorWidgetForDesigner(ReportDesignWidget* reportEditor, const QString &title="", QWidget *parent = 0)
|
||||
: ItemsBordersEditorWidget(title,parent), m_reportEditor(reportEditor){}
|
||||
explicit ItemsBordersEditorWidgetForDesigner(ReportDesignWidget* reportEditor,
|
||||
const QString& title = "", QWidget* parent = 0):
|
||||
ItemsBordersEditorWidget(title, parent),
|
||||
m_reportEditor(reportEditor)
|
||||
{
|
||||
}
|
||||
protected slots:
|
||||
void buttonClicked(bool);
|
||||
void noBordesClicked();
|
||||
void allBordesClicked();
|
||||
void editBorderClicked();
|
||||
|
||||
private:
|
||||
ReportDesignWidget* m_reportEditor;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
}//namespace LimeReport
|
||||
} // namespace LimeReport
|
||||
|
||||
#endif // LRITEMSBORDERSEDITORWIDGET_H
|
||||
|
||||
@@ -29,17 +29,19 @@
|
||||
****************************************************************************/
|
||||
#include "lrtextalignmenteditorwidget.h"
|
||||
|
||||
namespace LimeReport{
|
||||
TextAlignmentEditorWidget::TextAlignmentEditorWidget(const QString& title, QWidget* parent)
|
||||
:ItemEditorWidget(title, parent), m_textAttibutesIsChanging(false), m_flag(0)
|
||||
namespace LimeReport {
|
||||
TextAlignmentEditorWidget::TextAlignmentEditorWidget(const QString& title, QWidget* parent):
|
||||
ItemEditorWidget(title, parent),
|
||||
m_textAttibutesIsChanging(false),
|
||||
m_flag(0)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidget::setItemEvent(BaseDesignIntf *item)
|
||||
void TextAlignmentEditorWidget::setItemEvent(BaseDesignIntf* item)
|
||||
{
|
||||
QVariant align=item->property("alignment");
|
||||
if (align.isValid()){
|
||||
QVariant align = item->property("alignment");
|
||||
if (align.isValid()) {
|
||||
updateValues(Qt::Alignment(align.value<int>()));
|
||||
setEnabled(true);
|
||||
}
|
||||
@@ -47,178 +49,197 @@ void TextAlignmentEditorWidget::setItemEvent(BaseDesignIntf *item)
|
||||
|
||||
void TextAlignmentEditorWidget::initEditor()
|
||||
{
|
||||
m_textAliginLeft = new QAction(tr("Text align left"),this);
|
||||
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)));
|
||||
connect(m_textAliginLeft, SIGNAL(toggled(bool)), this, SLOT(slotTextHAttribsChanged(bool)));
|
||||
addAction(m_textAliginLeft);
|
||||
|
||||
m_textAliginHCenter = new QAction(tr("Text align center"),this);
|
||||
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)));
|
||||
connect(m_textAliginHCenter, SIGNAL(toggled(bool)), this, SLOT(slotTextHAttribsChanged(bool)));
|
||||
addAction(m_textAliginHCenter);
|
||||
|
||||
m_textAliginRight = new QAction(tr("Text align right"),this);
|
||||
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)));
|
||||
connect(m_textAliginRight, SIGNAL(toggled(bool)), this, SLOT(slotTextHAttribsChanged(bool)));
|
||||
addAction(m_textAliginRight);
|
||||
|
||||
m_textAliginJustify = new QAction(tr("Text align justify"),this);
|
||||
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)));
|
||||
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 = 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)));
|
||||
connect(m_textAliginTop, SIGNAL(toggled(bool)), this, SLOT(slotTextVAttribsChanged(bool)));
|
||||
addAction(m_textAliginTop);
|
||||
|
||||
m_textAliginVCenter = new QAction(tr("Text align center"),this);
|
||||
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)));
|
||||
connect(m_textAliginVCenter, SIGNAL(toggled(bool)), this, SLOT(slotTextVAttribsChanged(bool)));
|
||||
addAction(m_textAliginVCenter);
|
||||
|
||||
m_textAliginBottom = new QAction(tr("Text align bottom"),this);
|
||||
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)));
|
||||
connect(m_textAliginBottom, SIGNAL(toggled(bool)), this, SLOT(slotTextVAttribsChanged(bool)));
|
||||
addAction(m_textAliginBottom);
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidget::updateValues(const Qt::Alignment &align)
|
||||
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;
|
||||
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 = Qt::Alignment();
|
||||
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;
|
||||
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;
|
||||
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);
|
||||
m_textAliginLeft->setChecked(sender() == m_textAliginLeft);
|
||||
m_textAliginHCenter->setChecked(sender() == m_textAliginHCenter);
|
||||
m_textAliginRight->setChecked(sender() == m_textAliginRight);
|
||||
m_textAliginJustify->setChecked(sender() == m_textAliginJustify);
|
||||
|
||||
m_flag = 0;
|
||||
if (sender()==m_textAliginLeft) m_flag |= Qt::AlignLeft;
|
||||
if (sender()==m_textAliginHCenter) m_flag |= Qt::AlignHCenter;
|
||||
if (sender()==m_textAliginRight) m_flag |= Qt::AlignRight;
|
||||
if (sender()==m_textAliginJustify) m_flag |= Qt::AlignJustify;
|
||||
if (sender() == m_textAliginLeft)
|
||||
m_flag |= Qt::AlignLeft;
|
||||
if (sender() == m_textAliginHCenter)
|
||||
m_flag |= Qt::AlignHCenter;
|
||||
if (sender() == m_textAliginRight)
|
||||
m_flag |= Qt::AlignRight;
|
||||
if (sender() == m_textAliginJustify)
|
||||
m_flag |= Qt::AlignJustify;
|
||||
m_textAttibutesIsChanging = false;
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidget::slotTextVAttribsChanged(bool)
|
||||
{
|
||||
if (m_textAttibutesIsChanging) return;
|
||||
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);
|
||||
m_textAliginTop->setChecked(sender() == m_textAliginTop);
|
||||
m_textAliginVCenter->setChecked(sender() == m_textAliginVCenter);
|
||||
m_textAliginBottom->setChecked(sender() == m_textAliginBottom);
|
||||
|
||||
m_flag = 0;
|
||||
if (sender()==m_textAliginTop) m_flag |= Qt::AlignTop;
|
||||
if (sender()==m_textAliginVCenter) m_flag |= Qt::AlignVCenter;
|
||||
if (sender()==m_textAliginBottom) m_flag |= Qt::AlignBottom;
|
||||
if (sender() == m_textAliginTop)
|
||||
m_flag |= Qt::AlignTop;
|
||||
if (sender() == m_textAliginVCenter)
|
||||
m_flag |= Qt::AlignVCenter;
|
||||
if (sender() == m_textAliginBottom)
|
||||
m_flag |= Qt::AlignBottom;
|
||||
m_textAttibutesIsChanging = false;
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidget::slotPropertyChanged(const QString &objectName, const QString &property, const QVariant &oldValue, const QVariant &newValue)
|
||||
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")){
|
||||
if (item() && (item()->objectName() == objectName) && (property == "alignment")) {
|
||||
updateValues(Qt::Alignment(item()->property("alignment").value<int>()));
|
||||
}
|
||||
}
|
||||
|
||||
int TextAlignmentEditorWidget::flag() const
|
||||
{
|
||||
return m_flag;
|
||||
}
|
||||
int TextAlignmentEditorWidget::flag() const { return m_flag; }
|
||||
|
||||
void TextAlignmentEditorWidgetForPage::initEditor()
|
||||
{
|
||||
TextAlignmentEditorWidget::initEditor();
|
||||
connect(m_page,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
|
||||
this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant)));
|
||||
connect(m_page, SIGNAL(itemPropertyChanged(QString, QString, QVariant, QVariant)), this,
|
||||
SLOT(slotPropertyChanged(QString, QString, QVariant, QVariant)));
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidgetForPage::slotTextHAttribsChanged(bool value)
|
||||
{
|
||||
|
||||
TextAlignmentEditorWidget::slotTextHAttribsChanged(value);
|
||||
if (m_textAttibutesIsChanging) return;
|
||||
if (m_textAttibutesIsChanging)
|
||||
return;
|
||||
m_textAttibutesIsChanging = true;
|
||||
m_page->changeSelectedGrpoupTextAlignPropperty(true,Qt::AlignmentFlag(flag()));
|
||||
m_page->changeSelectedGrpoupTextAlignPropperty(true, Qt::AlignmentFlag(flag()));
|
||||
m_textAttibutesIsChanging = false;
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidgetForPage::slotTextVAttribsChanged(bool value)
|
||||
{
|
||||
TextAlignmentEditorWidget::slotTextVAttribsChanged(value);
|
||||
if (m_textAttibutesIsChanging) return;
|
||||
if (m_textAttibutesIsChanging)
|
||||
return;
|
||||
m_textAttibutesIsChanging = true;
|
||||
m_page->changeSelectedGrpoupTextAlignPropperty(false,Qt::AlignmentFlag(flag()) );
|
||||
m_page->changeSelectedGrpoupTextAlignPropperty(false, Qt::AlignmentFlag(flag()));
|
||||
m_textAttibutesIsChanging = false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_REPORT_DESIGNER
|
||||
void TextAlignmentEditorWidgetForDesigner::initEditor()
|
||||
{
|
||||
connect(m_reportEditor,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
|
||||
this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant)));
|
||||
|
||||
connect(m_reportEditor, SIGNAL(itemPropertyChanged(QString, QString, QVariant, QVariant)), this,
|
||||
SLOT(slotPropertyChanged(QString, QString, QVariant, QVariant)));
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidgetForDesigner::slotTextHAttribsChanged(bool value)
|
||||
{
|
||||
TextAlignmentEditorWidget::slotTextHAttribsChanged(value);
|
||||
if (m_textAttibutesIsChanging) return;
|
||||
if (m_textAttibutesIsChanging)
|
||||
return;
|
||||
m_textAttibutesIsChanging = true;
|
||||
m_reportEditor->setTextAlign(true,Qt::AlignmentFlag(flag()));
|
||||
m_reportEditor->setTextAlign(true, Qt::AlignmentFlag(flag()));
|
||||
m_textAttibutesIsChanging = false;
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidgetForDesigner::slotTextVAttribsChanged(bool value)
|
||||
{
|
||||
TextAlignmentEditorWidget::slotTextVAttribsChanged(value);
|
||||
if (m_textAttibutesIsChanging) return;
|
||||
if (m_textAttibutesIsChanging)
|
||||
return;
|
||||
m_textAttibutesIsChanging = true;
|
||||
m_reportEditor->setTextAlign(false,Qt::AlignmentFlag(flag()));
|
||||
m_reportEditor->setTextAlign(false, Qt::AlignmentFlag(flag()));
|
||||
m_textAttibutesIsChanging = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
} //namespace LimeReport
|
||||
} // namespace LimeReport
|
||||
|
||||
@@ -30,30 +30,34 @@
|
||||
#ifndef LRTEXTALIGNMENTEDITORWIDGET_H
|
||||
#define LRTEXTALIGNMENTEDITORWIDGET_H
|
||||
|
||||
#include "lrreportdesignwidget.h"
|
||||
#include "lritemeditorwidget.h"
|
||||
#include <QToolBar>
|
||||
#include "lrreportdesignwidget.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QToolBar>
|
||||
|
||||
namespace LimeReport{
|
||||
namespace LimeReport {
|
||||
|
||||
class TextAlignmentEditorWidget:public ItemEditorWidget
|
||||
{
|
||||
class TextAlignmentEditorWidget: public ItemEditorWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TextAlignmentEditorWidget(const QString &title, QWidget *parent = 0);
|
||||
explicit TextAlignmentEditorWidget(const QString& title, QWidget* parent = 0);
|
||||
int flag() const;
|
||||
|
||||
protected:
|
||||
void setItemEvent(BaseDesignIntf *item);
|
||||
void setItemEvent(BaseDesignIntf* item);
|
||||
void initEditor();
|
||||
bool m_textAttibutesIsChanging;
|
||||
|
||||
private:
|
||||
void updateValues(const Qt::Alignment& align);
|
||||
Qt::Alignment createAlignment();
|
||||
protected slots:
|
||||
virtual void slotTextHAttribsChanged(bool);
|
||||
virtual void slotTextVAttribsChanged(bool);
|
||||
virtual void slotPropertyChanged(const QString& objectName, const QString& property, const QVariant &oldValue, const QVariant &newValue);
|
||||
virtual void slotPropertyChanged(const QString& objectName, const QString& property,
|
||||
const QVariant& oldValue, const QVariant& newValue);
|
||||
|
||||
private:
|
||||
QAction* m_textAliginLeft;
|
||||
QAction* m_textAliginRight;
|
||||
@@ -65,36 +69,49 @@ private:
|
||||
int m_flag;
|
||||
};
|
||||
|
||||
class TextAlignmentEditorWidgetForPage: public TextAlignmentEditorWidget{
|
||||
class TextAlignmentEditorWidgetForPage: public TextAlignmentEditorWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TextAlignmentEditorWidgetForPage(PageDesignIntf* page, const QString &title, QWidget *parent = 0)
|
||||
:TextAlignmentEditorWidget(title, parent), m_page(page){}
|
||||
TextAlignmentEditorWidgetForPage(PageDesignIntf* page, const QString& title,
|
||||
QWidget* parent = 0):
|
||||
TextAlignmentEditorWidget(title, parent),
|
||||
m_page(page)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
void initEditor();
|
||||
protected slots:
|
||||
void slotTextHAttribsChanged(bool value);
|
||||
void slotTextVAttribsChanged(bool value);
|
||||
|
||||
private:
|
||||
PageDesignIntf* m_page;
|
||||
};
|
||||
|
||||
#ifdef HAVE_REPORT_DESIGNER
|
||||
class TextAlignmentEditorWidgetForDesigner: public TextAlignmentEditorWidget{
|
||||
class TextAlignmentEditorWidgetForDesigner: public TextAlignmentEditorWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TextAlignmentEditorWidgetForDesigner(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0)
|
||||
:TextAlignmentEditorWidget(title, parent), m_reportEditor(reportEditor){initEditor();}
|
||||
TextAlignmentEditorWidgetForDesigner(ReportDesignWidget* reportEditor, const QString& title,
|
||||
QWidget* parent = 0):
|
||||
TextAlignmentEditorWidget(title, parent),
|
||||
m_reportEditor(reportEditor)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
protected:
|
||||
void initEditor();
|
||||
protected slots:
|
||||
void slotTextHAttribsChanged(bool value);
|
||||
void slotTextVAttribsChanged(bool value);
|
||||
|
||||
private:
|
||||
ReportDesignWidget* m_reportEditor;
|
||||
};
|
||||
#endif
|
||||
|
||||
} //namespace LimeReport
|
||||
} // namespace LimeReport
|
||||
|
||||
#endif // LRTEXTALIGNMENTEDITORWIDGET_H
|
||||
|
||||
Reference in New Issue
Block a user