| Summary: | tool-tip for zoom indicator is below the screen if window is maximised | ||
|---|---|---|---|
| Product: | [Applications] digikam | Reporter: | Fabien <fabien.ubuntu> |
| Component: | Usability-Ergonomy | Assignee: | Digikam Developers <digikam-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | caulier.gilles |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Ubuntu | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | 0.9.3 | |
| Sentry Crash Report: | |||
|
Description
Fabien
2007-06-29 16:50:44 UTC
Fabien, The widget to show the zoom tooltip is a dedicaced widget. Look here : http://websvn.kde.org/branches/extragear/kde3/graphics/digikam/libs/widgets/common/dcursortracker.cpp?revision=670778&view=markup Look in DTipTracker, there is a "setAlignment()" call to adapt accordinly with the position of text over the border of screen. Gilles I tried to change from AlignTop to AlignBottom, but it doesn't change anything. I'm afraid I won't be able to help more on this :( Fabien, (:=)))
Try to play with this line :
bool DCursorTracker::eventFilter(QObject *object, QEvent *e)
{
...
move(event->globalPos().x() + 15, event->globalPos().y() + 15);
...and especially the "+15" offset used to move tooltip on X,Y...
You just need to adapt these values.
Gilles
Gilles
:) I didn't read the whole file, stupid I am... I will do some tests. This is known problem. Ok, so I did some tests and I changed the value so that the tool-tip is just above the pointer.
I tried to create a snapshot, but we can't see the pointer :(
It's much better like that in my opinion.
If it's ok for you, I'll commit the fix to svn.
Index: dcursortracker.cpp
===================================================================
--- dcursortracker.cpp (revision 682745)
+++ dcursortracker.cpp (working copy)
@@ -69,7 +69,7 @@
(event->stateAfter() & LeftButton)))
{
show();
- move(event->globalPos().x() + 15, event->globalPos().y() + 15);
+ move(event->globalPos().x() + 15, event->globalPos().y() - 15);
}
else
{
Fabien this can be a fast fix for this problem. This widget is always on the bottom of windows.
But, i prefert an advanced fix which include something like QToolTip do : check the position of the widget over the screen and adapt X and Y offset accordinly to be always readable.
See below the code from Qt3.5.7. It have been extracted from method "void QTipManager::showTip()" of qtooltip.cpp C++ file. It resume exactly what we need to compute the offset and it simple to understand :
{
...
int scr;
if ( QApplication::desktop()->isVirtualDesktop() )
scr = QApplication::desktop()->screenNumber( widget->mapToGlobal( pos ) );
else
scr = QApplication::desktop()->screenNumber( widget );
...
#ifdef Q_WS_MAC
QRect screen = QApplication::desktop()->availableGeometry( scr );
#else
QRect screen = QApplication::desktop()->screenGeometry( scr );
#endif
QPoint p;
p = widget->mapToGlobal( t->geometry.topLeft() );
if ( p.y() < screen.y() )
p.setY( screen.y() );
if ( p.x() + label->width() > screen.x() + screen.width() )
p.setX( screen.x() + screen.width() - label->width() );
if ( p.x() < screen.x() )
p.setX( screen.x() );
if ( p.y() + label->height() > screen.y() + screen.height() )
p.setY( screen.y() + screen.height() - label->height() );
if ( label->text().length() )
label->move( p );
...
}
"pos" is the current position of the mouse over the screen.
"scr" is a reference to the screen object.
"screen" is the screen rectangle. It include xinerama case.
"label" is the qtooltip label displayed by Qt over the widget.
"p" is the left/top point of the tip label to display adjusted over the screen.
You can adapt this code to DCursorTracker::eventFilter() method easily...
Gilles
SVN commit 690669 by cgilles:
digikam from KDE3 branch : fix cursor tracker tooltip position to be always visible with zoom slider.
BUG: 147362
M +1 -1 dcursortracker.cpp
--- branches/extragear/kde3/graphics/digikam/libs/widgets/common/dcursortracker.cpp #690668:690669
@@ -69,7 +69,7 @@
(event->stateAfter() & LeftButton)))
{
show();
- move(event->globalPos().x() + 15, event->globalPos().y() + 15);
+ move(event->globalPos().x() + 15, event->globalPos().y() - 15);
}
else
{
SVN commit 690670 by cgilles:
digiKam from trunk (KDE4): backport KDE3 fix.
CCBUGS: 147362
M +1 -1 dcursortracker.cpp
--- trunk/extragear/graphics/digikam/libs/widgets/common/dcursortracker.cpp #690669:690670
@@ -72,7 +72,7 @@
(event->buttons() & Qt::LeftButton)))
{
show();
- move(event->globalPos().x() + 15, event->globalPos().y() + 15);
+ move(event->globalPos().x() + 15, event->globalPos().y() - 15);
}
else
{
|