forked from qt-creator/qt-creator
CompilerExplorer: Add "powered by" label
Change-Id: I0006d314ee69f863e48196a7719a3ef7ebc127ae Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
#include <QCompleter>
|
||||
#include <QDesktopServices>
|
||||
#include <QDockWidget>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QPushButton>
|
||||
@@ -805,6 +806,22 @@ QWidget *Editor::toolBar()
|
||||
newSource->setToolTip(Tr::tr("Add Source"));
|
||||
m_toolBar->addAction(newSource);
|
||||
|
||||
m_toolBar->addSeparator();
|
||||
|
||||
QString link = QString(R"(<a href="%1">%1</a>)")
|
||||
.arg(m_document->settings()->compilerExplorerUrl.value());
|
||||
|
||||
auto poweredByLabel = new QLabel(Tr::tr("powered by %1").arg(link));
|
||||
|
||||
poweredByLabel->setTextInteractionFlags(Qt::TextInteractionFlag::TextBrowserInteraction);
|
||||
poweredByLabel->setContentsMargins(6, 0, 0, 0);
|
||||
|
||||
connect(poweredByLabel, &QLabel::linkActivated, this, [](const QString &link) {
|
||||
QDesktopServices::openUrl(link);
|
||||
});
|
||||
|
||||
m_toolBar->addWidget(poweredByLabel);
|
||||
|
||||
connect(newSource,
|
||||
&QAction::triggered,
|
||||
&m_document->settings()->m_sources,
|
||||
|
||||
Reference in New Issue
Block a user