summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-05-19 15:54:46 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-05-19 15:54:46 (GMT)
commite9dec649afc2e513354c79f6e38ca53b6943cccc (patch)
treec3947491e089a1d1d82148481c80ab4e46a49741 /tools
parent92b47ba61809de30eed205e7d1eafb1cde1087e1 (diff)
parent90b4f0ca7b9fe21f6c4b39a80f8f9cf98626690a (diff)
downloadQt-e9dec649afc2e513354c79f6e38ca53b6943cccc.zip
Qt-e9dec649afc2e513354c79f6e38ca53b6943cccc.tar.gz
Qt-e9dec649afc2e513354c79f6e38ca53b6943cccc.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'tools')
-rw-r--r--tools/assistant/tools/assistant/bookmarkmanager.cpp77
-rw-r--r--tools/assistant/tools/assistant/contentwindow.cpp9
-rw-r--r--tools/assistant/tools/assistant/indexwindow.cpp9
-rw-r--r--tools/assistant/tools/assistant/mainwindow.cpp30
4 files changed, 67 insertions, 58 deletions
diff --git a/tools/assistant/tools/assistant/bookmarkmanager.cpp b/tools/assistant/tools/assistant/bookmarkmanager.cpp
index 6f5732f..66475a4 100644
--- a/tools/assistant/tools/assistant/bookmarkmanager.cpp
+++ b/tools/assistant/tools/assistant/bookmarkmanager.cpp
@@ -536,58 +536,57 @@ void BookmarkWidget::focusInEvent(QFocusEvent *e)
bool BookmarkWidget::eventFilter(QObject *object, QEvent *e)
{
- if (object == this && e->type() == QEvent::KeyPress) {
- QKeyEvent *ke = static_cast<QKeyEvent*>(e);
+ if ((object == this) || (object == treeView->viewport())) {
QModelIndex index = treeView->currentIndex();
- switch (ke->key()) {
+ if (e->type() == QEvent::KeyPress) {
+ QKeyEvent *ke = static_cast<QKeyEvent*>(e);
if (index.isValid() && searchField->text().isEmpty()) {
- case Qt::Key_F2: {
- const QModelIndex& source = filterBookmarkModel->mapToSource(index);
- QStandardItem *item =
- bookmarkManager->treeBookmarkModel()->itemFromIndex(source);
+ if (ke->key() == Qt::Key_F2) {
+ QStandardItem *item = bookmarkManager->treeBookmarkModel()
+ ->itemFromIndex(filterBookmarkModel->mapToSource(index));
if (item) {
item->setEditable(true);
treeView->edit(index);
item->setEditable(false);
}
- } break;
-
- case Qt::Key_Delete: {
+ } else if (ke->key() == Qt::Key_Delete) {
bookmarkManager->removeBookmarkItem(treeView,
filterBookmarkModel->mapToSource(index));
- } break;
+ }
}
- case Qt::Key_Up:
- case Qt::Key_Down:
- treeView->subclassKeyPressEvent(ke);
- break;
-
- case Qt::Key_Enter: {
- case Qt::Key_Return:
- index = treeView->selectionModel()->currentIndex();
- if (index.isValid()) {
- QString data = index.data(Qt::UserRole + 10).toString();
- if (!data.isEmpty() && data != QLatin1String("Folder"))
- emit requestShowLink(data);
- }
- } break;
+ switch (ke->key()) {
+ default: break;
+ case Qt::Key_Up: {
+ case Qt::Key_Down:
+ treeView->subclassKeyPressEvent(ke);
+ } break;
- case Qt::Key_Escape:
- emit escapePressed();
- break;
+ case Qt::Key_Enter: {
+ case Qt::Key_Return:
+ index = treeView->selectionModel()->currentIndex();
+ if (index.isValid()) {
+ QString data = index.data(Qt::UserRole + 10).toString();
+ if (!data.isEmpty() && data != QLatin1String("Folder"))
+ emit requestShowLink(data);
+ }
+ } break;
- default:
- break;
- }
- }
- else if (object == treeView->viewport() && e->type() == QEvent::MouseButtonRelease) {
- const QModelIndex& index = treeView->currentIndex();
- QMouseEvent *me = static_cast<QMouseEvent*>(e);
- if (index.isValid() && (me->button() == Qt::MidButton)) {
- QString data = index.data(Qt::UserRole + 10).toString();
- if (!data.isEmpty() && data != QLatin1String("Folder"))
- CentralWidget::instance()->setSourceInNewTab(data);
+ case Qt::Key_Escape: {
+ emit escapePressed();
+ } break;
+ }
+ } else if (e->type() == QEvent::MouseButtonRelease) {
+ if (index.isValid()) {
+ QMouseEvent *me = static_cast<QMouseEvent*>(e);
+ bool controlPressed = me->modifiers() & Qt::ControlModifier;
+ if(((me->button() == Qt::LeftButton) && controlPressed)
+ || (me->button() == Qt::MidButton)) {
+ QString data = index.data(Qt::UserRole + 10).toString();
+ if (!data.isEmpty() && data != QLatin1String("Folder"))
+ CentralWidget::instance()->setSourceInNewTab(data);
+ }
+ }
}
}
return QWidget::eventFilter(object, e);
diff --git a/tools/assistant/tools/assistant/contentwindow.cpp b/tools/assistant/tools/assistant/contentwindow.cpp
index 89060bd..9f39de5 100644
--- a/tools/assistant/tools/assistant/contentwindow.cpp
+++ b/tools/assistant/tools/assistant/contentwindow.cpp
@@ -124,10 +124,10 @@ bool ContentWindow::eventFilter(QObject *o, QEvent *e)
QModelIndex index = m_contentWidget->indexAt(me->pos());
QItemSelectionModel *sm = m_contentWidget->selectionModel();
+ Qt::MouseButtons button = me->button();
if (index.isValid() && (sm && sm->isSelected(index))) {
- if (me->button() == Qt::LeftButton) {
- itemClicked(index);
- } else if (me->button() == Qt::MidButton) {
+ if ((button == Qt::LeftButton && (me->modifiers() & Qt::ControlModifier))
+ || (button == Qt::MidButton)) {
QHelpContentModel *contentModel =
qobject_cast<QHelpContentModel*>(m_contentWidget->model());
if (contentModel) {
@@ -135,12 +135,15 @@ bool ContentWindow::eventFilter(QObject *o, QEvent *e)
if (itm && !isPdfFile(itm))
CentralWidget::instance()->setSourceInNewTab(itm->url());
}
+ } else if (button == Qt::LeftButton) {
+ itemClicked(index);
}
}
}
return QWidget::eventFilter(o, e);
}
+
void ContentWindow::showContextMenu(const QPoint &pos)
{
if (!m_contentWidget->indexAt(pos).isValid())
diff --git a/tools/assistant/tools/assistant/indexwindow.cpp b/tools/assistant/tools/assistant/indexwindow.cpp
index a2c0950..1117ae0 100644
--- a/tools/assistant/tools/assistant/indexwindow.cpp
+++ b/tools/assistant/tools/assistant/indexwindow.cpp
@@ -146,8 +146,13 @@ bool IndexWindow::eventFilter(QObject *obj, QEvent *e)
&& e->type() == QEvent::MouseButtonRelease) {
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(e);
QModelIndex idx = m_indexWidget->indexAt(mouseEvent->pos());
- if (idx.isValid() && mouseEvent->button()==Qt::MidButton)
- open(m_indexWidget, idx);
+ if (idx.isValid()) {
+ Qt::MouseButtons button = mouseEvent->button();
+ if (((button == Qt::LeftButton) && (mouseEvent->modifiers() & Qt::ControlModifier))
+ || (button == Qt::MidButton)) {
+ open(m_indexWidget, idx);
+ }
+ }
}
#ifdef Q_OS_MAC
else if (obj == m_indexWidget && e->type() == QEvent::KeyPress) {
diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp
index cb10e3f..1db3bc2 100644
--- a/tools/assistant/tools/assistant/mainwindow.cpp
+++ b/tools/assistant/tools/assistant/mainwindow.cpp
@@ -926,25 +926,27 @@ void MainWindow::expandTOC(int depth)
void MainWindow::indexingStarted()
{
- m_progressWidget = new QWidget();
- QLayout* hlayout = new QHBoxLayout(m_progressWidget);
+ if (!m_progressWidget) {
+ m_progressWidget = new QWidget();
+ QLayout* hlayout = new QHBoxLayout(m_progressWidget);
- QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
+ QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
- QLabel *label = new QLabel(tr("Updating search index"));
- label->setSizePolicy(sizePolicy);
- hlayout->addWidget(label);
+ QLabel *label = new QLabel(tr("Updating search index"));
+ label->setSizePolicy(sizePolicy);
+ hlayout->addWidget(label);
- QProgressBar *progressBar = new QProgressBar();
- progressBar->setRange(0, 0);
- progressBar->setTextVisible(false);
- progressBar->setSizePolicy(sizePolicy);
+ QProgressBar *progressBar = new QProgressBar();
+ progressBar->setRange(0, 0);
+ progressBar->setTextVisible(false);
+ progressBar->setSizePolicy(sizePolicy);
- hlayout->setSpacing(6);
- hlayout->setMargin(0);
- hlayout->addWidget(progressBar);
+ hlayout->setSpacing(6);
+ hlayout->setMargin(0);
+ hlayout->addWidget(progressBar);
- statusBar()->addPermanentWidget(m_progressWidget);
+ statusBar()->addPermanentWidget(m_progressWidget);
+ }
}
void MainWindow::indexingFinished()