Bug 147362 - tool-tip for zoom indicator is below the screen if window is maximised
Summary: tool-tip for zoom indicator is below the screen if window is maximised
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Unclassified
Component: Usability-Ergonomy (show other bugs)
Version: unspecified
Platform: Ubuntu Packages Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-29 16:50 UTC by Fabien
Modified: 2017-08-06 08:16 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 0.9.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabien 2007-06-29 16:50:44 UTC
Version:           svn (using KDE KDE 3.5.4)
Installed from:    Ubuntu Packages
OS:                Linux

This applies for the main digikam window but also with lighttable.
The size/zoom indicator is at the bottom of the window.
If you put the mouse over it, you get size/zoom value.
But, if the window is maximised (and no taskbar), the tool-tip is displayed under it, so we can't see it :(
I think behavior should be like Konsole :
If there's enough place below, it's displayed under the button, otherwise, it's aboe.


I tried to have a look at Qlabel alignments, but I don't have enough knowledge in Qt/C++ to fix it...
Comment 1 caulier.gilles 2007-06-29 17:56: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
Comment 2 Fabien 2007-07-02 14:48:17 UTC
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 :(
Comment 3 caulier.gilles 2007-07-02 15:00:10 UTC
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
Comment 4 Fabien 2007-07-02 15:55:56 UTC
:)
I didn't read the whole file, stupid I am...
I will do some tests.
Comment 5 Mikolaj Machowski 2007-07-02 18:10:22 UTC
This is known problem.
Comment 6 Fabien 2007-07-03 17:24:29 UTC
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
             {
Comment 7 caulier.gilles 2007-07-04 08:16:32 UTC
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
Comment 8 caulier.gilles 2007-07-21 21:23:09 UTC
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 
             {
Comment 9 caulier.gilles 2007-07-21 21:24:06 UTC
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 
             {