From: Flavio Tordini Date: Sun, 30 Aug 2009 22:19:19 +0000 (+0200) Subject: Status tip support in THBlackBar X-Git-Tag: 0.6~33 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1702c7a7831ca0045f220473baae1924007695ee;p=minitube Status tip support in THBlackBar --- diff --git a/src/MediaView.cpp b/src/MediaView.cpp index ae90525..22163bd 100644 --- a/src/MediaView.cpp +++ b/src/MediaView.cpp @@ -20,17 +20,23 @@ MediaView::MediaView(QWidget *parent) : QWidget(parent) { sortBar = new THBlackBar(this); mostRelevantAction = new QAction(tr("Most relevant"), this); - mostRelevantAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_1)); + QKeySequence keySequence(Qt::CTRL + Qt::Key_1); + mostRelevantAction->setShortcut(keySequence); + mostRelevantAction->setStatusTip(keySequence.toString()); addAction(mostRelevantAction); connect(mostRelevantAction, SIGNAL(triggered()), this, SLOT(searchMostRelevant()), Qt::QueuedConnection); sortBar->addAction(mostRelevantAction); mostRecentAction = new QAction(tr("Most recent"), this); - mostRecentAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_2)); + keySequence = QKeySequence(Qt::CTRL + Qt::Key_2); + mostRecentAction->setShortcut(keySequence); + mostRecentAction->setStatusTip(keySequence.toString()); addAction(mostRecentAction); connect(mostRecentAction, SIGNAL(triggered()), this, SLOT(searchMostRecent()), Qt::QueuedConnection); sortBar->addAction(mostRecentAction); mostViewedAction = new QAction(tr("Most viewed"), this); - mostViewedAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_3)); + keySequence = QKeySequence(Qt::CTRL + Qt::Key_3); + mostViewedAction->setShortcut(keySequence); + mostViewedAction->setStatusTip(keySequence.toString()); addAction(mostViewedAction); connect(mostViewedAction, SIGNAL(triggered()), this, SLOT(searchMostViewed()), Qt::QueuedConnection); sortBar->addAction(mostViewedAction); diff --git a/src/thlibrary/thblackbar.cpp b/src/thlibrary/thblackbar.cpp index 05522ad..dce936c 100644 --- a/src/thlibrary/thblackbar.cpp +++ b/src/thlibrary/thblackbar.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "thblackbar.h" @@ -18,7 +19,7 @@ class THBlackBar::Private { * PUBLIC Constructor/Destructors */ THBlackBar::THBlackBar (QWidget *parent) - : QWidget(parent), d(new THBlackBar::Private) + : QWidget(parent), d(new THBlackBar::Private) { // Setup Widget Options setMouseTracking(true); @@ -118,6 +119,10 @@ void THBlackBar::mouseMoveEvent (QMouseEvent *event) { d->hoveredAction = action; action->hover(); update(); + + // status tip + QMainWindow* mainWindow = dynamic_cast(qApp->topLevelWidgets().first()); + if (mainWindow) mainWindow->statusBar()->showMessage(action->statusTip()); } }