コード例 #1
0
ファイル: tabbar.cpp プロジェクト: igordcard/yakuake
void TabBar::wheelEvent(QWheelEvent* event)
{
    if (event->delta() < 0)
        selectNextTab();
    else
        selectPreviousTab();
}
コード例 #2
0
ファイル: mainwindow.cpp プロジェクト: viking/smirch-qt
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();
}
コード例 #3
0
// virtual
BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask)
{
	BOOL handled = FALSE;
	if (key == KEY_LEFT && mask == MASK_ALT)
	{
		selectPrevTab();
		handled = TRUE;
	}
	else if (key == KEY_RIGHT && mask == MASK_ALT)
	{
		selectNextTab();
		handled = TRUE;
	}

	if (handled)
	{
		if (getCurrentPanel())
		{
			getCurrentPanel()->setFocus(TRUE);
		}
	}

	if (!gFocusMgr.childHasKeyboardFocus(getCurrentPanel()))
	{
		// if child has focus, but not the current panel, focus is on a button
		if (mIsVertical)
		{
			switch(key)
			{
			  case KEY_UP:
				selectPrevTab();
				handled = TRUE;
				break;
			  case KEY_DOWN:
				selectNextTab();
				handled = TRUE;
				break;
			  case KEY_LEFT:
				handled = TRUE;
				break;
			  case KEY_RIGHT:
				if (getTabPosition() == LEFT && getCurrentPanel())
				{
					getCurrentPanel()->setFocus(TRUE);
				}
				handled = TRUE;
				break;
			  default:
				break;
			}
		}
		else
		{
			switch(key)
			{
			  case KEY_UP:
				if (getTabPosition() == BOTTOM && getCurrentPanel())
				{
					getCurrentPanel()->setFocus(TRUE);
				}
				handled = TRUE;
				break;
			  case KEY_DOWN:
				if (getTabPosition() == TOP && getCurrentPanel())
				{
					getCurrentPanel()->setFocus(TRUE);
				}
				handled = TRUE;
				break;
			  case KEY_LEFT:
				selectPrevTab();
				handled = TRUE;
				break;
			  case KEY_RIGHT:
				selectNextTab();
				handled = TRUE;
				break;
			  default:
				break;
			}
		}
	}
	return handled;
}