diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2011-05-09 10:53:32 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-05-09 10:53:32 +0200 |
commit | fdf05ba369b62b0c87217f2c2565e7054d4123b6 (patch) | |
tree | 7edffba2a96dbfb188e62f8c24daffbd8cb7d5a7 /src/mainview.cpp | |
parent | Number the favorites pages to "suggest" numeric shortcut for (diff) | |
download | rekonq-fdf05ba369b62b0c87217f2c2565e7054d4123b6.tar.xz |
Use of QSignalMapper for switchToTab() method in terms of code unification
Patch by Thomas Murach, thanks ;)
RB:101246
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r-- | src/mainview.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index 19e4aae7..c7d66fa1 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -667,15 +667,11 @@ void MainView::openClosedTab() } -void MainView::switchToTab() +void MainView::switchToTab(const int index) { - // uses the sender to determine the tab index - QAction *sender = static_cast<QAction*>(QObject::sender()); - int index = sender->data().toInt(); - index -= 1; // to compensate for off by 1 presented to the user - if (index < 0 || index >= count()) + if (index <= 0 || index > count()) return; - setCurrentIndex(index); + setCurrentIndex(index-1); } |