connect(searchSelectedAction, SIGNAL(triggered()),
this, SIGNAL(search()));
+ connect(page(), SIGNAL(selectionChanged()), this, SLOT(selection()));
}
void TranslationTextEdit::contextMenuEvent(QContextMenuEvent *e) {
}
+void TranslationTextEdit::zoomIn() {
+ setZoomFactor(zoomFactor()*1.05);
+}
+
+void TranslationTextEdit::zoomOut() {
+ setZoomFactor(zoomFactor()*0.95);
+}
+
+void TranslationTextEdit::copy() {
+ pageAction(QWebPage::Copy)->trigger();
+}
+
+void TranslationTextEdit::selection() {
+ if(selectedText().size())
+ Q_EMIT copyAvailable(true);
+ else
+ Q_EMIT copyAvailable(false);
+}
+
+
+void TranslationTextEdit::selectAll() {
+ pageAction(QWebPage::SelectAll)->trigger();
+}
+
+
showButtonsButton->setMinimumSize(searchButton->sizeHint());
connect(zoomInButton, SIGNAL(clicked()),
- textEdit, SLOT(zoomIn()));
+ webkit, SLOT(zoomIn()));
connect(zoomOutButton, SIGNAL(clicked()),
- textEdit, SLOT(zoomOut()));
+ webkit, SLOT(zoomOut()));
connect(searchButton, SIGNAL(clicked()),
this, SLOT(searchSelected()));
connect(copyButton, SIGNAL(clicked()),
- textEdit, SLOT(copy()));
+ webkit, SLOT(copy()));
- connect(textEdit, SIGNAL(copyAvailable(bool)),
+ connect(webkit, SIGNAL(copyAvailable(bool)),
searchButton, SLOT(setEnabled(bool)));
- connect(textEdit, SIGNAL(copyAvailable(bool)),
+ connect(webkit, SIGNAL(copyAvailable(bool)),
copyButton, SLOT(setEnabled(bool)));
connect(selectAllButton, SIGNAL(clicked()),
- textEdit, SLOT(selectAll()));
+ webkit, SLOT(selectAll()));
buttonsInitialized = false;
void TranslationWidget::keyPressEvent(QKeyEvent* event) {
switch (event->key()) {
case Qt::Key_F7:
- textEdit->zoomIn();
+ webkit->zoomIn();
event->accept();
break;
case Qt::Key_F8:
- textEdit->zoomOut();
+ webkit->zoomOut();
event->accept();
break;
}