diff --git a/include/lrglobal.h b/include/lrglobal.h index b324900..a553c58 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -84,15 +84,7 @@ namespace Const{ const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}"; const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\s*\\}"; const QString NAMED_VARIABLE_RX = "\\$V\\s*\\{\\s*(%1)\\s*\\}"; - const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}"; - - //const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)"; - //const int DATASOURCE_INDEX = 6; - //const int VALUE_INDEX = 2; - - //const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"?\\$S\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)"; - //const QString GROUP_FUNCTION_PARAM_RX = "\\((?:(.+),(.+))|(?:\\\"(\\w+)\\\")\\)"; - //const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:)))|(?:(?:(?:\\\")|(?:))(\\s*\\$\\w\\s*\\{.+\\}\\s*)(?:(?:\\\")|(?:))\\s*,\\s*(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:))))\\)"; + const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}"; const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*.\\w*\\s*\\})|(?:V\\{\\s*\\w*\\s*\\})|(?:S\\{.+\\})))|(?:\\w*))(?:(?:\\\")|(?:)))(?:(?:\\s*,\\s*(?:\\\"(\\w*)\\\"))|(?:))\\)"; const int DATASOURCE_INDEX = 3;//4; const int VALUE_INDEX = 2; //2; diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h index b324900..a553c58 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -84,15 +84,7 @@ namespace Const{ const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}"; const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\s*\\}"; const QString NAMED_VARIABLE_RX = "\\$V\\s*\\{\\s*(%1)\\s*\\}"; - const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}"; - - //const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)"; - //const int DATASOURCE_INDEX = 6; - //const int VALUE_INDEX = 2; - - //const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"?\\$S\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)"; - //const QString GROUP_FUNCTION_PARAM_RX = "\\((?:(.+),(.+))|(?:\\\"(\\w+)\\\")\\)"; - //const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:)))|(?:(?:(?:\\\")|(?:))(\\s*\\$\\w\\s*\\{.+\\}\\s*)(?:(?:\\\")|(?:))\\s*,\\s*(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:))))\\)"; + const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}"; const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*.\\w*\\s*\\})|(?:V\\{\\s*\\w*\\s*\\})|(?:S\\{.+\\})))|(?:\\w*))(?:(?:\\\")|(?:)))(?:(?:\\s*,\\s*(?:\\\"(\\w*)\\\"))|(?:))\\)"; const int DATASOURCE_INDEX = 3;//4; const int VALUE_INDEX = 2; //2; diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 657f289..fc611e3 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -64,7 +64,7 @@ ReportDesignWindow* ReportDesignWindow::m_instance=0; ReportDesignWindow::ReportDesignWindow(ReportEngine *report, QWidget *parent, QSettings* settings) : QMainWindow(parent), m_textAttibutesIsChanging(false), m_settings(settings), m_ownedSettings(false), - m_progressDialog(0), m_showProgressDialog(true), m_editorTabType(ReportDesignWidget::Page) + m_progressDialog(0), m_showProgressDialog(true), m_editorTabType(ReportDesignWidget::Page), m_reportItemIsLocked(false) { initReportEditor(report); createActions(); @@ -123,6 +123,7 @@ void ReportDesignWindow::createActions() m_editModeAction->setIcon(QIcon(":/report/images/editMode")); m_editModeAction->setCheckable(true); m_editModeAction->setChecked(true); + m_editModeAction->setShortcut(QKeySequence(Qt::Key_Escape)); connect(m_editModeAction,SIGNAL(triggered()),this,SLOT(slotEditMode())); m_undoAction = new QAction(tr("Undo"),this); @@ -888,6 +889,7 @@ void ReportDesignWindow::slotNewTextItem() { if (m_newTextItemAction->isChecked()) {m_newTextItemAction->setCheckable(false);return;} if (m_reportDesignWidget) { + m_reportItemIsLocked = QApplication::keyboardModifiers() == Qt::SHIFT; m_reportDesignWidget->startInsertMode("TextItem"); m_newTextItemAction->setCheckable(true); m_newTextItemAction->setChecked(true); @@ -987,14 +989,19 @@ void ReportDesignWindow::slotInsertModeStarted() void ReportDesignWindow::slotItemInserted(PageDesignIntf *, QPointF, const QString &ItemType) { - m_editModeAction->setChecked(true); - if (m_actionMap.value(ItemType)) - m_actionMap.value(ItemType)->setCheckable(false); + if (!m_reportItemIsLocked){ + m_editModeAction->setChecked(true); + if (m_actionMap.value(ItemType)) + m_actionMap.value(ItemType)->setCheckable(false); + } else { + m_reportDesignWidget->startInsertMode(ItemType); + } } void ReportDesignWindow::slotItemInsertCanceled(const QString &ItemType) { m_editModeAction->setChecked(true); + m_reportItemIsLocked = false; if (m_actionMap.value(ItemType)) m_actionMap.value(ItemType)->setCheckable(false); } @@ -1169,6 +1176,7 @@ void ReportDesignWindow::slotItemActionCliked() QAction* action=dynamic_cast(sender()); action->setCheckable(true); action->setChecked(true); + m_reportItemIsLocked = QApplication::keyboardModifiers() == Qt::SHIFT; m_reportDesignWidget->startInsertMode(action->whatsThis()); } diff --git a/limereport/lrreportdesignwindow.h b/limereport/lrreportdesignwindow.h index 9a96845..a01db94 100644 --- a/limereport/lrreportdesignwindow.h +++ b/limereport/lrreportdesignwindow.h @@ -266,6 +266,7 @@ private: QByteArray m_editorsStates[ReportDesignWidget::TabTypeCount]; QVector m_pageTools; QVector m_dialogTools; + bool m_reportItemIsLocked; };