switch from tooltip to messagebox

This commit is contained in:
robotbrainify 2013-10-12 09:19:49 -04:00
parent 71948073e9
commit 281826f713
2 changed files with 16 additions and 4 deletions

View File

@ -15,6 +15,8 @@
#include "MCModInfoFrame.h" #include "MCModInfoFrame.h"
#include "ui_MCModInfoFrame.h" #include "ui_MCModInfoFrame.h"
#include <QMessageBox>
#include <QtGui>
void MCModInfoFrame::updateWithMod(Mod &m) void MCModInfoFrame::updateWithMod(Mod &m)
{ {
if(m.type() == m.MOD_FOLDER) if(m.type() == m.MOD_FOLDER)
@ -85,10 +87,11 @@ void MCModInfoFrame::setModDescription(QString text)
} }
QString labeltext; QString labeltext;
labeltext.reserve(300); labeltext.reserve(300);
if(finaltext.length() > 297) if(finaltext.length() > 290)
{ {
labeltext.append(finaltext.left(287) + "..."); ui->label_ModDescription->setOpenExternalLinks(false);
ui->label_ModDescription->setToolTip(text.replace('\n', "<br/>")); labeltext.append(finaltext.left(287) + "<a href=\"\">...</a>");
QObject::connect(ui->label_ModDescription, &QLabel::linkActivated, this, &MCModInfoFrame::modDescEllipsisHandler);
} }
else else
{ {
@ -96,3 +99,9 @@ void MCModInfoFrame::setModDescription(QString text)
} }
ui->label_ModDescription->setText(labeltext); ui->label_ModDescription->setText(labeltext);
} }
void MCModInfoFrame::modDescEllipsisHandler(const QString &link)
{
QMessageBox msgbox;
msgbox.setDetailedText(desc);
msgbox.exec();
}

View File

@ -17,7 +17,6 @@
#include <QFrame> #include <QFrame>
#include "logic/Mod.h" #include "logic/Mod.h"
#include <stdio.h>
namespace Ui namespace Ui
{ {
@ -38,6 +37,10 @@ public:
void updateWithMod(Mod &m); void updateWithMod(Mod &m);
void clear(); void clear();
public slots:
void modDescEllipsisHandler(const QString& link );
private: private:
Ui::MCModInfoFrame *ui; Ui::MCModInfoFrame *ui;
QString desc;
}; };