diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-01-02 23:56:59 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-01-02 23:56:59 +0000 |
commit | 0b5c18f24a5f6e3d62c398210313f596a00cb3c1 (patch) | |
tree | 21ba37abda05de10270d6ed83c598727cf53c0d1 /textedit.cpp | |
parent | set focus to textedit field, when new tab is created (diff) | |
download | gpg4usb-0b5c18f24a5f6e3d62c398210313f596a00cb3c1.tar.gz gpg4usb-0b5c18f24a5f6e3d62c398210313f596a00cb3c1.zip |
added shortcuts Ctrl+Tab and Ctrl+Shift+Tab to switch through the tabs
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@424 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'textedit.cpp')
-rw-r--r-- | textedit.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/textedit.cpp b/textedit.cpp index 0e666e8..16cbd84 100644 --- a/textedit.cpp +++ b/textedit.cpp @@ -79,7 +79,7 @@ void TextEdit::newTab() EditorPage *page = new EditorPage(); tabWidget->addTab(page, header); tabWidget->setCurrentIndex(tabWidget->count() - 1); - + page->getTextPage()->setFocus(); connect(page->getTextPage(), SIGNAL(modificationChanged(bool)), this, SLOT(showModified())); // setCursorPosition(); } @@ -102,13 +102,13 @@ void TextEdit::open() QApplication::setOverrideCursor(Qt::WaitCursor); page->getTextPage()->setPlainText(in.readAll()); page->setFilePath(fileName); - QTextDocument *document = page->getTextPage()->document(); document->setModified(false); tabWidget->addTab(page, strippedName(fileName)); tabWidget->setCurrentIndex(tabWidget->count() - 1); QApplication::restoreOverrideCursor(); + page->getTextPage()->setFocus(); connect(page->getTextPage(), SIGNAL(modificationChanged(bool)), this, SLOT(showModified())); // setCursorPosition(); //enableAction(true) @@ -426,3 +426,30 @@ void TextEdit::showModified() { else tabWidget->setTabText(index, title.remove(0,2)); } + +void TextEdit::switchTabUp() { + if (tabWidget->count() > 1) + { + if (tabWidget->count() == tabWidget->currentIndex()+1){ + tabWidget->setCurrentIndex(0); + } + else + { + tabWidget->setCurrentIndex(tabWidget->currentIndex()+1); + } + } +} + +void TextEdit::switchTabDown() { + if (tabWidget->count() > 1) + { + if (tabWidget->currentIndex()==1) { + tabWidget->setCurrentIndex(tabWidget->count()-1); + } + else + { + tabWidget->setCurrentIndex(tabWidget->currentIndex()-1); + } + } +} + |