From 710194c1cc6399878eadda84c23f7a52e7baa879 Mon Sep 17 00:00:00 2001 From: nils Date: Thu, 8 Dec 2011 17:08:06 +0000 Subject: added zoom in/out to textedit git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@677 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- mainwindow.cpp | 11 +++++++++++ mainwindow.h | 2 ++ textedit.cpp | 18 ++++++++++++++++++ textedit.h | 2 ++ 4 files changed, 33 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index e6242c0..58267ae 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -206,6 +206,14 @@ void MainWindow::createActions() redoAct->setToolTip(tr("Redo Last Edit Action")); connect(redoAct, SIGNAL(triggered()), edit, SLOT(redo())); + zoomInAct = new QAction(tr("Zoom In"), this); + zoomInAct->setShortcut(QKeySequence::ZoomIn); + connect(zoomInAct, SIGNAL(triggered()), edit, SLOT(zoomIn())); + + zoomOutAct = new QAction(tr("Zoom Out"), this); + zoomOutAct->setShortcut(QKeySequence::ZoomOut); + connect(zoomOutAct, SIGNAL(triggered()), edit, SLOT(zoomOut())); + pasteAct = new QAction(tr("&Paste"), this); pasteAct->setIcon(QIcon(iconPath + "button_paste.png")); pasteAct->setShortcut(QKeySequence::Paste); @@ -370,6 +378,9 @@ void MainWindow::createMenus() editMenu->addAction(undoAct); editMenu->addAction(redoAct); editMenu->addSeparator(); + editMenu->addAction(zoomInAct); + editMenu->addAction(zoomOutAct); + editMenu->addSeparator(); editMenu->addAction(copyAct); editMenu->addAction(cutAct); editMenu->addAction(pasteAct); diff --git a/mainwindow.h b/mainwindow.h index 16ee618..3106371 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -275,6 +275,8 @@ private: QAction *selectallAct; /** Action to select whole text */ QAction *undoAct; /** Action to undo last action */ QAction *redoAct; /** Action to redo last action */ + QAction *zoomInAct; /** Action to zoom in */ + QAction *zoomOutAct; /** Action to zoom out */ QAction *aboutAct; /** Action to open about dialog */ QAction *fileEncryptionAct; /** Action to open file-encryption dialog */ QAction *fileEncryptAct; /** Action to open dialog for encrypting file */ diff --git a/textedit.cpp b/textedit.cpp index f69715b..b3b9f58 100644 --- a/textedit.cpp +++ b/textedit.cpp @@ -497,6 +497,24 @@ void TextEdit::redo() curTextPage()->redo(); } +void TextEdit::zoomIn() +{ + if (tabWidget->count() == 0 || curTextPage() == 0) { + return; + } + + curTextPage()->zoomIn(); +} + +void TextEdit::zoomOut() +{ + if (tabWidget->count() == 0 || curTextPage() == 0) { + return; + } + + curTextPage()->zoomOut(); +} + void TextEdit::selectAll() { if (tabWidget->count() == 0 || curTextPage() == 0) { diff --git a/textedit.h b/textedit.h index bdbd62a..4b5a1b3 100644 --- a/textedit.h +++ b/textedit.h @@ -239,6 +239,8 @@ private slots: */ void redo(); + void zoomIn(); + void zoomOut(); /**************************************************************************************** * Name: selectAll * Description: select all in current textpage -- cgit v1.2.3