mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2025-09-23 08:39:07 +03:00
Items context menu has been added
Fields drag & drop init band datasource if it empty
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include "lrsimpletagparser.h"
|
||||
#include "lrtextitemeditor.h"
|
||||
#include "lrreportengine_p.h"
|
||||
#include <QMenu>
|
||||
|
||||
namespace{
|
||||
|
||||
@@ -80,6 +81,51 @@ int TextItem::fakeMarginSize() const{
|
||||
return marginSize()+5;
|
||||
}
|
||||
|
||||
void TextItem::preparePopUpMenu(QMenu &menu)
|
||||
{
|
||||
QAction* editAction = menu.addAction(QIcon(":/report/images/edit_pecil2.png"),tr("Edit"));
|
||||
menu.insertAction(menu.actions().at(0),editAction);
|
||||
menu.insertSeparator(menu.actions().at(1));
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
QAction* action = menu.addAction(tr("Auto height"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(autoHeight());
|
||||
|
||||
action = menu.addAction(tr("Allow HTML"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(allowHTML());
|
||||
|
||||
action = menu.addAction(tr("Allow HTML in fields"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(allowHTMLInFields());
|
||||
|
||||
action = menu.addAction(tr("Strethc to max height"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(stretchToMaxHeight());
|
||||
|
||||
}
|
||||
|
||||
void TextItem::processPopUpAction(QAction *action)
|
||||
{
|
||||
if (action->text().compare(tr("Edit")) == 0){
|
||||
this->showEditorDialog();
|
||||
}
|
||||
if (action->text().compare(tr("Auto height")) == 0){
|
||||
setProperty("autoHeight",action->isChecked());
|
||||
}
|
||||
if (action->text().compare(tr("Allow HTML")) == 0){
|
||||
setProperty("allowHTML",action->isChecked());
|
||||
}
|
||||
if (action->text().compare(tr("Allow HTML in fields")) == 0){
|
||||
setProperty("allowHTMLInFields",action->isChecked());
|
||||
}
|
||||
if (action->text().compare(tr("Strethc to max height")) == 0){
|
||||
setProperty("stretchToMaxHeight",action->isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, QWidget* widget) {
|
||||
Q_UNUSED(widget);
|
||||
Q_UNUSED(style);
|
||||
|
@@ -172,6 +172,8 @@ protected:
|
||||
int fakeMarginSize() const;
|
||||
QString getTextPart(int height, int skipHeight);
|
||||
void restoreLinksEvent();
|
||||
void preparePopUpMenu(QMenu &menu);
|
||||
void processPopUpAction(QAction *action);
|
||||
private:
|
||||
void initTextSizes() const;
|
||||
void setTextFont(TextPtr text, const QFont &value) const;
|
||||
|
Reference in New Issue
Block a user