Skip to content

Commit

Permalink
Show the link url on hover
Browse files Browse the repository at this point in the history
  • Loading branch information
afbjorklund committed Mar 2, 2024
1 parent 04cae9a commit 1c5b523
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,14 @@ static QString getPrefix()
return prefix;
}

static void tooltipLink(const QString &link)
{
if (!link.isEmpty())
QToolTip::showText(QCursor::pos(), link);
else
QToolTip::hideText();
}

void Window::yamlEditor(QString instanceName, QString setString, QString yamlFile, bool create,
bool edit, bool start)
{
Expand Down Expand Up @@ -1286,6 +1294,7 @@ void Window::inspectInstance()
if (running) {
sshLabel->setText(QString("<a href=\"ssh://%1\">%2</a>").arg(sshAddress, sshAddress));
connect(sshLabel, &QLabel::linkActivated, this, &Window::shellConsole);
connect(sshLabel, &QLabel::linkHovered, this, &tooltipLink);
}
form1->addRow(new QLabel(tr("SSH:")), sshLabel);
form1->addRow(new QLabel(tr("VM Type:")), new QLabel(instance.vmType()));
Expand All @@ -1298,6 +1307,7 @@ void Window::inspectInstance()
QLabel *dirLabel =
new QLabel(QString("<a href=\"file://%1\">%2</a>").arg(instance.dir(), instDir));
dirLabel->setOpenExternalLinks(true);
connect(dirLabel, &QLabel::linkHovered, this, &tooltipLink);
form1->addRow(new QLabel(tr("Dir:")), dirLabel);
instanceBox->setLayout(form1);
QGroupBox *advancedBox = new QGroupBox(tr("Advanced"));
Expand Down

0 comments on commit 1c5b523

Please sign in to comment.