void FormMain::setTemplateCore(TemplateCore *core) { setWindowTitle(m_normalTitle); // Set editor widget as central widget of main window // and setup simulator stuff. TemplateEditor *editor = core->editor(); TemplateSimulator *simulator = core->simulator(); // Clear previous editor if any. while (m_centralLayout->count() > 0) { QLayoutItem *item = m_centralLayout->itemAt(0); item->widget()->deleteLater(); m_centralLayout->removeItem(item); delete item; } // Set editor part. m_centralLayout->layout()->addWidget(editor); editor->setParent(m_centralArea); connect(editor, SIGNAL(changed()), this, SLOT(onEditorChanged())); connect(editor, SIGNAL(canGenerateChanged(bool,QString)), this, SLOT(onCanGenerateChanged(bool,QString))); connect(simulator, SIGNAL(canGoBackChanged(bool)), m_ui->m_actionSimulatorGoBack, SLOT(setEnabled(bool))); // Set simulator part. m_simulatorWindow->setActiveSimulation(simulator); // Now, new template editor is set and simulator is set. Launch the template. core->launch(); }
ItemEditor* ComponentEditorAPIInterfaceItem::editor() { if (!editor_) { editor_ = new ApiInterfaceEditor(libHandler_, component_, apiIf_, NULL); editor_->setProtection(locked_); connect(editor_, SIGNAL(contentChanged()), this, SLOT(onEditorChanged()), Qt::UniqueConnection); connect(editor_, SIGNAL(helpUrlRequested(QString const&)), this, SIGNAL(helpUrlRequested(QString const&))); }
ItemEditor* ComponentEditorGeneralItem::editor() { if (!editor_) { editor_ = new GeneralEditor(libHandler_, component_); editor_->setProtection(locked_); connect(editor_, SIGNAL(contentChanged()), this, SLOT(onEditorChanged()), Qt::UniqueConnection); connect(editor_, SIGNAL(helpUrlRequested(QString const&)), this, SIGNAL(helpUrlRequested(QString const&))); }
void MainWindow::createDockWindows() { QDockWidget *dock = new QDockWidget(tr("Text Editor"), this); m_editor = new TextEdit(dock); connect(m_editor->document(), SIGNAL(contentsChanged()), this, SLOT(onEditorChanged())); dock->setWidget(m_editor); dock->setObjectName("text_editor"); addDockWidget(Qt::RightDockWidgetArea, dock); m_showEditorDockAction = dock->toggleViewAction(); m_showEditorDockAction->setIconVisibleInMenu(false); m_showEditorDockAction->setStatusTip(tr("Show or hide the document editor dock")); m_showEditorDockAction->setIcon(QIcon::fromTheme("accessories-text-editor")); m_showEditorDockAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_0)); dock = new QDockWidget(tr("Assistant"), this); m_assistantToolBox = new QToolBox(dock); dock->setWidget(m_assistantToolBox); dock->setObjectName("assistant"); addDockWidget(Qt::LeftDockWidgetArea, dock); connect(m_assistantToolBox, SIGNAL(currentChanged(int)), this, SLOT(onCurrentAssistantChanged(int))); m_showAssistantDockAction = dock->toggleViewAction(); m_showAssistantDockAction->setIconVisibleInMenu(false); m_showAssistantDockAction->setStatusTip(tr("Show or hide the assistant dock")); #if !defined(Q_WS_WIN) // BUG: icons are not displayed when cross-linking m_showAssistantDockAction->setIcon(QIcon(":/assistant.svg")); #endif m_showAssistantDockAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_1)); dock = new QDockWidget(tr("Assistant Info"), this); QWidget* widget = new QWidget(dock); m_assistantPreviewNotes = new QLabel(widget); m_assistantPreviewNotes->setText(tr("Code:")); m_assistantCodePreview = new QTextEdit(widget); m_assistantCodePreview->setReadOnly(true); QBoxLayout* assistant_info_layout = new QBoxLayout(QBoxLayout::TopToBottom, widget); assistant_info_layout->addWidget(m_assistantPreviewNotes); assistant_info_layout->addWidget(m_assistantCodePreview); widget->setLayout(assistant_info_layout); dock->setWidget(widget); dock->setObjectName("assistant_info"); addDockWidget(Qt::LeftDockWidgetArea, dock); m_showAssistantInfoDockAction = dock->toggleViewAction(); m_showAssistantInfoDockAction->setIconVisibleInMenu(false); m_showAssistantInfoDockAction->setStatusTip(tr("Show or hide the assistant info dock")); #if !defined(Q_WS_WIN) // BUG: icons are not displayed when cross-linking m_showAssistantInfoDockAction->setIcon(QIcon(":/assistant-info.svg")); #endif m_showAssistantInfoDockAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_2)); }
ItemEditor* ComponentEditorParametersItem::editor() { if (!editor_) { editor_ = new ParametersEditor(component_, libHandler_, parameterFinder_, expressionFormatter_); editor_->setProtection(locked_); connect(editor_, SIGNAL(contentChanged()), this, SLOT(onEditorChanged()), Qt::UniqueConnection); connect(editor_, SIGNAL(helpUrlRequested(QString const&)), this, SIGNAL(helpUrlRequested(QString const&))); connectItemEditorToReferenceCounter(); connectReferenceTree(); }
//----------------------------------------------------------------------------- // Function: SingleRemapStateItem::editor() //----------------------------------------------------------------------------- ItemEditor* SingleRemapStateItem::editor() { if (!editor_) { editor_ = new SingleRemapStateEditor(component_, remapState_, libHandler_, parameterFinder_, expressionFormatter_); editor_->setProtection(locked_); connect(editor_, SIGNAL(contentChanged()), this, SLOT(onEditorChanged()), Qt::UniqueConnection); connect(editor_, SIGNAL(errorMessage(const QString&)), this, SIGNAL(errorMessage(const QString&)), Qt::UniqueConnection); connect(editor_, SIGNAL(helpUrlRequested(QString const&)), this, SIGNAL(helpUrlRequested(QString const&)), Qt::UniqueConnection); connectItemEditorToReferenceCounter(); }