--- /dev/null
+// -*- C++ -*-
+/**
+ * \file GuiClickableLabel.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include "config.h"
+
+#include "GuiClickableLabel.h"
+
+namespace lyx {
+namespace frontend {
+
+GuiClickableLabel::GuiClickableLabel(QWidget * parent)
+ : QLabel(parent)
+{}
+
+GuiClickableLabel::~GuiClickableLabel()
+{}
+
+void GuiClickableLabel::mouseReleaseEvent(QMouseEvent *) {
+ Q_EMIT clicked();
+ }
+
+}
+}
+
+#include "moc_GuiClickableLabel.cpp"
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file GuiClickableLabel.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef GUICLICKABLELABEL_H
+#define GUICLICKABLELABEL_H
+
+#include <QLabel>
+
+namespace lyx {
+namespace frontend {
+
+// see https://wiki.qt.io/Clickable_QLabel
+class GuiClickableLabel : public QLabel {
+ Q_OBJECT
+public:
+ explicit GuiClickableLabel(QWidget * parent);
+
+ ~GuiClickableLabel();
+
+Q_SIGNALS:
+ void clicked();
+
+protected:
+ void mouseReleaseEvent(QMouseEvent *);
+};
+
+}
+}
+#endif
#include "FileDialog.h"
#include "FontLoader.h"
#include "GuiApplication.h"
+#include "GuiClickableLabel.h"
#include "GuiCommandBuffer.h"
#include "GuiCompleter.h"
#include "GuiKeySymbol.h"
setAcceptDrops(true);
// add busy indicator to statusbar
- QLabel * busylabel = new QLabel(statusBar());
+ GuiClickableLabel * busylabel = new GuiClickableLabel(statusBar());
statusBar()->addPermanentWidget(busylabel);
search_mode mode = theGuiApp()->imageSearchMode();
QString fn = toqstr(lyx::libFileSearch("images", "busy", "gif", mode).absFileName());
busylabel, SLOT(show()));
connect(&d.processing_thread_watcher_, SIGNAL(finished()),
busylabel, SLOT(hide()));
+ connect(busylabel, SIGNAL(clicked()), this, SLOT(checkCancelBackground()));
QFontMetrics const fm(statusBar()->fontMetrics());
int const iconheight = max(int(d.normalIconSize), fm.height());
}
+void GuiView::checkCancelBackground()
+{
+ docstring const ttl = _("Cancel Export?");
+ docstring const msg = _("Do you want to cancel the background export process?");
+ int const ret =
+ Alert::prompt(ttl, msg, 1, 1,
+ _("&Cancel export"), _("Co&ntinue"));
+ if (ret == 0)
+ Systemcall::killscript();
+}
+
+
QVector<GuiWorkArea*> GuiView::GuiViewPrivate::guiWorkAreas()
{
QVector<GuiWorkArea*> areas;