mirror of
https://github.com/fralx/LimeReport.git
synced 2025-09-23 08:29:07 +03:00
plugin extracted
This commit is contained in:
@@ -31,23 +31,31 @@
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
FontEditorWidget::FontEditorWidget(ReportDesignWidget *reportEditor, const QString &title, QWidget *parent)
|
||||
: ItemEditorWidget(reportEditor,title,parent), m_ignoreSlots(false) {
|
||||
initEditor();
|
||||
}
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
//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();
|
||||
}
|
||||
//FontEditorWidget::FontEditorWidget(ReportDesignWidget *reportEditor, QWidget *parent)
|
||||
// :ItemEditorWidget(reportEditor,parent), m_ignoreSlots(false) {
|
||||
// initEditor();
|
||||
//}
|
||||
//#endif
|
||||
|
||||
FontEditorWidget::FontEditorWidget(PageDesignIntf *page, const QString &title, QWidget *parent)
|
||||
:ItemEditorWidget(page,title,parent), m_ignoreSlots(false) {
|
||||
initEditor();
|
||||
}
|
||||
//FontEditorWidget::FontEditorWidget(PageDesignIntf *page, const QString &title, QWidget *parent)
|
||||
// :ItemEditorWidget(page,title,parent), m_ignoreSlots(false) {
|
||||
// initEditor();
|
||||
//}
|
||||
|
||||
FontEditorWidget::FontEditorWidget(LimeReport::PageDesignIntf *page, QWidget *parent)
|
||||
:ItemEditorWidget(page,parent), m_ignoreSlots(false){
|
||||
//FontEditorWidget::FontEditorWidget(LimeReport::PageDesignIntf *page, QWidget *parent)
|
||||
// :ItemEditorWidget(page,parent), m_ignoreSlots(false){
|
||||
// initEditor();
|
||||
//}
|
||||
|
||||
FontEditorWidget::FontEditorWidget(const QString& title, QWidget* parent)
|
||||
:ItemEditorWidget(title, parent), m_ignoreSlots(false)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
@@ -101,10 +109,13 @@ void FontEditorWidget::initEditor()
|
||||
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)));
|
||||
}
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// if (reportEditor()){
|
||||
// connect(reportEditor(),SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
|
||||
// this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant)));
|
||||
// }
|
||||
//#endif
|
||||
|
||||
}
|
||||
|
||||
void FontEditorWidget::updateValues(const QFont& font)
|
||||
@@ -118,34 +129,41 @@ void FontEditorWidget::updateValues(const QFont& font)
|
||||
m_ignoreSlots=false;
|
||||
}
|
||||
|
||||
bool FontEditorWidget::ignoreSlots() const
|
||||
{
|
||||
return m_ignoreSlots;
|
||||
}
|
||||
|
||||
|
||||
void FontEditorWidget::slotFontChanged(const QFont &font)
|
||||
{
|
||||
if (reportEditor() && !m_ignoreSlots) reportEditor()->setFont(font);
|
||||
if (page()) page()->setFont(font);
|
||||
// if (page()) page()->setFont(font);
|
||||
}
|
||||
|
||||
void FontEditorWidget::slotFontSizeChanged(const QString &value)
|
||||
{
|
||||
if (m_ignoreSlots) return;
|
||||
|
||||
QFont resFont(fontNameEditor()->currentFont());
|
||||
resFont.setPointSize(value.toInt());
|
||||
|
||||
if (reportEditor()) reportEditor()->setFont(resFont);
|
||||
if (page()) page()->setFont(resFont);
|
||||
m_resFont = fontNameEditor()->currentFont();
|
||||
m_resFont.setPointSize(value.toInt());
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// if (reportEditor()) reportEditor()->setFont(resFont);
|
||||
//#endif
|
||||
// if (page()) page()->setFont(resFont);
|
||||
}
|
||||
|
||||
void FontEditorWidget::slotFontAttribsChanged(bool)
|
||||
{
|
||||
if (m_ignoreSlots) return;
|
||||
|
||||
QFont resFont(m_fontNameEditor->currentFont());
|
||||
resFont.setBold(m_fontBold->isChecked());
|
||||
resFont.setItalic(m_fontItalic->isChecked());
|
||||
resFont.setUnderline(m_fontUnderline->isChecked());
|
||||
if (reportEditor()) reportEditor()->setFont(resFont);
|
||||
if (page()) page()->setFont(resFont);
|
||||
m_resFont = m_fontNameEditor->currentFont();
|
||||
m_resFont.setBold(m_fontBold->isChecked());
|
||||
m_resFont.setItalic(m_fontItalic->isChecked());
|
||||
m_resFont.setUnderline(m_fontUnderline->isChecked());
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// if (reportEditor()) reportEditor()->setFont(resFont);
|
||||
//#endif
|
||||
// if (page()) page()->setFont(resFont);
|
||||
|
||||
}
|
||||
|
||||
@@ -159,4 +177,49 @@ void FontEditorWidget::slotPropertyChanged(const QString &objectName, const QStr
|
||||
}
|
||||
|
||||
|
||||
void FontEditorWidgetForPage::slotFontChanged(const QFont& font)
|
||||
{
|
||||
m_page->setFont(font);
|
||||
}
|
||||
|
||||
void FontEditorWidgetForPage::slotFontSizeChanged(const QString& value)
|
||||
{
|
||||
FontEditorWidget::slotFontSizeChanged(value);
|
||||
m_page->setFont(resFont());
|
||||
}
|
||||
|
||||
void FontEditorWidgetForPage::slotFontAttribsChanged(bool value)
|
||||
{
|
||||
FontEditorWidget::slotFontAttribsChanged(value);
|
||||
m_page->setFont(resFont());
|
||||
}
|
||||
|
||||
#ifdef IS_REPORT_DESIGNER
|
||||
void FontEditorWidgetForDesigner::initEditor()
|
||||
{
|
||||
FontEditorWidget::initEditor();
|
||||
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);
|
||||
}
|
||||
|
||||
void FontEditorWidgetForDesigner::slotFontSizeChanged(const QString& value)
|
||||
{
|
||||
FontEditorWidget::slotFontSizeChanged(value);
|
||||
m_reportEditor->setFont(resFont());
|
||||
}
|
||||
|
||||
void FontEditorWidgetForDesigner::slotFontAttribsChanged(bool value)
|
||||
{
|
||||
FontEditorWidget::slotFontAttribsChanged(value);
|
||||
m_reportEditor->setFont(resFont());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
} //namespace LimeReport
|
||||
|
@@ -35,7 +35,10 @@
|
||||
#include <QStringListModel>
|
||||
#include <QAction>
|
||||
|
||||
#ifdef IS_REPORT_DESIGNER
|
||||
#include "lrreportdesignwidget.h"
|
||||
#endif
|
||||
|
||||
#include "lritemeditorwidget.h"
|
||||
|
||||
namespace LimeReport{
|
||||
@@ -43,20 +46,27 @@ 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);
|
||||
explicit FontEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0);
|
||||
explicit FontEditorWidget(PageDesignIntf* page, QWidget *parent = 0);
|
||||
explicit FontEditorWidget(const QString &title, QWidget *parent = 0);
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// explicit FontEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
|
||||
// explicit FontEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0);
|
||||
//#endif
|
||||
// explicit FontEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0);
|
||||
// explicit FontEditorWidget(PageDesignIntf* page, QWidget *parent = 0);
|
||||
bool ignoreSlots() const;
|
||||
protected:
|
||||
void setItemEvent(BaseDesignIntf *item);
|
||||
QFontComboBox* fontNameEditor(){return m_fontNameEditor;}
|
||||
private slots:
|
||||
void slotFontChanged(const QFont& font);
|
||||
void slotFontSizeChanged(const QString& value);
|
||||
void slotFontAttribsChanged(bool);
|
||||
virtual void initEditor();
|
||||
protected slots:
|
||||
virtual void slotFontChanged(const QFont& font);
|
||||
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 initEditor();
|
||||
|
||||
void updateValues(const QFont &font);
|
||||
|
||||
QFontComboBox* m_fontNameEditor;
|
||||
@@ -68,9 +78,41 @@ private:
|
||||
QAction* m_fontUnderline;
|
||||
|
||||
bool m_ignoreSlots;
|
||||
QFont m_resFont;
|
||||
|
||||
};
|
||||
|
||||
class FontEditorWidgetForPage : public FontEditorWidget{
|
||||
Q_OBJECT
|
||||
public:
|
||||
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 IS_REPORT_DESIGNER
|
||||
class FontEditorWidgetForDesigner : public FontEditorWidget{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FontEditorWidgetForDesigner(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0)
|
||||
: FontEditorWidget(title, parent), m_reportEditor(reportEditor){}
|
||||
|
||||
protected:
|
||||
void initEditor();
|
||||
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
|
||||
|
||||
#endif // LRFONTEDITORWIDGET_H
|
||||
|
@@ -31,25 +31,35 @@
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
ItemEditorWidget::ItemEditorWidget(ReportDesignWidget* reportEditor, const QString& title, QWidget* parent)
|
||||
:QToolBar(title,parent), m_reportEditor(reportEditor), m_item(0), m_page(0)
|
||||
{
|
||||
}
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
//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(ReportDesignWidget* reportEditor, QWidget* parent)
|
||||
// :QToolBar(parent), m_reportEditor(reportEditor), m_item(0), m_page(0)
|
||||
//{
|
||||
//}
|
||||
//#endif
|
||||
|
||||
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, const QString& title, QWidget* parent)
|
||||
// :QToolBar(title,parent),
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// m_reportEditor(0),
|
||||
//#endif
|
||||
// m_item(0), m_page(page)
|
||||
//{
|
||||
//}
|
||||
|
||||
ItemEditorWidget::ItemEditorWidget(PageDesignIntf* page, QWidget* parent)
|
||||
:QToolBar(parent), m_reportEditor(0), m_item(0), m_page(page)
|
||||
{
|
||||
}
|
||||
//ItemEditorWidget::ItemEditorWidget(PageDesignIntf* page, QWidget* parent)
|
||||
// :QToolBar(parent),
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// m_reportEditor(0),
|
||||
//#endif
|
||||
// m_item(0), m_page(page)
|
||||
//{
|
||||
//}
|
||||
|
||||
void ItemEditorWidget::setItem(BaseDesignIntf* item)
|
||||
{
|
||||
|
@@ -31,7 +31,11 @@
|
||||
#define LRITEMEDITORWIDGET_H
|
||||
|
||||
#include <QToolBar>
|
||||
|
||||
#ifdef IS_REPORT_DESIGNER
|
||||
#include "lrreportdesignwidget.h"
|
||||
#endif
|
||||
#include "lrpagedesignintf.h"
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
@@ -39,26 +43,35 @@ 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);
|
||||
|
||||
explicit ItemEditorWidget(const QString &title, QWidget *parent = 0)
|
||||
: QToolBar(title, parent), m_item(0){}
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// explicit ItemEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
|
||||
// explicit ItemEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0);
|
||||
//#endif
|
||||
// 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;}
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// void setReportEditor(ReportDesignWidget* editor){m_reportEditor = editor;}
|
||||
//#endif
|
||||
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;}
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// ReportDesignWidget* reportEditor(){return m_reportEditor;}
|
||||
//#endif
|
||||
// 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;
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// ReportDesignWidget* m_reportEditor;
|
||||
//#endif
|
||||
BaseDesignIntf* m_item;
|
||||
PageDesignIntf* m_page;
|
||||
// PageDesignIntf* m_page;
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
|
@@ -31,19 +31,19 @@
|
||||
#include <QAction>
|
||||
|
||||
namespace LimeReport{
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
//ItemsBordersEditorWidget::ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, const QString& title, QWidget* parent)
|
||||
// : ItemEditorWidget(reportEditor,title,parent), m_changing(false)
|
||||
//{
|
||||
// initEditor();
|
||||
//}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
//ItemsBordersEditorWidget::ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, QWidget* parent)
|
||||
// : ItemEditorWidget(reportEditor,parent), m_changing(false)
|
||||
//{
|
||||
// initEditor();
|
||||
//}
|
||||
//#endif
|
||||
void ItemsBordersEditorWidget::setItemEvent(BaseDesignIntf* item)
|
||||
{
|
||||
QVariant borders=item->property("borders");
|
||||
@@ -65,8 +65,10 @@ void ItemsBordersEditorWidget::properyChangedEvent(const QString& property, cons
|
||||
|
||||
void ItemsBordersEditorWidget::noBordesClicked()
|
||||
{
|
||||
if (reportEditor())
|
||||
reportEditor()->setBorders(0);
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// if (reportEditor())
|
||||
// reportEditor()->setBorders(0);
|
||||
//#endif
|
||||
updateValues(0);
|
||||
}
|
||||
|
||||
@@ -78,14 +80,15 @@ void ItemsBordersEditorWidget::allBordesClicked()
|
||||
BaseDesignIntf::BottomLine;
|
||||
|
||||
updateValues((BaseDesignIntf::BorderLines)borders);
|
||||
if (reportEditor())
|
||||
reportEditor()->setBorders((BaseDesignIntf::BorderLines)borders);
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// if (reportEditor())
|
||||
// reportEditor()->setBorders((BaseDesignIntf::BorderLines)borders);
|
||||
//#endif
|
||||
}
|
||||
|
||||
void ItemsBordersEditorWidget::buttonClicked(bool)
|
||||
{
|
||||
if (!m_changing&&reportEditor())
|
||||
reportEditor()->setBorders(createBorders());
|
||||
|
||||
}
|
||||
|
||||
void ItemsBordersEditorWidget::initEditor()
|
||||
@@ -151,4 +154,29 @@ BaseDesignIntf::BorderLines ItemsBordersEditorWidget::createBorders()
|
||||
return (BaseDesignIntf::BorderLines)borders;
|
||||
}
|
||||
|
||||
bool ItemsBordersEditorWidget::changing() const
|
||||
{
|
||||
return m_changing;
|
||||
}
|
||||
|
||||
#ifdef IS_REPORT_DESIGNER
|
||||
void ItemsBordersEditorWidgetForDesigner::buttonClicked(bool)
|
||||
{
|
||||
if (!changing())
|
||||
m_reportEditor->setBorders(createBorders());
|
||||
}
|
||||
|
||||
void ItemsBordersEditorWidgetForDesigner::noBordesClicked()
|
||||
{
|
||||
m_reportEditor->setBorders(0);
|
||||
ItemsBordersEditorWidget::noBordesClicked();
|
||||
}
|
||||
|
||||
void ItemsBordersEditorWidgetForDesigner::allBordesClicked()
|
||||
{
|
||||
ItemsBordersEditorWidget::allBordesClicked();
|
||||
m_reportEditor->setBorders(createBorders());
|
||||
}
|
||||
#endif
|
||||
|
||||
} //namespace LimeReport
|
||||
|
@@ -36,23 +36,32 @@
|
||||
|
||||
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);
|
||||
explicit ItemsBordersEditorWidget(const QString &title, QWidget *parent = 0)
|
||||
: ItemEditorWidget(title, parent), m_changing(false), m_borders(0){
|
||||
initEditor();
|
||||
}
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// explicit ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
|
||||
// explicit ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0);
|
||||
//#endif
|
||||
bool changing() const;
|
||||
protected slots:
|
||||
virtual void noBordesClicked();
|
||||
virtual void allBordesClicked();
|
||||
virtual void buttonClicked(bool);
|
||||
protected:
|
||||
void setItemEvent(BaseDesignIntf *item);
|
||||
void properyChangedEvent(const QString &property, const QVariant &oldValue, const QVariant &newValue);
|
||||
BaseDesignIntf::BorderLines createBorders();
|
||||
private:
|
||||
void initEditor();
|
||||
void updateValues(BaseDesignIntf::BorderLines borders);
|
||||
BaseDesignIntf::BorderLines createBorders();
|
||||
QAction* m_noLines;
|
||||
QAction* m_leftLine;
|
||||
QAction* m_rightLine;
|
||||
@@ -60,8 +69,25 @@ private:
|
||||
QAction* m_bottomLine;
|
||||
QAction* m_allLines;
|
||||
bool m_changing;
|
||||
int m_borders;
|
||||
};
|
||||
|
||||
|
||||
#ifdef IS_REPORT_DESIGNER
|
||||
class ItemsBordersEditorWidgetForDesigner : public ItemsBordersEditorWidget{
|
||||
Q_OBJECT
|
||||
public:
|
||||
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();
|
||||
private:
|
||||
ReportDesignWidget* m_reportEditor;
|
||||
};
|
||||
#endif
|
||||
|
||||
}//namespace LimeReport
|
||||
|
||||
#endif // LRITEMSBORDERSEDITORWIDGET_H
|
||||
|
@@ -30,30 +30,36 @@
|
||||
#include "lrtextalignmenteditorwidget.h"
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
TextAlignmentEditorWidget::TextAlignmentEditorWidget(ReportDesignWidget *reportEditor, const QString &title, QWidget *parent)
|
||||
:ItemEditorWidget(reportEditor,title,parent), m_textAttibutesIsChanging(false)
|
||||
TextAlignmentEditorWidget::TextAlignmentEditorWidget(const QString& title, QWidget* parent)
|
||||
:ItemEditorWidget(title, parent), m_textAttibutesIsChanging(false), m_flag(0)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
|
||||
TextAlignmentEditorWidget::TextAlignmentEditorWidget(ReportDesignWidget *reportEditor, QWidget *parent)
|
||||
:ItemEditorWidget(reportEditor,parent), m_textAttibutesIsChanging(false)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
//TextAlignmentEditorWidget::TextAlignmentEditorWidget(ReportDesignWidget *reportEditor, const QString &title, QWidget *parent)
|
||||
// :ItemEditorWidget(reportEditor,title,parent), m_textAttibutesIsChanging(false)
|
||||
//{
|
||||
// initEditor();
|
||||
//}
|
||||
|
||||
TextAlignmentEditorWidget::TextAlignmentEditorWidget(PageDesignIntf* page, const QString& title, QWidget* parent)
|
||||
:ItemEditorWidget(page,title,parent), m_textAttibutesIsChanging(false)
|
||||
{
|
||||
initEditor();
|
||||
}
|
||||
//TextAlignmentEditorWidget::TextAlignmentEditorWidget(ReportDesignWidget *reportEditor, QWidget *parent)
|
||||
// :ItemEditorWidget(reportEditor,parent), m_textAttibutesIsChanging(false)
|
||||
//{
|
||||
// initEditor();
|
||||
//}
|
||||
//#endif
|
||||
//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();
|
||||
}
|
||||
//TextAlignmentEditorWidget::TextAlignmentEditorWidget(PageDesignIntf* page, QWidget* parent)
|
||||
// :ItemEditorWidget(page,parent), m_textAttibutesIsChanging(false)
|
||||
//{
|
||||
// initEditor();
|
||||
//}
|
||||
|
||||
void TextAlignmentEditorWidget::setItemEvent(BaseDesignIntf *item)
|
||||
{
|
||||
@@ -109,21 +115,22 @@ void TextAlignmentEditorWidget::initEditor()
|
||||
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)));
|
||||
}
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// if (reportEditor()){
|
||||
// connect(reportEditor(),SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
|
||||
// this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant)));
|
||||
// }
|
||||
//#endif
|
||||
// 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_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);
|
||||
@@ -157,17 +164,18 @@ void TextAlignmentEditorWidget::slotTextHAttribsChanged(bool)
|
||||
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_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;
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// if (reportEditor()) reportEditor()->setTextAlign(true,Qt::AlignmentFlag(flag));
|
||||
//#endif
|
||||
// if (page()) {
|
||||
// //page()->setTextAlign(createAlignment());
|
||||
// page()->changeSelectedGrpoupTextAlignPropperty(true,Qt::AlignmentFlag(flag));
|
||||
// }
|
||||
m_textAttibutesIsChanging = false;
|
||||
}
|
||||
|
||||
@@ -180,13 +188,14 @@ void TextAlignmentEditorWidget::slotTextVAttribsChanged(bool)
|
||||
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_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;
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// if (reportEditor()) reportEditor()->setTextAlign(false,Qt::AlignmentFlag(flag));
|
||||
//#endif
|
||||
// if (page()) page()->changeSelectedGrpoupTextAlignPropperty(false,Qt::AlignmentFlag(flag) );
|
||||
m_textAttibutesIsChanging = false;
|
||||
}
|
||||
|
||||
@@ -200,5 +209,63 @@ void TextAlignmentEditorWidget::slotPropertyChanged(const QString &objectName, c
|
||||
}
|
||||
}
|
||||
|
||||
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)));
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidgetForPage::slotTextHAttribsChanged(bool value)
|
||||
{
|
||||
|
||||
TextAlignmentEditorWidget::slotTextHAttribsChanged(value);
|
||||
if (m_textAttibutesIsChanging) return;
|
||||
m_textAttibutesIsChanging = true;
|
||||
m_page->changeSelectedGrpoupTextAlignPropperty(true,Qt::AlignmentFlag(flag()));
|
||||
m_textAttibutesIsChanging = false;
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidgetForPage::slotTextVAttribsChanged(bool value)
|
||||
{
|
||||
TextAlignmentEditorWidget::slotTextVAttribsChanged(value);
|
||||
if (m_textAttibutesIsChanging) return;
|
||||
m_textAttibutesIsChanging = true;
|
||||
m_page->changeSelectedGrpoupTextAlignPropperty(false,Qt::AlignmentFlag(flag()) );
|
||||
m_textAttibutesIsChanging = false;
|
||||
}
|
||||
|
||||
#ifdef IS_REPORT_DESIGNER
|
||||
void TextAlignmentEditorWidgetForDesigner::initEditor()
|
||||
{
|
||||
TextAlignmentEditorWidget::initEditor();
|
||||
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;
|
||||
m_textAttibutesIsChanging = true;
|
||||
m_reportEditor->setTextAlign(true,Qt::AlignmentFlag(flag()));
|
||||
m_textAttibutesIsChanging = false;
|
||||
}
|
||||
|
||||
void TextAlignmentEditorWidgetForDesigner::slotTextVAttribsChanged(bool value)
|
||||
{
|
||||
TextAlignmentEditorWidget::slotTextVAttribsChanged(value);
|
||||
if (m_textAttibutesIsChanging) return;
|
||||
m_textAttibutesIsChanging = true;
|
||||
m_reportEditor->setTextAlign(false,Qt::AlignmentFlag(flag()));
|
||||
m_textAttibutesIsChanging = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
} //namespace LimeReport
|
||||
|
@@ -41,23 +41,26 @@ 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);
|
||||
explicit TextAlignmentEditorWidget(const QString &title, QWidget *parent = 0);
|
||||
//#ifdef IS_REPORT_DESIGNER
|
||||
// explicit TextAlignmentEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
|
||||
// explicit TextAlignmentEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0);
|
||||
//#endif
|
||||
// explicit TextAlignmentEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0);
|
||||
// explicit TextAlignmentEditorWidget(PageDesignIntf* page, QWidget *parent = 0);
|
||||
int flag() const;
|
||||
protected:
|
||||
void setItemEvent(BaseDesignIntf *item);
|
||||
virtual void initEditor();
|
||||
bool m_textAttibutesIsChanging;
|
||||
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);
|
||||
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);
|
||||
private:
|
||||
bool m_textAttibutesIsChanging;
|
||||
|
||||
QAction* m_textAliginLeft;
|
||||
QAction* m_textAliginRight;
|
||||
QAction* m_textAliginHCenter;
|
||||
@@ -66,8 +69,40 @@ private:
|
||||
QAction* m_textAliginBottom;
|
||||
QAction* m_textAliginVCenter;
|
||||
|
||||
int m_flag;
|
||||
|
||||
};
|
||||
|
||||
class TextAlignmentEditorWidgetForPage: public TextAlignmentEditorWidget{
|
||||
Q_OBJECT
|
||||
public:
|
||||
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 IS_REPORT_DESIGNER
|
||||
class TextAlignmentEditorWidgetForDesigner: public TextAlignmentEditorWidget{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TextAlignmentEditorWidgetForDesigner(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0)
|
||||
:TextAlignmentEditorWidget(title, parent), m_reportEditor(reportEditor){}
|
||||
protected:
|
||||
void initEditor();
|
||||
protected slots:
|
||||
void slotTextHAttribsChanged(bool value);
|
||||
void slotTextVAttribsChanged(bool value);
|
||||
private:
|
||||
ReportDesignWidget* m_reportEditor;
|
||||
};
|
||||
#endif
|
||||
|
||||
} //namespace LimeReport
|
||||
|
||||
#endif // LRTEXTALIGNMENTEDITORWIDGET_H
|
||||
|
Reference in New Issue
Block a user