mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Text information about tool processing
This commit is contained in:
@ -714,6 +714,7 @@ PDFToolManager::PDFToolManager(PDFDrawWidgetProxy* proxy, Actions actions, QObje
|
|||||||
for (PDFWidgetTool* tool : m_predefinedTools)
|
for (PDFWidgetTool* tool : m_predefinedTools)
|
||||||
{
|
{
|
||||||
m_tools.insert(tool);
|
m_tools.insert(tool);
|
||||||
|
connect(tool, &PDFWidgetTool::messageDisplayRequest, this, &PDFToolManager::messageDisplayRequest);
|
||||||
|
|
||||||
if (QAction* action = tool->getAction())
|
if (QAction* action = tool->getAction())
|
||||||
{
|
{
|
||||||
@ -1172,6 +1173,7 @@ void PDFScreenshotTool::onRectanglePicked(PDFInteger pageIndex, QRectF pageRecta
|
|||||||
}
|
}
|
||||||
|
|
||||||
QApplication::clipboard()->setImage(image, QClipboard::Clipboard);
|
QApplication::clipboard()->setImage(image, QClipboard::Clipboard);
|
||||||
|
emit messageDisplayRequest(tr("Page contents of size %1 x %2 pixels were copied to the clipboard.").arg(image.width()).arg(image.height()), 5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1202,6 +1204,7 @@ void PDFExtractImageTool::onImagePicked(const QImage& image)
|
|||||||
if (!image.isNull())
|
if (!image.isNull())
|
||||||
{
|
{
|
||||||
QApplication::clipboard()->setImage(image, QClipboard::Clipboard);
|
QApplication::clipboard()->setImage(image, QClipboard::Clipboard);
|
||||||
|
emit messageDisplayRequest(tr("Image of size %1 x %2 pixels was copied to the clipboard.").arg(image.width()).arg(image.height()), 5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,8 +91,17 @@ public:
|
|||||||
const std::optional<QCursor>& getCursor() const;
|
const std::optional<QCursor>& getCursor() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
/// Informs about tool activity changed (if tool is enabled or disabled)
|
||||||
|
/// \param active Is tool active?
|
||||||
void toolActivityChanged(bool active);
|
void toolActivityChanged(bool active);
|
||||||
|
|
||||||
|
/// This is signal is set, when we want to display information message
|
||||||
|
/// to the user, with timeout in miliseconds, after which message
|
||||||
|
/// dissappears.
|
||||||
|
/// \param text Text, which should be displayed to the user
|
||||||
|
/// \param timeout Timeout in miliseconds
|
||||||
|
void messageDisplayRequest(const QString& text, int timeout);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void setActiveImpl(bool active);
|
virtual void setActiveImpl(bool active);
|
||||||
virtual void updateActions();
|
virtual void updateActions();
|
||||||
@ -458,6 +467,14 @@ public:
|
|||||||
/// in this case, optional will be set to nullopt.
|
/// in this case, optional will be set to nullopt.
|
||||||
const std::optional<QCursor>& getCursor() const;
|
const std::optional<QCursor>& getCursor() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
/// This is signal is set, when we want to display information message
|
||||||
|
/// to the user, with timeout in miliseconds, after which message
|
||||||
|
/// dissappears.
|
||||||
|
/// \param text Text, which should be displayed to the user
|
||||||
|
/// \param timeout Timeout in miliseconds
|
||||||
|
void messageDisplayRequest(const QString& text, int timeout);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onToolActionTriggered(bool checked);
|
void onToolActionTriggered(bool checked);
|
||||||
|
|
||||||
|
@ -260,6 +260,7 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) :
|
|||||||
m_toolManager = new pdf::PDFToolManager(m_pdfWidget->getDrawWidgetProxy(), actions, this, this);
|
m_toolManager = new pdf::PDFToolManager(m_pdfWidget->getDrawWidgetProxy(), actions, this, this);
|
||||||
m_pdfWidget->setToolManager(m_toolManager);
|
m_pdfWidget->setToolManager(m_toolManager);
|
||||||
updateMagnifierToolSettings();
|
updateMagnifierToolSettings();
|
||||||
|
connect(m_toolManager, &pdf::PDFToolManager::messageDisplayRequest, statusBar(), &QStatusBar::showMessage);
|
||||||
|
|
||||||
connect(m_pdfWidget->getDrawWidgetProxy(), &pdf::PDFDrawWidgetProxy::drawSpaceChanged, this, &PDFViewerMainWindow::onDrawSpaceChanged);
|
connect(m_pdfWidget->getDrawWidgetProxy(), &pdf::PDFDrawWidgetProxy::drawSpaceChanged, this, &PDFViewerMainWindow::onDrawSpaceChanged);
|
||||||
connect(m_pdfWidget->getDrawWidgetProxy(), &pdf::PDFDrawWidgetProxy::pageLayoutChanged, this, &PDFViewerMainWindow::onPageLayoutChanged);
|
connect(m_pdfWidget->getDrawWidgetProxy(), &pdf::PDFDrawWidgetProxy::pageLayoutChanged, this, &PDFViewerMainWindow::onPageLayoutChanged);
|
||||||
|
Reference in New Issue
Block a user