mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
parent
aa311fb065
commit
7f29940625
|
@ -32,18 +32,26 @@
|
|||
#include "screengrabberchooserrectitem.h"
|
||||
#include "screengrabberoverlayitem.h"
|
||||
#include "toolboxgraphicsitem.h"
|
||||
#include "src/widget/widget.h"
|
||||
|
||||
ScreenshotGrabber::ScreenshotGrabber(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
|
||||
scene = new QGraphicsScene;
|
||||
window = new QGraphicsView (scene); // Top-level widget
|
||||
setupWindow();
|
||||
setupScene(scene);
|
||||
|
||||
installEventFilter(this);
|
||||
}
|
||||
|
||||
void ScreenshotGrabber::reInit()
|
||||
{
|
||||
scene = new QGraphicsScene;
|
||||
window = new QGraphicsView (scene); // Top-level widget
|
||||
setupWindow();
|
||||
setupScene(scene);
|
||||
showGrabber();
|
||||
}
|
||||
|
||||
ScreenshotGrabber::~ScreenshotGrabber()
|
||||
|
@ -76,6 +84,15 @@ bool ScreenshotGrabber::handleKeyPress(QKeyEvent* event)
|
|||
reject();
|
||||
else if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)
|
||||
acceptRegion();
|
||||
else if (event->key() == Qt::Key_Space) // minimize qTox window
|
||||
{
|
||||
Widget *Widget = Widget::getInstance();
|
||||
Widget->setVisible(false);
|
||||
this->window->setVisible(false);
|
||||
this->window->resetCachedContent();
|
||||
// Give the window manager a moment to hide windows
|
||||
QTimer::singleShot(200, this, SLOT(reInit()));
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
|
@ -129,14 +146,14 @@ void ScreenshotGrabber::setupScene(QGraphicsScene* scene)
|
|||
|
||||
void ScreenshotGrabber::useNothingSelectedTooltip()
|
||||
{
|
||||
helperTooltip->setHtml(tr("Click and drag to select a region. Press <b>Escape</b> to cancel.",
|
||||
helperTooltip->setHtml(tr("Click and drag to select a region. Press <b>Space</b> to hide qTox window. Press <b>Escape</b> to cancel.",
|
||||
"Help text shown when no region has been selected yet"));
|
||||
adjustTooltipPosition();
|
||||
}
|
||||
|
||||
void ScreenshotGrabber::useRegionSelectedTooltip()
|
||||
{
|
||||
helperTooltip->setHtml(tr("Press <b>Enter</b> to send a screenshot of the selected region or select a new region. Press <b>Escape</b> to cancel.",
|
||||
helperTooltip->setHtml(tr("Press <b>Enter</b> to send a screenshot of the selected region or select a new region. Press <b>Space</b> to hide qTox window and repeat region selection. Press <b>Escape</b> to cancel.",
|
||||
"Help text shown when a region has been selected"));
|
||||
adjustTooltipPosition();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <QWidget>
|
||||
#include <QPixmap>
|
||||
#include <QPoint>
|
||||
#include <QTimer>
|
||||
|
||||
class ScreenGrabberChooserRectItem;
|
||||
class QGraphicsSceneMouseEvent;
|
||||
|
@ -48,6 +49,7 @@ public slots:
|
|||
|
||||
void showGrabber();
|
||||
void acceptRegion();
|
||||
void reInit();
|
||||
|
||||
signals:
|
||||
void screenshotTaken(const QPixmap &pixmap);
|
||||
|
|
Loading…
Reference in New Issue
Block a user