void TabBar::wheelEvent(QWheelEvent* event) { if (event->delta() < 0) selectNextTab(); else selectPreviousTab(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_session(NULL), m_closeEvent(NULL) { m_ui.setupUi(this); connect(m_ui.serverTab, SIGNAL(inputReceived(const QString &, const QString &)), &inputHandler, SLOT(handleInput(const QString &, const QString &))); connect(this, SIGNAL(fontChanged(const QFont &)), m_ui.serverTab, SLOT(setFont(const QFont &))); connect(&inputHandler, SIGNAL(echoCommandReceived(const QString &)), this, SLOT(echoCommandReceived(const QString &))); connect(&inputHandler, SIGNAL(closeCommandReceived()), this, SLOT(closeCommandReceived())); m_closeTimer.setSingleShot(true); connect(&m_closeTimer, SIGNAL(timeout()), this, SLOT(closeWindow())); m_nextTabShortcut = new QShortcut(QKeySequence("Ctrl+PgDown"), this); m_previousTabShortcut = new QShortcut(QKeySequence("Ctrl+PgUp"), this); m_firstTabShortcut = new QShortcut(QKeySequence("Alt+1"), this); m_secondTabShortcut = new QShortcut(QKeySequence("Alt+2"), this); m_thirdTabShortcut = new QShortcut(QKeySequence("Alt+3"), this); m_fourthTabShortcut = new QShortcut(QKeySequence("Alt+4"), this); m_fifthTabShortcut = new QShortcut(QKeySequence("Alt+5"), this); m_sixthTabShortcut = new QShortcut(QKeySequence("Alt+6"), this); m_seventhTabShortcut = new QShortcut(QKeySequence("Alt+7"), this); m_eighthTabShortcut = new QShortcut(QKeySequence("Alt+8"), this); m_ninthTabShortcut = new QShortcut(QKeySequence("Alt+9"), this); connect(m_nextTabShortcut, SIGNAL(activated()), this, SLOT(selectNextTab())); connect(m_previousTabShortcut, SIGNAL(activated()), this, SLOT(selectPreviousTab())); connect(m_firstTabShortcut, SIGNAL(activated()), this, SLOT(selectFirstTab())); connect(m_secondTabShortcut, SIGNAL(activated()), this, SLOT(selectSecondTab())); connect(m_thirdTabShortcut, SIGNAL(activated()), this, SLOT(selectThirdTab())); connect(m_fourthTabShortcut, SIGNAL(activated()), this, SLOT(selectFourthTab())); connect(m_fifthTabShortcut, SIGNAL(activated()), this, SLOT(selectFifthTab())); connect(m_sixthTabShortcut, SIGNAL(activated()), this, SLOT(selectSixthTab())); connect(m_seventhTabShortcut, SIGNAL(activated()), this, SLOT(selectSeventhTab())); connect(m_eighthTabShortcut, SIGNAL(activated()), this, SLOT(selectEighthTab())); connect(m_ninthTabShortcut, SIGNAL(activated()), this, SLOT(selectNinthTab())); m_ui.serverTab->setFocus(); }