Commit 2bdabfd8 authored by Laurent Montel's avatar Laurent Montel 😁

Start to implement show warning about nothing found when we filter

result
parent fa55bb9d
......@@ -46,6 +46,8 @@
#include <QScrollBar>
#include <QLineEdit>
#include <QMenu>
#include <QPainter>
#include <KLocalizedString>
#include "messagelist_debug.h"
......@@ -72,7 +74,10 @@ public:
}
void expandFullThread(const QModelIndex &index);
void generalPaletteChanged();
QColor mTextColor;
View *const q;
Widget *mWidget = nullptr;
......@@ -666,6 +671,32 @@ void View::resizeEvent(QResizeEvent *e)
triggerDelayedSaveThemeColumnState();
}
void View::paintEvent(QPaintEvent *event)
{
#if 0
if (/*mFirstResult &&*/ (!model() || model()->rowCount() == 0)) {
QPainter p(viewport());
QFont font = p.font();
font.setItalic(true);
p.setFont(font);
if (!d->mTextColor.isValid()) {
d->generalPaletteChanged();
}
p.setPen(d->mTextColor);
p.drawText(QRect(0, 0, width(), height()), Qt::AlignCenter, i18n("No result found"));
} else {
QTreeView::paintEvent(event);
}
#else
QTreeView::paintEvent(event);
#endif
}
void View::modelAboutToEmitLayoutChanged()
{
// QHeaderView goes totally NUTS with a layoutChanged() call
......@@ -963,6 +994,14 @@ void View::setChildrenExpanded(const Item *root, bool expand)
}
}
void View::Private::generalPaletteChanged()
{
const QPalette palette = q->viewport()->palette();
QColor color = palette.text().color();
color.setAlpha(128);
mTextColor = color;
}
void View::Private::expandFullThread(const QModelIndex &index)
{
if (!index.isValid()) {
......@@ -2724,3 +2763,4 @@ void View::setQuickSearchClickMessage(const QString &msg)
}
#include "moc_view.cpp"
......@@ -413,6 +413,7 @@ protected:
*/
void resizeEvent(QResizeEvent *e) override;
void paintEvent(QPaintEvent *event) override;
/**
* Reimplemented in order to kill the QTreeView column auto-resizing
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment