void TemplateWidget::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Return) setFileName(ui.templateCombo->currentText()); if (event->key() == Qt::Key_Escape || event->key() == Qt::Key_Return) emit focusEditor(); QWidget::keyPressEvent(event); }
void PdfViewer::slotFind() { if (!m_findWidget) { m_findWidget = new FindWidget(this); centralWidget()->layout()->addWidget(m_findWidget); connect(m_findWidget, SIGNAL(search(QString,PdfView::FindFlags)), this, SLOT(slotSearch(QString,PdfView::FindFlags))); connect(m_findWidget, SIGNAL(focusEditor()), m_pdfView, SLOT(setFocus())); connect(m_pdfView, SIGNAL(closeFindWidget()), m_findWidget, SLOT(hide())); } m_findWidget->setVisible(true); m_findWidget->setFocus(); }
TikzEditorView::TikzEditorView(QWidget *parent) : QWidget(parent) { m_parentWidget = parent; m_tikzEditor = new TikzEditor; m_tikzEditor->setWhatsThis(tr("<p>Enter your TikZ code here. " "The code should begin with \\begin{tikzpicture} and end with " "\\end{tikzpicture}.</p>")); /* commandInserter = new TikzCommandInserter(tikzEditor, this); tikzHighlighter = new TikzHighlighter(commandInserter, tikzEditor->document()); tikzHighlighter->rehighlight(); // avoid that textEdit emits the signal contentsChanged() when it is still empty tikzController = new TikzPngPreviewer(textEdit); */ m_replaceWidget = new ReplaceWidget(this); m_replaceWidget->setVisible(false); m_replaceCurrentWidget = new ReplaceCurrentWidget(this); m_replaceCurrentWidget->setVisible(false); m_goToLineWidget = new GoToLineWidget(this); m_goToLineWidget->setVisible(false); // QFrame *mainWidget = new QFrame; // mainWidget->setLineWidth(1); // mainWidget->setFrameShape(QFrame::StyledPanel); // mainWidget->setFrameShadow(QFrame::Sunken); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->setSpacing(0); mainLayout->setMargin(0); mainLayout->addWidget(m_tikzEditor); mainLayout->addWidget(m_replaceWidget); mainLayout->addWidget(m_replaceCurrentWidget); mainLayout->addWidget(m_goToLineWidget); createActions(); connect(m_tikzEditor->document(), SIGNAL(modificationChanged(bool)), this, SIGNAL(modificationChanged(bool))); connect(m_tikzEditor->document(), SIGNAL(contentsChanged()), this, SIGNAL(contentsChanged())); connect(m_tikzEditor, SIGNAL(cursorPositionChanged(int,int)), this, SIGNAL(cursorPositionChanged(int,int))); connect(m_tikzEditor, SIGNAL(showStatusMessage(QString,int)), this, SIGNAL(showStatusMessage(QString,int))); connect(m_tikzEditor, SIGNAL(focusIn()), this, SIGNAL(focusIn())); connect(m_tikzEditor, SIGNAL(focusOut()), this, SIGNAL(focusOut())); connect(m_replaceWidget, SIGNAL(search(QString,bool,bool,bool)), this, SLOT(search(QString,bool,bool,bool))); connect(m_replaceWidget, SIGNAL(replace(QString,QString,bool,bool,bool)), this, SLOT(replace(QString,QString,bool,bool,bool))); connect(m_replaceWidget, SIGNAL(focusEditor()), m_tikzEditor, SLOT(setFocus())); connect(m_replaceCurrentWidget, SIGNAL(showReplaceWidget()), m_replaceWidget, SLOT(show())); connect(m_replaceCurrentWidget, SIGNAL(search(QString,bool,bool,bool,bool)), this, SLOT(search(QString,bool,bool,bool,bool))); connect(m_replaceCurrentWidget, SIGNAL(replace(QString)), this, SLOT(replace(QString))); connect(m_replaceCurrentWidget, SIGNAL(replaceAll(QString,QString,bool,bool,bool,bool)), this, SLOT(replaceAll(QString,QString,bool,bool,bool,bool))); connect(m_replaceCurrentWidget, SIGNAL(setSearchFromBegin(bool)), this, SIGNAL(setSearchFromBegin(bool))); connect(m_goToLineWidget, SIGNAL(goToLine(int)), this, SLOT(goToLine(int))); }