<table><tr><td style="">amhndu 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/D16484">View Revision</a></tr></table><br /><div><div><p>Would something like this be worth adding ?</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="diff" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">cpp
<span style="color: #000080">index 5c193432c9..1b5fb57352 100644</span>
<span style="color: #a00000">--- a/plugins/scratchpad/scratchpadview.cpp</span>
<span style="color: #00a000">+++ b/plugins/scratchpad/scratchpadview.cpp</span>
<span style="color: #800080">@@ -37,6 +37,7 @@</span>
 #include <QWidgetAction>
 #include <QLineEdit>
 #include <QInputDialog>
<span style="color: #00a000">+#include <QPainter></span>
 
 // Use a delegate because the dataChanged signal doesn't tell us the previous name
 class FileRenameDelegate
<span style="color: #800080">@@ -61,6 +62,31 @@ private:</span>
     Scratchpad* m_scratchpad;
 };
 
<span style="color: #00a000">+// subclass to show a message when the list is empty</span>
<span style="color: #00a000">+EmptyMessageListView::EmptyMessageListView(QWidget* parent)</span>
<span style="color: #00a000">+    : QListView(parent)</span>
<span style="color: #00a000">+{</span>
<span style="color: #00a000">+}</span>
<span style="color: #00a000">+</span>
<span style="color: #00a000">+void EmptyMessageListView::paintEvent(QPaintEvent* event)</span>
<span style="color: #00a000">+{</span>
<span style="color: #00a000">+    if (model() && model()->rowCount(rootIndex()) > 0) {</span>
<span style="color: #00a000">+        QListView::paintEvent(event);</span>
<span style="color: #00a000">+    } else {</span>
<span style="color: #00a000">+        QPainter painter(viewport());</span>
<span style="color: #00a000">+        const auto margin =</span>
<span style="color: #00a000">+            QMargins(parentWidget()->style()->pixelMetric(QStyle::PM_LayoutLeftMargin), 0,</span>
<span style="color: #00a000">+                     parentWidget()->style()->pixelMetric(QStyle::PM_LayoutRightMargin), 0);</span>
<span style="color: #00a000">+        painter.drawText(rect() - margin, Qt::AlignCenter | Qt::TextWordWrap, m_message);</span>
<span style="color: #00a000">+    }</span>
<span style="color: #00a000">+}</span>
<span style="color: #00a000">+</span>
<span style="color: #00a000">+void EmptyMessageListView::setEmptyMessage(const QString& message)</span>
<span style="color: #00a000">+{</span>
<span style="color: #00a000">+    m_message = message;</span>
<span style="color: #00a000">+}</span>
<span style="color: #00a000">+</span>
<span style="color: #00a000">+</span>
 ScratchpadView::ScratchpadView(QWidget* parent, Scratchpad* scratchpad)
     : QWidget(parent)
     , m_scratchpad(scratchpad)
<span style="color: #800080">@@ -82,6 +108,7 @@ ScratchpadView::ScratchpadView(QWidget* parent, Scratchpad* scratchpad)</span>
 
     scratchTree->setModel(modelProxy);
     scratchTree->setItemDelegate(new FileRenameDelegate(this, m_scratchpad));
<span style="color: #00a000">+    scratchTree->setEmptyMessage(i18n("Scratchpad lets you quickly run and experiment with code without a full project. Create a new scratch to start."));</span>
 
     connect(scratchTree, &QListView::activated, this, &ScratchpadView::scratchActivated);
 
<span style="color: #000080">diff --git a/plugins/scratchpad/scratchpadview.ui b/plugins/scratchpad/scratchpadview.ui</span>
<span style="color: #000080">index 31a144a8f7..5a19cffcfd 100644</span>
<span style="color: #a00000">--- a/plugins/scratchpad/scratchpadview.ui</span>
<span style="color: #00a000">+++ b/plugins/scratchpad/scratchpadview.ui</span>
<span style="color: #800080">@@ -28,7 +28,7 @@</span>
     <number>0</number>
    </property>
    <item>
<span style="color: #a00000">-    <widget class="QListView" name="scratchTree"/></span>
<span style="color: #00a000">+    <widget class="EmptyMessageListView" name="scratchTree"/></span>
    </item>
    <item>
     <layout class="QHBoxLayout" name="horizontalLayout_2">
<span style="color: #800080">@@ -39,6 +39,13 @@</span>
    </item>
   </layout>
  </widget>
<span style="color: #00a000">+ <customwidgets></span>
<span style="color: #00a000">+  <customwidget></span>
<span style="color: #00a000">+   <class>EmptyMessageListView</class></span>
<span style="color: #00a000">+   <extends>QListView</extends></span>
<span style="color: #00a000">+   <header>emptymessagelistview.h</header></span>
<span style="color: #00a000">+  </customwidget></span>
<span style="color: #00a000">+ </customwidgets></span>
  <tabstops>
   <tabstop>scratchTree</tabstop>
  </tabstops></pre></div>

<p><a href="https://phabricator.kde.org/F6376866" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">F6376866: image.png</a></p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D16484">https://phabricator.kde.org/D16484</a></div></div><br /><div><strong>To: </strong>amhndu<br /><strong>Cc: </strong>brauch, kdevelop-devel, glebaccon, antismap, iodelay, vbspam, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd<br /></div>