mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
Dialog designers tool bar integration has been added
This commit is contained in:
parent
cd2e748a9b
commit
0692435b26
@ -15,3 +15,6 @@ QT += designer designercomponents-private
|
||||
|
||||
SOURCES += $$PWD/lrdialogdesigner.cpp
|
||||
HEADERS += $$PWD/lrdialogdesigner.h
|
||||
|
||||
RESOURCES += \
|
||||
$$PWD/dialogdesigner.qrc
|
||||
|
9
limereport/dialogdesigner/dialogdesigner.qrc
Normal file
9
limereport/dialogdesigner/dialogdesigner.qrc
Normal file
@ -0,0 +1,9 @@
|
||||
<RCC>
|
||||
<qresource prefix="/images">
|
||||
<file>images/buddytool.png</file>
|
||||
<file>images/editform.png</file>
|
||||
<file>images/signalslottool.png</file>
|
||||
<file>images/tabordertool.png</file>
|
||||
<file>images/widgettool.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
BIN
limereport/dialogdesigner/images/buddytool.png
Normal file
BIN
limereport/dialogdesigner/images/buddytool.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 997 B |
BIN
limereport/dialogdesigner/images/editform.png
Normal file
BIN
limereport/dialogdesigner/images/editform.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 349 B |
BIN
limereport/dialogdesigner/images/signalslottool.png
Normal file
BIN
limereport/dialogdesigner/images/signalslottool.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
limereport/dialogdesigner/images/tabordertool.png
Normal file
BIN
limereport/dialogdesigner/images/tabordertool.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
limereport/dialogdesigner/images/widgettool.png
Normal file
BIN
limereport/dialogdesigner/images/widgettool.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
@ -16,6 +16,8 @@
|
||||
#include <QDesignerPropertyEditorInterface>
|
||||
#include <QDesignerObjectInspectorInterface>
|
||||
#include <QDesignerFormEditorInterface>
|
||||
#include <QAction>
|
||||
#include <QDebug>
|
||||
#include "pluginmanager_p.h"
|
||||
//#include <QExtensionManager>
|
||||
|
||||
@ -30,64 +32,70 @@ DialogDesigner::DialogDesigner(QObject *parent) : QObject(parent)
|
||||
QDesignerComponents::initializePlugins(m_formEditor);
|
||||
QDesignerComponents::createTaskMenu(m_formEditor, this);
|
||||
|
||||
m_editWidgetsAction = new QAction(tr("Edit Widgets"));
|
||||
m_editWidgetsAction->setIcon(QIcon(":/images/images/widgettool.png"));
|
||||
m_editWidgetsAction->setEnabled(false);
|
||||
connect(m_editWidgetsAction, SIGNAL(triggered()), this, SLOT(slotEditWidgets()));
|
||||
connect(m_formEditor->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)),
|
||||
this, SLOT(slotActiveFormWindowChanged(QDesignerFormWindowInterface*)) );
|
||||
|
||||
m_modes = new QActionGroup(this);
|
||||
m_modes->setExclusive(true);
|
||||
m_modes->addAction(m_editWidgetsAction);
|
||||
|
||||
foreach ( QObject* o, QPluginLoader::staticInstances() << m_formEditor->pluginManager()->instances() )
|
||||
{
|
||||
if ( QDesignerFormEditorPluginInterface* fep = qobject_cast<QDesignerFormEditorPluginInterface*>( o ) )
|
||||
{
|
||||
// initialize plugin if needed
|
||||
if ( !fep->isInitialized() )
|
||||
fep->initialize( m_formEditor );
|
||||
|
||||
// set action chackable
|
||||
// fep->action()->setCheckable( true );
|
||||
|
||||
// // add action mode to group
|
||||
// aModes->addAction( fep->action() );
|
||||
fep->action()->setCheckable( true );
|
||||
fep->action()->setIcon(QIcon(iconPathByName(fep->action()->objectName())));
|
||||
m_modes->addAction(fep->action());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_widgetBox = QDesignerComponents::createWidgetBox(m_formEditor, 0);
|
||||
m_widgetBox->setWindowTitle(tr("Widget Box"));
|
||||
m_widgetBox->setObjectName(QLatin1String("WidgetBox"));
|
||||
m_formEditor->setWidgetBox(m_widgetBox);
|
||||
m_formEditor->setTopLevel(m_widgetBox);
|
||||
m_designerToolWindows.append(m_widgetBox);
|
||||
connect(m_widgetBox, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) );
|
||||
connect(m_widgetBox, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
|
||||
|
||||
m_objectInspector = QDesignerComponents::createObjectInspector(m_formEditor, 0);
|
||||
m_objectInspector->setWindowTitle(tr("Object Inspector"));
|
||||
m_objectInspector->setObjectName(QLatin1String("ObjectInspector"));
|
||||
m_formEditor->setObjectInspector(m_objectInspector);
|
||||
m_designerToolWindows.append(m_objectInspector);
|
||||
connect(m_objectInspector, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) );
|
||||
connect(m_objectInspector, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
|
||||
|
||||
m_propertyEditor = QDesignerComponents::createPropertyEditor(m_formEditor, 0);
|
||||
m_propertyEditor->setWindowTitle(tr("Property Editor"));
|
||||
m_propertyEditor->setObjectName(QLatin1String("PropertyEditor"));
|
||||
m_formEditor->setPropertyEditor(m_propertyEditor);
|
||||
m_designerToolWindows.append(m_propertyEditor);
|
||||
connect(m_propertyEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) );
|
||||
connect(m_propertyEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
|
||||
|
||||
m_signalSlotEditor = QDesignerComponents::createSignalSlotEditor(m_formEditor, 0);
|
||||
m_signalSlotEditor->setWindowTitle(tr("Signals && Slots Editor"));
|
||||
m_signalSlotEditor->setObjectName(QLatin1String("SignalsAndSlotsEditor"));
|
||||
|
||||
m_designerToolWindows.append(m_signalSlotEditor);
|
||||
connect(m_signalSlotEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) );
|
||||
connect(m_signalSlotEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
|
||||
|
||||
m_resourcesEditor = QDesignerComponents::createResourceEditor(m_formEditor, 0);
|
||||
m_resourcesEditor->setWindowTitle(tr("Resource Editor"));
|
||||
m_resourcesEditor->setObjectName(QLatin1String("ResourceEditor"));
|
||||
m_designerToolWindows.append(m_resourcesEditor);
|
||||
connect(m_resourcesEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) );
|
||||
connect(m_resourcesEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
|
||||
|
||||
m_actionEditor = QDesignerComponents::createActionEditor(m_formEditor, 0);
|
||||
m_actionEditor->setWindowTitle(tr("Action Editor"));
|
||||
m_actionEditor->setObjectName("ActionEditor");
|
||||
m_formEditor->setActionEditor(m_actionEditor);
|
||||
m_designerToolWindows.append(m_actionEditor);
|
||||
connect(m_formEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) );
|
||||
connect(m_formEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
|
||||
|
||||
m_designerIntegration = new QDesignerIntegration(m_formEditor,this);
|
||||
m_formEditor->setIntegration(m_designerIntegration);
|
||||
@ -105,6 +113,28 @@ DialogDesigner::~DialogDesigner()
|
||||
delete m_formEditor;
|
||||
}
|
||||
|
||||
void DialogDesigner::initToolBar(QToolBar *tb)
|
||||
{
|
||||
tb->setIconSize(QSize(16,16));
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionCopy());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionPaste());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionCut());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionUndo());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionRedo());
|
||||
|
||||
tb->addActions(m_modes->actions());
|
||||
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionHorizontalLayout());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionVerticalLayout());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionSplitHorizontal());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionSplitVertical());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionGridLayout());
|
||||
m_formEditor->formWindowManager()->actionFormLayout()->setIcon(QIcon(":/images/images/editform.png"));
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionFormLayout());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionBreakLayout());
|
||||
tb->addAction(m_formEditor->formWindowManager()->actionAdjustSize());
|
||||
}
|
||||
|
||||
QWidget *DialogDesigner::createFormEditor(const QString &content)
|
||||
{
|
||||
QDesignerFormWindowInterface* wnd = m_formEditor->formWindowManager()->createFormWindow(0, Qt::Window);
|
||||
@ -113,12 +143,22 @@ QWidget *DialogDesigner::createFormEditor(const QString &content)
|
||||
m_formEditor->objectInspector()->setFormWindow(wnd);
|
||||
wnd->editWidgets();
|
||||
|
||||
connect(wnd, SIGNAL(changed()), this, SIGNAL(dialogChanged()));
|
||||
|
||||
SharedTools::WidgetHost *placeholder = new SharedTools::WidgetHost(0,wnd);
|
||||
placeholder->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
|
||||
placeholder->setFocusProxy( wnd );
|
||||
|
||||
return placeholder;
|
||||
return placeholder;
|
||||
}
|
||||
|
||||
QByteArray DialogDesigner::getDialogDescription(QWidget *form)
|
||||
{
|
||||
SharedTools::WidgetHost* wh = dynamic_cast<SharedTools::WidgetHost*>(form);
|
||||
if (wh){
|
||||
return wh->formWindow()->contents().toUtf8();
|
||||
}
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
void DialogDesigner::setActiveEditor(QWidget *widget)
|
||||
@ -127,7 +167,6 @@ void DialogDesigner::setActiveEditor(QWidget *widget)
|
||||
if (wh){
|
||||
m_formEditor->formWindowManager()->setActiveFormWindow(wh->formWindow());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QWidget* DialogDesigner::widgetBox() const
|
||||
@ -160,7 +199,7 @@ QWidget *DialogDesigner::resourcesEditor() const
|
||||
return m_resourcesEditor;
|
||||
}
|
||||
|
||||
void DialogDesigner::objectDestroyed(QObject *object)
|
||||
void DialogDesigner::slotObjectDestroyed(QObject *object)
|
||||
{
|
||||
for ( int i = 0; i<m_designerToolWindows.size();++i){
|
||||
m_designerToolWindows[i] = m_designerToolWindows[i] == object ? 0 : m_designerToolWindows[i];
|
||||
@ -168,4 +207,30 @@ void DialogDesigner::objectDestroyed(QObject *object)
|
||||
|
||||
}
|
||||
|
||||
void DialogDesigner::slotEditWidgets()
|
||||
{
|
||||
for (int i = 0; i<m_formEditor->formWindowManager()->formWindowCount(); ++i){
|
||||
m_formEditor->formWindowManager()->formWindow(i)->editWidgets();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogDesigner::slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow)
|
||||
{
|
||||
if (formWindow){
|
||||
m_editWidgetsAction->setEnabled(true);
|
||||
m_activeWindowName = formWindow->objectName();
|
||||
}
|
||||
}
|
||||
|
||||
QString DialogDesigner::iconPathByName(const QString &name)
|
||||
{
|
||||
if (name.compare("__qt_edit_signals_slots_action") == 0)
|
||||
return ":/images/images/signalslottool.png";
|
||||
if (name.compare("__qt_edit_buddies_action") == 0)
|
||||
return ":/images/images/buddytool.png";
|
||||
if (name.compare("_qt_edit_tab_order_action") == 0)
|
||||
return ":/images/images/tabordertool.png";
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
#include <QToolBar>
|
||||
|
||||
class QDesignerFormEditorInterface;
|
||||
class QDesignerFormWindowInterface;
|
||||
@ -21,7 +22,9 @@ class DialogDesigner : public QObject
|
||||
public:
|
||||
explicit DialogDesigner(QObject *parent = 0);
|
||||
~DialogDesigner();
|
||||
void initToolBar(QToolBar* tb);
|
||||
QWidget* createFormEditor(const QString& content);
|
||||
QByteArray getDialogDescription(QWidget* form);
|
||||
void setActiveEditor(QWidget* widget);
|
||||
QWidget* widgetBox() const;
|
||||
QWidget* actionEditor() const;
|
||||
@ -29,8 +32,14 @@ public:
|
||||
QWidget* objectInspector() const;
|
||||
QWidget* signalSlotEditor() const;
|
||||
QWidget* resourcesEditor() const;
|
||||
signals:
|
||||
void dialogChanged();
|
||||
private slots:
|
||||
void objectDestroyed(QObject* object);
|
||||
void slotObjectDestroyed(QObject* object);
|
||||
void slotEditWidgets();
|
||||
void slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow);
|
||||
private:
|
||||
QString iconPathByName(const QString& name);
|
||||
private:
|
||||
QDesignerFormEditorInterface* m_formEditor;
|
||||
QDesignerIntegrationInterface* m_designerIntegration;
|
||||
@ -41,6 +50,9 @@ private:
|
||||
QWidget* m_signalSlotEditor;
|
||||
QWidget* m_resourcesEditor;
|
||||
QVector<QWidget*> m_designerToolWindows;
|
||||
QAction* m_editWidgetsAction;
|
||||
QActionGroup* m_modes;
|
||||
QString m_activeWindowName;
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
|
@ -48,7 +48,11 @@
|
||||
namespace LimeReport {
|
||||
|
||||
ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow *mainWindow, QWidget *parent) :
|
||||
QWidget(parent), m_dialogDesigner(new DialogDesigner(this)), m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false)
|
||||
QWidget(parent),
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
m_dialogDesigner(new DialogDesigner(this)),
|
||||
#endif
|
||||
m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false)
|
||||
{
|
||||
m_tabWidget = new QTabWidget(this);
|
||||
m_tabWidget->setTabPosition(QTabWidget::South);
|
||||
@ -74,9 +78,14 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow
|
||||
|
||||
m_scriptEditor->setPlainText(report->scriptContext()->initScript());
|
||||
m_zoomer = new GraphicsViewZoomer(activeView());
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
m_defaultFont = QFont("Arial",10);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
connect(m_dialogDesigner, SIGNAL(dialogChanged()), this, SLOT(slotDialogChanged()));
|
||||
#endif
|
||||
}
|
||||
|
||||
DialogDesigner *ReportDesignWidget::dialogDesigner() const
|
||||
@ -112,6 +121,20 @@ ReportDesignWidget::EditorTabType ReportDesignWidget::activeTabType()
|
||||
return Page;
|
||||
}
|
||||
|
||||
void ReportDesignWidget::initDialogDesignerToolBar(QToolBar *toolBar)
|
||||
{
|
||||
m_dialogDesigner->initToolBar(toolBar);
|
||||
}
|
||||
|
||||
void ReportDesignWidget::updateDialogs()
|
||||
{
|
||||
for ( int i = 0; i<m_tabWidget->count(); ++i ){
|
||||
if (m_tabWidget->tabWhatsThis(i).compare("dialog") == 0){
|
||||
m_report->scriptContext()->changeDialog(m_tabWidget->tabText(i), m_dialogDesigner->getDialogDescription(m_tabWidget->widget(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ReportDesignWidget::useMagnet() const
|
||||
{
|
||||
return m_useMagnet;
|
||||
@ -299,7 +322,12 @@ void ReportDesignWidget::slotItemSelected(BaseDesignIntf *item){
|
||||
}
|
||||
|
||||
void ReportDesignWidget::saveToFile(const QString &fileName){
|
||||
|
||||
m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
updateDialogs();
|
||||
#endif
|
||||
|
||||
if (m_report->saveToFile(fileName)) {
|
||||
m_report->emitSaveFinished();
|
||||
}
|
||||
@ -308,6 +336,10 @@ void ReportDesignWidget::saveToFile(const QString &fileName){
|
||||
bool ReportDesignWidget::save()
|
||||
{
|
||||
m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
updateDialogs();
|
||||
#endif
|
||||
|
||||
if (!m_report->reportFileName().isEmpty()){
|
||||
if (m_report->saveToFile()){
|
||||
m_report->emitSaveFinished();
|
||||
@ -499,12 +531,18 @@ void ReportDesignWidget::setBorders(const BaseDesignIntf::BorderLines& borders)
|
||||
void ReportDesignWidget::previewReport()
|
||||
{
|
||||
report()->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
updateDialogs();
|
||||
#endif
|
||||
report()->previewReport();
|
||||
}
|
||||
|
||||
void ReportDesignWidget::printReport()
|
||||
{
|
||||
report()->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
updateDialogs();
|
||||
#endif
|
||||
setCursor(Qt::WaitCursor);
|
||||
report()->printReport();
|
||||
setCursor(Qt::ArrowCursor);
|
||||
@ -653,6 +691,14 @@ void ReportDesignWidget::slotCurrentTabChanged(int index)
|
||||
emit activePageChanged();
|
||||
}
|
||||
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
|
||||
void ReportDesignWidget::slotDialogChanged()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool ReportDesignWidget::eventFilter(QObject *target, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::Wheel){
|
||||
|
@ -54,7 +54,6 @@ class ReportDesignWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QObject* datasourcesManager READ dataManager())
|
||||
friend class ReportDesignWindow;
|
||||
public:
|
||||
enum ToolWindowType{
|
||||
WidgetBox = 1,
|
||||
@ -69,6 +68,7 @@ public:
|
||||
Dialog,
|
||||
Script
|
||||
};
|
||||
ReportDesignWidget(ReportEnginePrivate* report,QMainWindow *mainWindow,QWidget *parent = 0);
|
||||
~ReportDesignWidget();
|
||||
void createStartPage();
|
||||
void clear();
|
||||
@ -103,6 +103,10 @@ public:
|
||||
DialogDesigner *dialogDesigner() const;
|
||||
QWidget* toolWindow(ToolWindowType windowType);
|
||||
EditorTabType activeTabType();
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
void initDialogDesignerToolBar(QToolBar* toolBar);
|
||||
void updateDialogs();
|
||||
#endif
|
||||
public slots:
|
||||
void saveToFile(const QString&);
|
||||
bool save();
|
||||
@ -135,13 +139,16 @@ public slots:
|
||||
void printReport();
|
||||
void addPage();
|
||||
void deleteCurrentPage();
|
||||
void slotPagesLoadFinished();
|
||||
private slots:
|
||||
void slotItemSelected(LimeReport::BaseDesignIntf *item);
|
||||
void slotSelectionChanged();
|
||||
void slotPagesLoadFinished();
|
||||
void slotDatasourceCollectionLoaded(const QString&);
|
||||
void slotSceneRectChanged(QRectF);
|
||||
void slotCurrentTabChanged(int index);
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
void slotDialogChanged();
|
||||
#endif
|
||||
signals:
|
||||
void insertModeStarted();
|
||||
void itemInserted(LimeReport::PageDesignIntf*,QPointF,const QString&);
|
||||
@ -164,7 +171,6 @@ protected:
|
||||
void createTabs();
|
||||
private:
|
||||
bool eventFilter(QObject *target, QEvent *event);
|
||||
ReportDesignWidget(ReportEnginePrivate* report,QMainWindow *mainWindow,QWidget *parent = 0);
|
||||
private:
|
||||
ReportEnginePrivate* m_report;
|
||||
QGraphicsView *m_view;
|
||||
|
@ -80,6 +80,7 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *par
|
||||
createDialogActionEditor();
|
||||
createDialogResourceEditor();
|
||||
createDialogSignalSlotEditor();
|
||||
createDialogDesignerToolBar();
|
||||
#endif
|
||||
m_instance=this;
|
||||
m_statusBar=new QStatusBar(this);
|
||||
@ -87,11 +88,12 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *par
|
||||
m_statusBar->insertWidget(0,m_lblReportName);
|
||||
setStatusBar(m_statusBar);
|
||||
setWindowTitle("Lime Report Designer");
|
||||
showDefaultEditors();
|
||||
showDefaultToolBars();
|
||||
restoreSetting();
|
||||
m_hideLeftPanel->setChecked(isDockAreaVisible(Qt::LeftDockWidgetArea));
|
||||
m_hideRightPanel->setChecked(isDockAreaVisible(Qt::RightDockWidgetArea));
|
||||
m_editorTabType = ReportDesignWidget::Page;
|
||||
showDefaultEditors();
|
||||
}
|
||||
|
||||
ReportDesignWindow::~ReportDesignWindow()
|
||||
@ -323,6 +325,9 @@ void ReportDesignWindow::createToolBars()
|
||||
addToolBar(m_itemsBordersEditorBar);
|
||||
|
||||
createReportToolBar();
|
||||
|
||||
m_pageTools << m_mainToolBar << m_reportToolBar << m_fontEditorBar << m_textAlignmentEditorBar << m_itemsBordersEditorBar;
|
||||
|
||||
}
|
||||
|
||||
void ReportDesignWindow::createItemsActions()
|
||||
@ -573,6 +578,14 @@ void ReportDesignWindow::createDialogSignalSlotEditor()
|
||||
m_dialogEditors.append(doc);
|
||||
}
|
||||
|
||||
void ReportDesignWindow::createDialogDesignerToolBar()
|
||||
{
|
||||
m_dialogDesignerToolBar = addToolBar(tr("Dialog Designer Tools"));
|
||||
m_dialogDesignerToolBar->setObjectName("DialogDesignerTools");
|
||||
m_reportDesignWidget->initDialogDesignerToolBar(m_dialogDesignerToolBar);
|
||||
m_dialogTools << m_dialogDesignerToolBar;
|
||||
}
|
||||
|
||||
#endif
|
||||
void ReportDesignWindow::createDataWindow()
|
||||
{
|
||||
@ -622,6 +635,7 @@ void ReportDesignWindow::startNewReport()
|
||||
m_newReportFooter->setEnabled(true);
|
||||
m_editorTabType = ReportDesignWidget::Page;
|
||||
showDefaultEditors();
|
||||
showDefaultToolBars();
|
||||
}
|
||||
|
||||
void ReportDesignWindow::writePosition()
|
||||
@ -1048,6 +1062,7 @@ void ReportDesignWindow::slotLoadReport()
|
||||
setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer");
|
||||
addRecentFile(fileName);
|
||||
m_editorTabType = ReportDesignWidget::Page;
|
||||
showDefaultToolBars();
|
||||
showDefaultEditors();
|
||||
}
|
||||
}
|
||||
@ -1215,6 +1230,14 @@ void ReportDesignWindow::updateAvaibleBands(){
|
||||
}
|
||||
}
|
||||
|
||||
void ReportDesignWindow::showDefaultToolBars(){
|
||||
foreach (QToolBar* tb, m_pageTools){
|
||||
tb->setVisible(m_editorTabType != ReportDesignWidget::Dialog);
|
||||
}
|
||||
foreach (QToolBar* tb, m_dialogTools){
|
||||
tb->setVisible(m_editorTabType == ReportDesignWidget::Dialog);
|
||||
}
|
||||
}
|
||||
|
||||
void ReportDesignWindow::showDefaultEditors(){
|
||||
foreach (QDockWidget* w, m_pageEditors) {
|
||||
@ -1248,12 +1271,14 @@ void ReportDesignWindow::slotActivePageChanged()
|
||||
restoreState(m_dialogEditorsState);
|
||||
else
|
||||
showDefaultEditors();
|
||||
showDefaultToolBars();
|
||||
break;
|
||||
default:
|
||||
if (!m_pageEditors.isEmpty())
|
||||
restoreState(m_pageEditorsState);
|
||||
else
|
||||
showDefaultEditors();
|
||||
showDefaultToolBars();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -144,6 +144,7 @@ private:
|
||||
void createDialogActionEditor();
|
||||
void createDialogResourceEditor();
|
||||
void createDialogSignalSlotEditor();
|
||||
void createDialogDesignerToolBar();
|
||||
#endif
|
||||
void updateRedoUndo();
|
||||
void updateAvaibleBands();
|
||||
@ -154,6 +155,7 @@ private:
|
||||
void removeNotExistedRecentFiles();
|
||||
void removeNotExistedRecentFilesFromMenu(const QString& fileName);
|
||||
void addRecentFile(const QString& fileName);
|
||||
void showDefaultToolBars();
|
||||
void showDefaultEditors();
|
||||
private:
|
||||
static ReportDesignWindow* m_instance;
|
||||
@ -162,6 +164,9 @@ private:
|
||||
QToolBar* m_fontToolBar;
|
||||
QToolBar* m_reportToolBar;
|
||||
QToolBar* m_alignToolBar;
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
QToolBar* m_dialogDesignerToolBar;
|
||||
#endif
|
||||
QToolButton* m_newBandButton;
|
||||
QMenuBar* m_mainMenu;
|
||||
QMenu* m_fileMenu;
|
||||
@ -249,6 +254,8 @@ private:
|
||||
ReportDesignWidget::EditorTabType m_editorTabType;
|
||||
QByteArray m_pageEditorsState;
|
||||
QByteArray m_dialogEditorsState;
|
||||
QVector<QToolBar*> m_pageTools;
|
||||
QVector<QToolBar*> m_dialogTools;
|
||||
|
||||
};
|
||||
|
||||
|
@ -1067,6 +1067,17 @@ void ScriptEngineContext::addDialog(const QString& name, const QByteArray& descr
|
||||
m_dialogs.push_back(DialogDescriber::create(name,description));
|
||||
}
|
||||
|
||||
bool ScriptEngineContext::changeDialog(const QString& name, const QByteArray& description)
|
||||
{
|
||||
foreach( DialogDescriber::Ptr describer, m_dialogs){
|
||||
if (describer->name().compare(name) == 0){
|
||||
describer->setDescription(description);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScriptEngineContext::previewDialog(const QString& dialogName)
|
||||
{
|
||||
QDialog* dialog = getDialog(dialogName);
|
||||
|
@ -144,7 +144,8 @@ public:
|
||||
#endif
|
||||
explicit ScriptEngineContext(QObject* parent=0):QObject(parent){}
|
||||
#ifdef HAVE_UI_LOADER
|
||||
void addDialog(const QString& name, const QByteArray &description);
|
||||
void addDialog(const QString& name, const QByteArray& description);
|
||||
bool changeDialog(const QString& name, const QByteArray &description);
|
||||
bool previewDialog(const QString& dialogName);
|
||||
bool containsDialog(const QString& dialogName);
|
||||
const QVector<DialogDescriber::Ptr>& dialogDescribers(){return m_dialogs;}
|
||||
|
Loading…
Reference in New Issue
Block a user