summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-09-22 21:08:57 (GMT)
committerTobias Markmann <tm@ayena.de>2016-11-04 13:30:54 (GMT)
commit97565d022303f3a4554de2c4de82ca12929dc715 (patch)
treec584f81eeda0ff9a446fbbf3f93750d6d9792b44 /Swift
parentd6790e8e10a37e066718140cbec9190fee54f730 (diff)
downloadswift-97565d022303f3a4554de2c4de82ca12929dc715.zip
swift-97565d022303f3a4554de2c4de82ca12929dc715.tar.bz2
Provide explanation for empty trellis cells to user
This shows a short descriptive text in empty trellis cells, that describes the current state to the user and suggests actions on how to get rid of the empty trellis cell, e.g. by changing the layout or moving chats to the empty cells. Test-Information: Tested with Qt 5.5.1 on macOS 10.12. Change-Id: Ibc7d3a327cf32b8a21304b37e79534773b5d3761
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/QtTabWidget.cpp17
-rw-r--r--Swift/QtUI/QtTabWidget.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/Swift/QtUI/QtTabWidget.cpp b/Swift/QtUI/QtTabWidget.cpp
index cda1847..67e3ae9 100644
--- a/Swift/QtUI/QtTabWidget.cpp
+++ b/Swift/QtUI/QtTabWidget.cpp
@@ -6,6 +6,10 @@
#include <Swift/QtUI/QtTabWidget.h>
+#include <QLabel>
+#include <QPainter>
+#include <QPoint>
+
#include <Swift/QtUI/Trellis/QtDNDTabBar.h>
namespace Swift {
@@ -46,4 +50,17 @@ void QtTabWidget::dropEvent(QDropEvent* event) {
}
}
+void QtTabWidget::paintEvent(QPaintEvent * event) {
+ QTabWidget::paintEvent(event);
+ if (count() == 0) {
+ QLabel label;
+ label.setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
+ label.setGeometry(QRect(QPoint(0,0), size()) - QMargins(10,10,10,10));
+ label.setWordWrap(true);
+ label.setText(tr("This empty cell is a placeholder for chat windows. You can move existing chats to this cell by dragging the tab over here. You can change the number of cells via the 'Change layout' dialog under the 'View' menu or by using the %1 shortcut.").arg(QKeySequence(tr("Ctrl+Alt+L")).toString(QKeySequence::NativeText)));
+ QPainter painter(this);
+ painter.drawPixmap(label.geometry().topLeft(), label.grab());
+ }
+}
+
}
diff --git a/Swift/QtUI/QtTabWidget.h b/Swift/QtUI/QtTabWidget.h
index a9d0df8..f19721d 100644
--- a/Swift/QtUI/QtTabWidget.h
+++ b/Swift/QtUI/QtTabWidget.h
@@ -21,5 +21,6 @@ namespace Swift {
protected:
virtual void dragEnterEvent(QDragEnterEvent* event);
virtual void dropEvent(QDropEvent* event);
+ virtual void paintEvent(QPaintEvent* event);
};
}