[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-usability
Subject:    Re: [KDE Usability] Review Request 127054: Add a Filter Toolbar Button for Dolphin
From:       Thomas_Lübking <thomas.luebking () gmail ! com>
Date:       2016-03-18 16:06:09
Message-ID: 20160318160609.30507.89326 () mimi ! kde ! org
[Download RAW message or body]

--===============8719791862372133724==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit



> On März 16, 2016, 7:07 nachm., Emmanuel Pescosta wrote:
> > dolphinmainwindow.cpp, line 1104
> > <https://git.reviewboard.kde.org/r/127054/diff/9/?file=453363#file453363line1104>
> > 
> > This solution has some disadvantages, especially that it's not possible to change \
> > the filter bar shortcut anymore. 
> > A better solution would be to install an event filter [1] on the showFilterBar \
> > action. The event filter can then catch the shortcut event [2] and handle it if \
> > needed (see the KeyPressEater example in [1] how this can be done). 
> > [1] https://doc.qt.io/qt-5/qobject.html#installEventFilter
> > [2] https://doc.qt.io/qt-5/qshortcutevent.html
> 
> arnav dhamija wrote:
> Cool solution! But I'm having trouble with implementing \
> DolphinMainWindow::eventFilter(). The action which I am targetting is \
> showFilterBar, but that is only available in the DolphinMainWindow::setupActions() \
> function. Therefore, I cannot pass the QAction to the eventFilter() function. 
> For example:
> 
> bool DolphinMainWindow::eventFilter(QObject *obj, QEvent *event)
> {
> if (obj == ???) { //How should I pass showFilterBar? Should obj==QAction? Shuld I \
> create a new class for the filter barand then check the object? if (event->type() \
>                 == QEvent::Shortcut) {1
> ... 
> //use the toggleFocus function and check for the precise shortcut
> return true;
> } else {
> return false;
> }
> }
> 
> Emmanuel Pescosta wrote:
> > Shuld I create a new class for the filter barand then check the object?
> 
> Yep, please create a new class for the event filter. We can then use the same event \
> filter for the find action ;) 
> Thomas Lübking wrote:
> I didn't actually try, but the shortcut event should be on every widget, ie. you \
> won't require a filter but can just override ::event(QEvent *e) function of any \
> widget in the window. 
> You can make showFilterBar a member pointer or look up the action in the dict (but \
> that's rather overheadish...) 
> arnav dhamija wrote:
> That should take care of it, but I cannot figure out how to get around the fact \
> that  
> bool DolphinMainWindow::eventFilter(QObject *obj, QEvent *event)
> 
> ...would need a QObject while I'm testing for a showFilterBar which is a QAction. \
> How can I get around this problem? 
> arnav dhamija wrote:
> Overloading the eventFilter function with different function arguements doesn't \
> seem to work either and causes a lot of compilation problems. 
> arnav dhamija wrote:
> I have figured out how to setup the eventFilter now and hence my previous question \
> is no longer valid :) But, I see the problem is that now the QAction is no longer \
> activatable by a shortcut when I use showFilterBar->installEventFilter(this) \
> although my eventFilter works fine otherwise. Something seems to break shortcuts \
> from working when I do this. 
> Emmanuel Pescosta wrote:
> We can help you if you upload your latest patch ;)

The shortcut event *should* be delivered to every object (or at least widget) in that \
window - that's why you likely can omit the filter and just re-implement the \
::event() function of the window.


- Thomas


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127054/#review93616
-----------------------------------------------------------


On März 16, 2016, 4:53 nachm., arnav dhamija wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/127054/
> -----------------------------------------------------------
> 
> (Updated März 16, 2016, 4:53 nachm.)
> 
> 
> Review request for Dolphin, KDE Usability and Emmanuel Pescosta.
> 
> 
> Repository: dolphin
> 
> 
> Description
> -------
> 
> This patch was created to implement the feature suggested here: \
> [https://todo.kde.org/?controller=task&action=show&task_id=966](https://todo.kde.org/?controller=task&action=show&task_id=966)
>  
> This patch adds a Filter Button to the toolbar of Dolphin. This button can be \
> toggled to show/hide the Filter Bar. 
> In this patch, one might notice that there is now show_filter_bar and \
> show_filter_bar_button in dolphinui.rc file. This was done because I found that \
> using the same action for the menu entry and the toolbar entry would cause \
> something to break (eg, shortcuts would stop working).  
> A screenshot of the toolbar is also attached.
> 
> 
> Diffs
> -----
> 
> dolphinmainwindow.h 7003e94 
> dolphinmainwindow.cpp f7a7613 
> dolphinviewcontainer.h 62f9110 
> dolphinviewcontainer.cpp 8fea3ba 
> 
> Diff: https://git.reviewboard.kde.org/r/127054/diff/
> 
> 
> Testing
> -------
> 
> manual
> 
> 
> File Attachments
> ----------------
> 
> dolphintoolbar.png
> https://git.reviewboard.kde.org/media/uploaded/files/2016/02/12/d936e5d0-557c-45c5-9a2d-f849e5d284a6__dolphintoolbar.png
>  patch.txt
> https://git.reviewboard.kde.org/media/uploaded/files/2016/03/16/1eb43168-65dd-410b-a74b-f895f3035c83__patch.txt
>  
> 
> Thanks,
> 
> arnav dhamija
> 
> 


--===============8719791862372133724==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit




<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 \
solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">  \
<tr>  <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/127054/">https://git.reviewboard.kde.org/r/127054/</a>
  </td>
    </tr>
   </table>
   <br />










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On März 16th, 2016, 7:07 nachm. UTC, <b>Emmanuel \
Pescosta</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  


<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/127054/diff/9/?file=453363#file453363line1104" \
style="color: black; font-weight: bold; text-decoration: \
underline;">dolphinmainwindow.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 9)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">1095</font></th>  <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="n">connect</span><span class="p">(</span><span \
class="n">showFilterBar</span><span class="p">,</span> <span \
class="o">&amp;</span><span class="n">QAction</span><span class="o">::</span><span \
class="n">triggered</span><span class="p">,</span> <span class="k">this</span><span \
class="p">,</span> <span class="o">&amp;</span><span \
class="n">DolphinMainWindow</span><span class="o">::</span><span \
class="n">showFilterBar</span><span class="p">);</span></pre></td>  <th \
bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">1098</font></th>  <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="n">QShortcut</span> <span class="o">*</span><span \
class="n">filterBarShortcut</span> <span class="o">=</span> <span \
class="k">new</span> <span class="n">QShortcut</span><span class="p">(</span><span \
class="n">QKeySequence</span><span class="p">(</span> <span class="n">Qt</span><span \
class="o">::</span><span class="n">CTRL</span> <span class="o">+</span> <span \
class="n">Qt</span><span class="o">::</span><span class="n">Key_I</span><span \
class="p">),</span> <span class="k">this</span><span class="p">);</span></pre></td>  \
</tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This solution has some \
disadvantages, especially that it&#39;s not possible to change the filter bar \
shortcut anymore.

A better solution would be to install an event filter [1] on the showFilterBar \
action. The event filter can then catch the shortcut event [2] and handle it if \
needed (see the KeyPressEater example in [1] how this can be done).

[1] https://doc.qt.io/qt-5/qobject.html#installEventFilter
[2] https://doc.qt.io/qt-5/qshortcutevent.html</pre>
 </blockquote>



 <p>On März 17th, 2016, 11:34 vorm. UTC, <b>arnav dhamija</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Cool \
solution! But I'm having trouble with implementing DolphinMainWindow::eventFilter(). \
The action which I am targetting is showFilterBar, but that is only available in the \
DolphinMainWindow::setupActions() function. Therefore, I cannot pass the QAction to \
the eventFilter() function.</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">For example:</p> <p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">bool \
DolphinMainWindow::eventFilter(QObject <em style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: normal;">obj, QEvent </em>event) \
{  if (obj == ???) { //How should I pass showFilterBar? Should obj==QAction? Shuld I \
create a new class for the filter barand then check the object?  if (event-&gt;type() \
                == QEvent::Shortcut) {1
        ... 
        //use the toggleFocus function and check for the precise shortcut
           return true;
        } else {
           return false;
      }
}</p></pre>
 </blockquote>





 <p>On März 17th, 2016, 5:26 nachm. UTC, <b>Emmanuel Pescosta</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">&gt; Shuld I create a \
new class for the filter barand then check the object?

Yep, please create a new class for the event filter. We can then use the same event \
filter for the find action ;)</pre>  </blockquote>





 <p>On März 17th, 2016, 5:34 nachm. UTC, <b>Thomas Lübking</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I didn&#39;t actually \
try, but the shortcut event should be on every widget, ie. you won&#39;t require a \
filter but can just override ::event(QEvent *e) function of any widget in the window.

You can make showFilterBar a member pointer or look up the action in the dict (but \
that&#39;s rather overheadish...)</pre>  </blockquote>





 <p>On März 18th, 2016, 2:11 nachm. UTC, <b>arnav dhamija</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">That \
should take care of it, but I cannot figure out how to get around the fact that </p> \
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">bool DolphinMainWindow::eventFilter(QObject <em \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
normal;">obj, QEvent </em>event)</p> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">...would need a QObject \
while I'm testing for a showFilterBar which is a QAction. How can I get around this \
problem?</p></pre>  </blockquote>





 <p>On März 18th, 2016, 2:13 nachm. UTC, <b>arnav dhamija</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">Overloading the eventFilter function with different function arguements \
doesn't seem to work either and causes a lot of compilation problems.</p></pre>  \
</blockquote>





 <p>On März 18th, 2016, 2:47 nachm. UTC, <b>arnav dhamija</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I \
have figured out how to setup the eventFilter now and hence my previous question is \
no longer valid :) But, I see the problem is that now the QAction is no longer \
activatable by a shortcut when I use showFilterBar-&gt;installEventFilter(this) \
although my eventFilter works fine otherwise. Something seems to break shortcuts from \
working when I do this.</p></pre>  </blockquote>





 <p>On März 18th, 2016, 2:54 nachm. UTC, <b>Emmanuel Pescosta</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">We can help you if you \
upload your latest patch ;)</pre>  </blockquote>







</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">The shortcut event <em style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: normal;">should</em> be delivered to every object \
(or at least widget) in that window - that's why you likely can omit the filter and \
just re-implement the ::event() function of the window.</p></pre> <br />




<p>- Thomas</p>


<br />
<p>On März 16th, 2016, 4:53 nachm. UTC, arnav dhamija wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: \
1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; \
-webkit-border-radius: 6px;">  <tr>
  <td>

<div>Review request for Dolphin, KDE Usability and Emmanuel Pescosta.</div>
<div>By arnav dhamija.</div>


<p style="color: grey;"><i>Updated März 16, 2016, 4:53 nachm.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
dolphin
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">This patch was created to implement the feature \
suggested here: <a href="https://todo.kde.org/?controller=task&amp;action=show&amp;task_id=966" \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
normal;">https://todo.kde.org/?controller=task&amp;action=show&amp;task_id=966</a></p>
 <p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">This patch adds a Filter Button to the toolbar of \
Dolphin. This button can be toggled to show/hide the Filter Bar.</p> <p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">In this patch, one might notice that there is now show_filter_bar and \
show_filter_bar_button in dolphinui.rc file. This was done because I found that using \
the same action for the menu entry and the toolbar entry would cause something to \
break (eg, shortcuts would stop working). </p> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">A screenshot of the \
toolbar is also attached.</p></pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">manual</p></pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>dolphinmainwindow.h <span style="color: grey">(7003e94)</span></li>

 <li>dolphinmainwindow.cpp <span style="color: grey">(f7a7613)</span></li>

 <li>dolphinviewcontainer.h <span style="color: grey">(62f9110)</span></li>

 <li>dolphinviewcontainer.cpp <span style="color: grey">(8fea3ba)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/127054/diff/" style="margin-left: \
3em;">View Diff</a></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">File Attachments \
</h1>


 <li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2016/02/12/d936e5d0-557c-45c5-9a2d-f849e5d284a6__dolphintoolbar.png">dolphintoolbar.png</a></li>


 <li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2016/03/16/1eb43168-65dd-410b-a74b-f895f3035c83__patch.txt">patch.txt</a></li>


</ul>




  </td>
 </tr>
</table>







  </div>
 </body>
</html>


--===============8719791862372133724==--


[Attachment #3 (text/plain)]

_______________________________________________
kde-usability mailing list
kde-usability@kde.org
https://mail.kde.org/mailman/listinfo/kde-usability


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic