~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to libs/widgets/common/dcursortracker.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Christian Mangold
  • Date: 2010-04-09 21:30:01 UTC
  • mfrom: (1.2.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100409213001-4bfyibrd359rn7o3
Tags: 2:1.2.0-0ubuntu1
* New upstream release (LP: #560576)
* Remove all patches, fixed upstream
  - Remove quilt build-depend

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 * Description : A tool tip widget which follows cursor movements.
8
8
 *               Tool tip content is displayed without delay.
9
9
 *
10
 
 * Copyright (C) 2007-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
11
 
 * Copyright (C)      2009 by Andi Clemens <andi dot clemens at gmx dot net>
 
10
 * Copyright (C) 2007-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
11
 * Copyright (C) 2009-2010 by Andi Clemens <andi dot clemens at gmx dot net>
12
12
 *
13
13
 * This program is free software; you can redistribute it
14
14
 * and/or modify it under the terms of the GNU General
37
37
 
38
38
// KDE includes
39
39
 
40
 
 
 
40
#include <kapplication.h>
41
41
 
42
42
namespace Digikam
43
43
{
95
95
void DCursorTracker::setEnable(bool b)
96
96
{
97
97
    d->enable = b;
98
 
    moveToParent(d->parent);
99
98
}
100
99
 
101
100
void DCursorTracker::setKeepOpen(bool b)
110
109
 
111
110
void DCursorTracker::triggerAutoShow(int timeout)
112
111
{
113
 
    if (d->enable)
 
112
    if (canBeDisplayed())
114
113
    {
115
114
        show();
116
115
        moveToParent(d->parent);
137
136
        case QEvent::MouseMove:
138
137
        {
139
138
            QMouseEvent *event = static_cast<QMouseEvent*>(e);
140
 
            if (d->enable && (widget->rect().contains(event->pos()) ||
 
139
            if (canBeDisplayed() && (widget->rect().contains(event->pos()) ||
141
140
                             (event->buttons() & Qt::LeftButton)))
142
141
            {
143
142
                show();
196
195
    }
197
196
}
198
197
 
 
198
bool DCursorTracker::canBeDisplayed()
 
199
{
 
200
    return d->enable && d->parent->isVisible();
 
201
}
 
202
 
199
203
 
200
204
DTipTracker::DTipTracker(const QString& txt, QWidget *parent, Qt::Alignment align)
201
205
           : DCursorTracker(txt, parent, align)