- When mouse-over listview title, use highlight colour for text (and not whole background). This is more consistent with time-slider's time remaining label.

- Make shortcut for 'Go Back' action changeable.
This commit is contained in:
craig.p.drummond
2014-03-31 17:53:25 +00:00
committed by craig.p.drummond
parent e3eca2e9fb
commit 6637482bc6
3 changed files with 23 additions and 6 deletions

View File

@@ -35,6 +35,8 @@
#include "gtkstyle.h"
#include "spinner.h"
#include "messageoverlay.h"
#include "action.h"
#include "actioncollection.h"
#include <QToolButton>
#include <QStyle>
#include <QStyleOptionViewItem>
@@ -542,6 +544,7 @@ QString ItemView::modeStr(Mode m)
}
static const char *constPageProp="page";
static Action *backAction=0;
ItemView::ItemView(QWidget *p)
: QWidget(p)
@@ -557,10 +560,11 @@ ItemView::ItemView(QWidget *p)
, searchResetLevel(0)
{
setupUi(this);
backAction = new QAction(i18n("Go Back"), this);
backAction->setIcon(Icon("go-previous"));
if (!backAction) {
backAction=ActionCollection::get()->createAction("itemview-goback", i18n("Go Back"), Icon("go-previous"));
backAction->setShortcut(Qt::AltModifier+(Qt::LeftToRight==layoutDirection() ? Qt::Key_Left : Qt::Key_Right));
}
backButton->setDefaultAction(backAction);
backAction->setShortcut(Qt::AltModifier+(Qt::LeftToRight==layoutDirection() ? Qt::Key_Left : Qt::Key_Right));
Action::updateToolTip(backAction);
listView->addAction(backAction);
listView->addDefaultAction(backAction);
@@ -766,7 +770,9 @@ void ItemView::setLevel(int l, bool haveChildren)
{
int prev=currentLevel;
currentLevel=l;
backAction->setEnabled(0!=l);
if (isVisible()) {
backAction->setEnabled(0!=currentLevel);
}
if (Mode_IconTop==mode) {
if (0==currentLevel || haveChildren) {
@@ -1102,6 +1108,12 @@ void ItemView::hideBackAction()
listView->removeAction(backAction);
}
void ItemView::showEvent(QShowEvent *ev)
{
QWidget::showEvent(ev);
backAction->setEnabled(0!=currentLevel);
}
bool ItemView::eventFilter(QObject *o, QEvent *e)
{
if (o==title) {