Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, June 2007
Qt 4.3.0 PATCH: fix cursor navigation in QTreeView


Message 1 in thread

Imagine a QTreeWidget with items and child items, like

[-] Level 1
    [-] Level 2
        [-] Level 3
            Item 3.1
            Item 3.2

and the current item is "Item 3.2".

In Qt 3 the behavior on all platforms when pressing Crsr-Left was that
the current item would become "Level 3", the next press
of Crsr-Left would collapse "Level 3", and the next press
would make "Level 2" current and so on.

In Qt 4 pressing Crsr-Left while "Item 3.2" is current
does nothing on X11 and Mac. If "Level 3" is current, pressing Crsr-Left
collapses it, but a further press of Crsr-Left doesn't make
"Level 2" current. On Windows this still works as expected.

When I reported this to qt-bugs@xxxxxxxxxxxxx, I was told that this
"can not be considered as a bug but rather an intended behavior introduced
in Qt4.x series". Well, I don't see what benefit this should have,
and why it is now behaving differently on Windows and Linux/Mac.
The old behavior allowed for easy navigation in tree widgets with
the cursor keys, so why lose it? Other Windows and Linux applications
do behave as desired, so why shouldn't Qt/X11/Mac applications?

TT has created task #167182, which is a *suggestion* to bring the
old behavior back. So now they deprive us of functionality and
we have to "suggest" that it should be brought back - instead of
handling this as what it is: a *bug*.

"Code less - create more" - funny they don't have that slogan on
their homepage any more...

The attached patch fixes this for me, maybe it's of use
to others, too.

Klaus Schmidinger

# Fix cursor navigation in QTreeView (TT#167182)
# Fix cursor navigation in QTreeView (TT#167182)
--- src/gui/styles/qcleanlooksstyle.cpp.001	2007-05-25 15:30:19.000000000 +0200
+++ src/gui/styles/qcleanlooksstyle.cpp	2007-06-19 11:19:19.196289913 +0200
@@ -4272,7 +4272,7 @@
         break;
 #endif
     case SH_ItemView_ArrowKeysNavigateIntoChildren:
-        ret = false;
+        ret = true;
         break;
     default:
         ret = QWindowsStyle::styleHint(hint, option, widget, returnData);
# Fix cursor navigation in QTreeView (TT#167182)
# Fix cursor navigation in QTreeView (TT#167182)
--- src/gui/styles/qcommonstyle.cpp.001	2007-05-25 15:30:19.000000000 +0200
+++ src/gui/styles/qcommonstyle.cpp	2007-06-19 11:19:29.760683321 +0200
@@ -4273,7 +4273,7 @@
         break;
 #endif
     case SH_ItemView_ArrowKeysNavigateIntoChildren:
-        ret = false;
+        ret = true;
         break;
     default:
         ret = 0;
# Fix cursor navigation in QTreeView (TT#167182)
# Fix cursor navigation in QTreeView (TT#167182)
--- src/gui/styles/qmacstyle_mac.cpp.001	2007-05-25 15:46:33.000000000 +0200
+++ src/gui/styles/qmacstyle_mac.cpp	2007-06-19 11:35:00.920019817 +0200
@@ -2404,7 +2404,7 @@
         ret = QWizard::MacStyle;
         break;
     case SH_ItemView_ArrowKeysNavigateIntoChildren:
-        ret = false;
+        ret = true;
         break;
     default:
         ret = QWindowsStyle::styleHint(sh, opt, w, hret);
# Fix cursor navigation in QTreeView (TT#167182)
# Fix cursor navigation in QTreeView (TT#167182)
--- src/gui/styles/qplastiquestyle.cpp.001	2007-05-25 15:30:19.000000000 +0200
+++ src/gui/styles/qplastiquestyle.cpp	2007-06-19 11:19:47.448319188 +0200
@@ -5431,7 +5431,7 @@
         ret = QCommonStyle::styleHint(hint, option, widget, returnData);
         break;
     case SH_ItemView_ArrowKeysNavigateIntoChildren:
-        ret = false;
+        ret = true;
         break;
     default:
         ret = QWindowsStyle::styleHint(hint, option, widget, returnData);

Message 2 in thread

On 06/19/2007 11:55 AM, Klaus Schmidinger wrote:
> ...
> TT has created task #167182, which is a *suggestion* to bring the
> old behavior back. So now they deprive us of functionality and
> we have to "suggest" that it should be brought back - instead of
> handling this as what it is: a *bug*.

I was just informed that task #167182 has now been changed from
"suggestion" to "bug". Thanks for that.

Klaus Schmidinger

--
 [ signature omitted ] 

Message 3 in thread

On Tuesday 19 June 2007 11:55:50 Klaus Schmidinger wrote:
> Imagine a QTreeWidget with items and child items, like
>
> [-] Level 1
>     [-] Level 2
>         [-] Level 3
>             Item 3.1
>             Item 3.2
>
> and the current item is "Item 3.2".
>
> In Qt 3 the behavior on all platforms when pressing Crsr-Left was that
> the current item would become "Level 3", the next press
> of Crsr-Left would collapse "Level 3", and the next press
> would make "Level 2" current and so on.
>
> In Qt 4 pressing Crsr-Left while "Item 3.2" is current
> does nothing on X11 and Mac.

Not doing anything is the behavior of OS X's Finder and in Gnome's Nautilus.  
In Konqueror 3.x a left key press will move up and the second key press will 
collapse.  While not exactly like windows the plastique style patch could be 
considered valid, but not the rest of them.  I am not sure what the KDE guys 
have planned for KDE4 though.

-Benjamin Meyer




--
 [ signature omitted ]