summaryrefslogtreecommitdiffstats
path: root/application/widgets/VersionListView.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-05-02 23:42:33 +0200
committerPetr Mrázek <peterix@gmail.com>2015-05-02 23:42:33 +0200
commit5779ffd6645ba3fae5abe068d456fc1ee9dd91ff (patch)
treebe5d81b6132b63db368e7061d766f70250fa222c /application/widgets/VersionListView.cpp
parent4fc4a172562a76091721b8c488aafbd6ed2b01ed (diff)
downloadMultiMC-5779ffd6645ba3fae5abe068d456fc1ee9dd91ff.tar
MultiMC-5779ffd6645ba3fae5abe068d456fc1ee9dd91ff.tar.gz
MultiMC-5779ffd6645ba3fae5abe068d456fc1ee9dd91ff.tar.lz
MultiMC-5779ffd6645ba3fae5abe068d456fc1ee9dd91ff.tar.xz
MultiMC-5779ffd6645ba3fae5abe068d456fc1ee9dd91ff.zip
GH-922 improve version select dialogs
Diffstat (limited to 'application/widgets/VersionListView.cpp')
-rw-r--r--application/widgets/VersionListView.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/application/widgets/VersionListView.cpp b/application/widgets/VersionListView.cpp
index fc0bcd0a..1e327534 100644
--- a/application/widgets/VersionListView.cpp
+++ b/application/widgets/VersionListView.cpp
@@ -65,6 +65,23 @@ void VersionListView::reset()
void VersionListView::setEmptyString(QString emptyString)
{
m_emptyString = emptyString;
+ updateEmptyViewPort();
+}
+
+void VersionListView::setEmptyErrorString(QString emptyErrorString)
+{
+ m_emptyErrorString = emptyErrorString;
+ updateEmptyViewPort();
+}
+
+void VersionListView::setEmptyMode(VersionListView::EmptyMode mode)
+{
+ m_emptyMode = mode;
+ updateEmptyViewPort();
+}
+
+void VersionListView::updateEmptyViewPort()
+{
if(!m_itemCount)
{
viewport()->update();
@@ -85,6 +102,18 @@ void VersionListView::paintEvent(QPaintEvent *event)
void VersionListView::paintInfoLabel(QPaintEvent *event)
{
+ QString emptyString;
+ switch(m_emptyMode)
+ {
+ case VersionListView::Empty:
+ return;
+ case VersionListView::String:
+ emptyString = m_emptyString;
+ break;
+ case VersionListView::ErrorString:
+ emptyString = m_emptyErrorString;
+ break;
+ }
//calculate the rect for the overlay
QPainter painter(viewport());
painter.setRenderHint(QPainter::Antialiasing, true);
@@ -93,7 +122,7 @@ void VersionListView::paintInfoLabel(QPaintEvent *event)
QRect bounds = viewport()->geometry();
bounds.moveTop(0);
- QTextLayout layout(m_emptyString, font);
+ QTextLayout layout(emptyString, font);
qreal height = 0.0;
qreal widthUsed = 0.0;
QStringList lines = viewItemTextLayout(layout, bounds.width() - 20, height, widthUsed);