0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 08:34:38 +03:00

Dialog designer has been fixed

This commit is contained in:
Arin Alexander 2020-03-24 23:42:05 +03:00
parent 93316e22bc
commit 20d0637f70
5 changed files with 15 additions and 34 deletions

View File

@ -133,7 +133,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 5 LIMEREPORT_VERSION_MINOR = 5
LIMEREPORT_VERSION_RELEASE = 44 LIMEREPORT_VERSION_RELEASE = 45
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"

View File

@ -40,6 +40,8 @@ DialogDesignerManager::DialogDesignerManager(QObject *parent) : QObject(parent)
m_editWidgetsAction = new QAction(tr("Edit Widgets"), this); m_editWidgetsAction = new QAction(tr("Edit Widgets"), this);
m_editWidgetsAction->setIcon(QIcon(":/images/images/widgettool.png")); m_editWidgetsAction->setIcon(QIcon(":/images/images/widgettool.png"));
m_editWidgetsAction->setEnabled(false); m_editWidgetsAction->setEnabled(false);
m_editWidgetsAction->setCheckable(true);
m_editWidgetsAction->setChecked(true);
connect(m_editWidgetsAction, SIGNAL(triggered()), this, SLOT(slotEditWidgets())); connect(m_editWidgetsAction, SIGNAL(triggered()), this, SLOT(slotEditWidgets()));
connect(m_formEditor->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), connect(m_formEditor->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)),
this, SLOT(slotActiveFormWindowChanged(QDesignerFormWindowInterface*)) ); this, SLOT(slotActiveFormWindowChanged(QDesignerFormWindowInterface*)) );
@ -258,6 +260,8 @@ void DialogDesignerManager::slotActiveFormWindowChanged(QDesignerFormWindowInter
{ {
if (formWindow){ if (formWindow){
m_editWidgetsAction->setEnabled(true); m_editWidgetsAction->setEnabled(true);
m_editWidgetsAction->trigger();
m_editWidgetsAction->setChecked(true);
m_activeWindowName = formWindow->objectName(); m_activeWindowName = formWindow->objectName();
} }
} }

View File

@ -55,7 +55,6 @@ ShapeItem::ShapeItem(QObject *owner, QGraphicsItem *parent)
m_shapeBrushType(Qt::NoBrush), m_shapeBrushType(Qt::NoBrush),
m_lineWidth(1), m_lineWidth(1),
m_penStyle(Qt::SolidLine), m_penStyle(Qt::SolidLine),
m_opacity(100),
m_cornerRadius(0) m_cornerRadius(0)
{ {
} }
@ -89,7 +88,7 @@ void ShapeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
brush.setTransform(painter->worldTransform().inverted()); brush.setTransform(painter->worldTransform().inverted());
painter->setBrush(brush); painter->setBrush(brush);
painter->setBackground(QBrush(Qt::NoBrush)); painter->setBackground(QBrush(Qt::NoBrush));
painter->setOpacity(qreal(m_opacity)/100); painter->setOpacity(qreal(opacity())/100);
QRectF rectangleRect = rect().adjusted((lineWidth() / 2), QRectF rectangleRect = rect().adjusted((lineWidth() / 2),
(lineWidth() / 2), (lineWidth() / 2),
-(lineWidth() / 2), -(lineWidth() / 2),
@ -190,27 +189,5 @@ void ShapeItem::setCornerRadius(int borderRadius)
notify("cornerRadius",oldValue,m_cornerRadius); notify("cornerRadius",oldValue,m_cornerRadius);
} }
} }
int ShapeItem::opacity() const
{
return m_opacity;
}
void ShapeItem::setOpacity(int opacity)
{
if (m_opacity!=opacity){
if (opacity < 0) {
m_opacity = 0;
}
else if (opacity > 100) {
m_opacity = 100;
}
else {
m_opacity = opacity;
}
update();
}
}
} }

View File

@ -66,8 +66,6 @@ public:
qreal lineWidth() const {return m_lineWidth;} qreal lineWidth() const {return m_lineWidth;}
Qt::PenStyle penStyle() const; Qt::PenStyle penStyle() const;
void setPenStyle(const Qt::PenStyle &value); void setPenStyle(const Qt::PenStyle &value);
int opacity() const;
void setOpacity(int opacity);
int cornerRadius() const; int cornerRadius() const;
void setCornerRadius(int cornerRadius); void setCornerRadius(int cornerRadius);
@ -81,7 +79,7 @@ private:
Qt::BrushStyle m_shapeBrushType; Qt::BrushStyle m_shapeBrushType;
qreal m_lineWidth; qreal m_lineWidth;
Qt::PenStyle m_penStyle; Qt::PenStyle m_penStyle;
int m_opacity; // int m_opacity;
int m_cornerRadius; int m_cornerRadius;
}; };

View File

@ -1408,11 +1408,13 @@ void ScriptEngineContext::qobjectToScript(const QString& name, QObject *item)
#ifdef HAVE_UI_LOADER #ifdef HAVE_UI_LOADER
#ifdef USE_QJSENGINE #ifdef USE_QJSENGINE
void registerChildObjects(ScriptEngineType* se, ScriptValueType* sv){ void registerChildObjects(ScriptEngineType* se, ScriptValueType* root, QObject* currObj){
foreach(QObject* obj, sv->toQObject()->children()){ foreach(QObject* obj, currObj->children()){
if (!obj->objectName().isEmpty()){
ScriptValueType child = se->newQObject(obj); ScriptValueType child = se->newQObject(obj);
sv->setProperty(obj->objectName(),child); root->setProperty(obj->objectName(),child);
registerChildObjects(se, &child); }
registerChildObjects(se, root, obj);
} }
} }
#endif #endif
@ -1422,7 +1424,7 @@ void ScriptEngineContext::initDialogs(){
foreach(DialogDescriber::Ptr dialog, dialogDescribers()){ foreach(DialogDescriber::Ptr dialog, dialogDescribers()){
ScriptValueType sv = se->newQObject(getDialog(dialog->name())); ScriptValueType sv = se->newQObject(getDialog(dialog->name()));
#ifdef USE_QJSENGINE #ifdef USE_QJSENGINE
registerChildObjects(se,&sv); registerChildObjects(se, &sv, sv.toQObject());
#endif #endif
se->globalObject().setProperty(dialog->name(),sv); se->globalObject().setProperty(dialog->name(),sv);
} }