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

List:       kde-panel-devel
Subject:    D7087: Add "Copy Info" button to the About System KCM
From:       Henrik Fehlauer <noreply () phabricator ! kde ! org>
Date:       2018-06-30 21:50:21
Message-ID: ee6fa98d032d23367a6b8fa942c9933e () localhost ! localdomain
[Download RAW message or body]

[Attachment #2 (text/plain)]

rkflx added a comment.


  In D7087#284846 <https://phabricator.kde.org/D7087#284846>, @gregormi wrote:
  
  > I fixed the layout and it looks now like this in Qt Designer
  
  
  Awesome, I guess you got the overall gist ;)
  
  > The blue arrow shows a difference to your proposal. Do you think the grid layout \
there is ok?  
  I probably used a vertical layout for this (IIRC), which should work the same but \
is a bit simpler. Same thing for the purely horizontal layout at the bottom, where \
you also used a grid. Again, this does not really matter that much.  
  Nevertheless, somehow there seems to be a glitch near `KernelName`, so the values \
for both kernel and architecture are displaced a bit to the bottom. When I break the \
layout and then redo it, it works fine for me. Not sure how you got into that \
situation ;) Let me know if I should upload my version if you cannot get it fixed \
with your Qt Designer.  
  ---
  
  In D7087#284855 <https://phabricator.kde.org/D7087#284855>, @gregormi wrote:
  
  > I added some qDebug code in Module::copyToClipboard()
  >  […]
  >  Any idea why the slot method is called twice?
  
  
  `Module::load()` is called twice (see comment in constructor or D2300 \
<https://phabricator.kde.org/D2300>), so you have two connections. In general you \
could use a `Qt::UniqueConnection` in your `connect` to avoid this, but I think here \
it's actually better to move your setup code (i.e. everything except for \
`labelsForClipboard.clear()`) to the constructor instead.

INLINE COMMENTS

> Module.cpp:161
> 
> +    auto dummyDistroDescriptionLabel = new QLabel(i18nc("@title:row", "Distro:"), \
> this); +    labelsForClipboard << qMakePair(dummyDistroDescriptionLabel, \
> ui->nameVersionLabel);

You could add a `const`.

> Module.cpp:263
> +    // note that this loop does not necessarily represent the same order as in the \
> GUI +    for (auto p : qAsConst(labelsForClipboard)) {
> +        auto descriptionLabelText = p.first->text();

Coming back to this after a month, I now wonder what `p` stands for, which might \
indicate that variable could get a better name…

> gregormi wrote in Module.cpp:260
> Good idea. DONE.

I'm afraid you missed the "hidden" part, so it shows up right in front of the distro \
logo ;)

Adding

  dummyDistroDescriptionLabel->hide();

where you are creating the label solves the issue for me.

REPOSITORY
  R102 KInfoCenter

REVISION DETAIL
  https://phabricator.kde.org/D7087

To: gregormi, ngraham, dhaumann, rkflx
Cc: rkflx, dhaumann, ltoscano, sebas, elvisangelaccio, cfeck, plasma-devel, ragreen, \
Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, apol, mart


[Attachment #3 (text/html)]

<table><tr><td style="">rkflx added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: \
right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: \
#F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: \
inline-block; border: 1px solid rgba(71,87,120,.2);" \
href="https://phabricator.kde.org/D7087">View Revision</a></tr></table><br \
/><div><div><blockquote style="border-left: 3px solid #8C98B8;  color: #6B748C;
          font-style: italic;
          margin: 4px 0 12px 0;
          padding: 8px 12px;
          background-color: #F8F9FC;">
<div style="font-style: normal;
          padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D7087#284846" \
style="background-color: #e7e7e7;  border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">D7087#284846</a>, <a \
href="https://phabricator.kde.org/p/gregormi/" style="  border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;">@gregormi</a> wrote:</div>
<div style="margin: 0;
          padding: 0;
          border: 0;
          color: rgb(107, 116, 140);"><p>I fixed the layout and it looks now like \
this in Qt Designer</p></div> </blockquote>

<p>Awesome, I guess you got the overall gist ;)</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: \
italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>The \
blue arrow shows a difference to your proposal. Do you think the grid layout there is \
ok?</p></blockquote>

<p>I probably used a vertical layout for this (IIRC), which should work the same but \
is a bit simpler. Same thing for the purely horizontal layout at the bottom, where \
you also used a grid. Again, this does not really matter that much.</p>

<p>Nevertheless, somehow there seems to be a glitch near <tt style="background: \
#ebebeb; font-size: 13px;">KernelName</tt>, so the values for both kernel and \
architecture are displaced a bit to the bottom. When I break the layout and then redo \
it, it works fine for me. Not sure how you got into that situation ;) Let me know if \
I should upload my version if you cannot get it fixed with your Qt Designer.</p>

<hr class="remarkup-hr" />

<blockquote style="border-left: 3px solid #8C98B8;
          color: #6B748C;
          font-style: italic;
          margin: 4px 0 12px 0;
          padding: 8px 12px;
          background-color: #F8F9FC;">
<div style="font-style: normal;
          padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D7087#284855" \
style="background-color: #e7e7e7;  border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">D7087#284855</a>, <a \
href="https://phabricator.kde.org/p/gregormi/" style="  border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;">@gregormi</a> wrote:</div>
<div style="margin: 0;
          padding: 0;
          border: 0;
          color: rgb(107, 116, 140);"><p>I added some qDebug code in \
Module::copyToClipboard()<br />  […]<br />
 Any idea why the slot method is called twice?</p></div>
</blockquote>

<p><tt style="background: #ebebeb; font-size: 13px;">Module::load()</tt> is called \
twice (see comment in constructor or <a href="https://phabricator.kde.org/D2300" \
style="background-color: #e7e7e7;  border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: line-through;">D2300</a>), so you have two \
connections. In general you could use a <tt style="background: #ebebeb; font-size: \
13px;">Qt::UniqueConnection</tt> in your <tt style="background: #ebebeb; font-size: \
13px;">connect</tt> to avoid this, but I think here it&#039;s actually better to move \
your setup code (i.e. everything except for <tt style="background: #ebebeb; \
font-size: 13px;">labelsForClipboard.clear()</tt>) to the constructor \
instead.</p></div></div><br /><div><strong>INLINE COMMENTS</strong><div><div \
style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: \
3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; \
border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; \
background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; \
text-decoration: none;" href="https://phabricator.kde.org/D7087#inline-72732">View \
Inline</a><span style="color: #4b4d51; font-weight: \
bold;">Module.cpp:161</span></div> <div style="font: 11px/15px &quot;Menlo&quot;, \
&quot;Consolas&quot;, &quot;Monaco&quot;, monospace; white-space: pre-wrap; clear: \
both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; \
background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">auto</span> \
<span class="n">dummyDistroDescriptionLabel</span> <span style="color: \
#aa2211">=</span> <span style="color: #aa4000">new</span> <span \
class="n">QLabel</span><span class="p">(</span><span class="n">i18nc</span><span \
class="p">(</span><span style="color: #766510">&quot;@title:row&quot;</span><span \
class="p">,</span> <span style="color: #766510">&quot;Distro:&quot;</span><span \
class="p">),</span> <span style="color: #aa4000">this</span><span class="p">);</span> \
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, \
.6);">    <span class="n">labelsForClipboard</span> <span style="color: \
#aa2211">&lt;&lt;</span> <span class="n">qMakePair</span><span \
class="p">(</span><span class="n">dummyDistroDescriptionLabel</span><span \
class="p">,</span> <span class="n">ui</span><span style="color: \
#aa2211">-&gt;</span><span class="n">nameVersionLabel</span><span class="p">);</span> \
</div></div></div> <div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; \
margin: 8px;">You could add a <tt style="background: #ebebeb; font-size: \
13px;">const</tt>.</p></div></div><br /><div style="border: 1px solid #C7CCD9; \
border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: \
#e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: \
#74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: \
right; text-decoration: none;" \
href="https://phabricator.kde.org/D7087#inline-72720">View Inline</a><span \
style="color: #4b4d51; font-weight: bold;">Module.cpp:263</span></div> <div \
style="font: 11px/15px &quot;Menlo&quot;, &quot;Consolas&quot;, &quot;Monaco&quot;, \
monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div \
style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span \
style="color: #74777d">// note that this loop does not necessarily represent the same \
order as in the GUI</span> </div><div style="padding: 0 8px; margin: 0 4px; \
background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">for</span> \
<span class="p">(</span><span style="color: #aa4000">auto</span> <span style="color: \
#a0a000">p</span> <span class="p">:</span> <span class="n">qAsConst</span><span \
class="p">(</span><span class="n">labelsForClipboard</span><span class="p">))</span> \
<span class="p">{</span> </div><div style="padding: 0 8px; margin: 0 4px; background: \
rgba(151, 234, 151, .6);">        <span style="color: #aa4000">auto</span> <span \
class="n">descriptionLabelText</span> <span style="color: #aa2211">=</span> <span \
class="n">p</span><span class="p">.</span><span class="n">first</span><span \
style="color: #aa2211">-&gt;</span><span class="n">text</span><span \
class="p">();</span> </div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: \
8px;">Coming back to this after a month, I now wonder what <tt style="background: \
#ebebeb; font-size: 13px;">p</tt> stands for, which might indicate that variable \
could get a better name…</p></div></div><br /><div style="border: 1px solid \
#C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; \
border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div \
style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a \
style="float: right; text-decoration: none;" \
href="https://phabricator.kde.org/D7087#inline-72603">View Inline</a><span \
style="color: #4b4d51; font-weight: bold;">gregormi</span> wrote in <span \
style="color: #4b4d51; font-weight: bold;">Module.cpp:260</span></div> <div \
style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: \
8px;">Good idea. DONE.</p></div></div> <div style="margin: 8px 0; padding: 0 \
12px;"><p style="padding: 0; margin: 8px;">I&#039;m afraid you missed the \
&quot;hidden&quot; part, so it shows up right in front of the distro logo ;)</p>

<p style="padding: 0; margin: 8px;">Adding</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" \
data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px \
&quot;Menlo&quot;, &quot;Consolas&quot;, &quot;Monaco&quot;, monospace; padding: \
12px; margin: 0; background: rgba(71, 87, 120, \
0.08);">dummyDistroDescriptionLabel-&gt;hide();</pre></div>

<p style="padding: 0; margin: 8px;">where you are creating the label solves the issue \
for me.</p></div></div></div></div></div><br \
/><div><strong>REPOSITORY</strong><div><div>R102 KInfoCenter</div></div></div><br \
/><div><strong>REVISION DETAIL</strong><div><a \
href="https://phabricator.kde.org/D7087">https://phabricator.kde.org/D7087</a></div></div><br \
/><div><strong>To: </strong>gregormi, ngraham, dhaumann, rkflx<br /><strong>Cc: \
</strong>rkflx, dhaumann, ltoscano, sebas, elvisangelaccio, cfeck, plasma-devel, \
ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, apol, \
mart<br /></div>



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

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