From 281826f713d9a373c71cf01fb365c045c1555fe6 Mon Sep 17 00:00:00 2001 From: robotbrainify Date: Sat, 12 Oct 2013 09:19:49 -0400 Subject: [PATCH] switch from tooltip to messagebox --- gui/MCModInfoFrame.cpp | 15 ++++++++++++--- gui/MCModInfoFrame.h | 5 ++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gui/MCModInfoFrame.cpp b/gui/MCModInfoFrame.cpp index a45e30ea..4a78d329 100644 --- a/gui/MCModInfoFrame.cpp +++ b/gui/MCModInfoFrame.cpp @@ -15,6 +15,8 @@ #include "MCModInfoFrame.h" #include "ui_MCModInfoFrame.h" +#include +#include void MCModInfoFrame::updateWithMod(Mod &m) { if(m.type() == m.MOD_FOLDER) @@ -85,10 +87,11 @@ void MCModInfoFrame::setModDescription(QString text) } QString labeltext; labeltext.reserve(300); - if(finaltext.length() > 297) + if(finaltext.length() > 290) { - labeltext.append(finaltext.left(287) + "..."); - ui->label_ModDescription->setToolTip(text.replace('\n', "
")); + ui->label_ModDescription->setOpenExternalLinks(false); + labeltext.append(finaltext.left(287) + "..."); + QObject::connect(ui->label_ModDescription, &QLabel::linkActivated, this, &MCModInfoFrame::modDescEllipsisHandler); } else { @@ -96,3 +99,9 @@ void MCModInfoFrame::setModDescription(QString text) } ui->label_ModDescription->setText(labeltext); } +void MCModInfoFrame::modDescEllipsisHandler(const QString &link) +{ + QMessageBox msgbox; + msgbox.setDetailedText(desc); + msgbox.exec(); +} diff --git a/gui/MCModInfoFrame.h b/gui/MCModInfoFrame.h index bc10ae6a..9064fea7 100644 --- a/gui/MCModInfoFrame.h +++ b/gui/MCModInfoFrame.h @@ -17,7 +17,6 @@ #include #include "logic/Mod.h" -#include namespace Ui { @@ -38,6 +37,10 @@ public: void updateWithMod(Mod &m); void clear(); +public slots: + void modDescEllipsisHandler(const QString& link ); + private: Ui::MCModInfoFrame *ui; + QString desc; };