Exemplo n.º 1
0
//! [1]
void Screenshot::resizeEvent(QResizeEvent * /* event */)
{
    QSize scaledSize = originalPixmap.size();
    scaledSize.scale(screenshotLabel->size(), Qt::KeepAspectRatio);
    if (!screenshotLabel->pixmap() || scaledSize != screenshotLabel->pixmap()->size())
        updateScreenshotLabel();
}
Exemplo n.º 2
0
MainWidget::MainWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MainWidget),
    ts(new RectSelector),
    maximizedState(false)
{
    ui->setupUi(this);

    QVector<QPushButton*> modeButtons;
    modeButtons.push_back(ui->mode0Button);
    modeButtons.push_back(ui->mode1Button);
    modeBox = new ModeBox(modeButtons);

    createActions();
    createTrayIcon();
    windowVisibility = true;

    loadSettings();
    //storePositionInfo();

    connect(this, SIGNAL(setPixmap(QPixmap)), ts, SLOT(loadBackgroundPixmap(QPixmap)));
    connect(ts, SIGNAL(finishPixmap(QPixmap)), this, SLOT(triangleReceiver(QPixmap)));
    connect(ts, SIGNAL(quitPixmap()), this, SLOT(triangleReceiver()));
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

    shootFullScreen();
    updateScreenshotLabel();
}
Exemplo n.º 3
0
void MainWidget::resizeEvent(QResizeEvent *)
{
    QSize scaledSize = originalPixmap.size();
    scaledSize.scale(ui->imageLabel->size(), Qt::KeepAspectRatio);
    if (!ui->imageLabel->pixmap()
            || scaledSize != ui->imageLabel->pixmap()->size())
        updateScreenshotLabel();
}
Exemplo n.º 4
0
void PhoneInfoWidget::resizeEvent(QResizeEvent * event)
{
    Q_UNUSED(event);

    QSize scaledSize = this->screenshot.size();
    scaledSize.scale(this->ui->labelRgb565->size(), Qt::KeepAspectRatio);
    if (!this->ui->labelRgb565->pixmap() || scaledSize != this->ui->labelRgb565->pixmap()->size())
        updateScreenshotLabel();
}
Exemplo n.º 5
0
 void Screenshot::shootScreen()
 {
     if (delaySpinBox->value() != 0)
         qApp->beep();
     originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
     updateScreenshotLabel();

     newScreenshotButton->setDisabled(false);
     if (hideThisWindowCheckBox->isChecked())
         show();
 }
Exemplo n.º 6
0
//! [4]
void Screenshot::shootScreen()
{
    if (delaySpinBox->value() != 0)
        qApp->beep();
//! [4]
    originalPixmap = QPixmap(); // clear image for low memory situations
                                // on embedded devices.
//! [5]
    originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
    updateScreenshotLabel();

    newScreenshotButton->setDisabled(false);
    if (hideThisWindowCheckBox->isChecked())
        show();
}
Exemplo n.º 7
0
//! [4]
void Screenshot::shootScreen()
{
    QScreen *screen = QGuiApplication::primaryScreen();
    if (const QWindow *window = windowHandle())
        screen = window->screen();
    if (!screen)
        return;

    if (x_spinBox->value() != 0)
        QApplication::beep();

    originalPixmap = screen->grabWindow(0);
    updateScreenshotLabel();

    newScreenshotButton->setDisabled(false);
    //if (hideThisWindowCheckBox->isChecked())
      //  show();
}
Exemplo n.º 8
0
void MainWidget::triangleReceiver(QPixmap pixmap)
{
    originalPixmap = pixmap;
    updateScreenshotLabel();
    show();
}
Exemplo n.º 9
0
void MainWidget::shootFullScreen()
{
    originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
    updateScreenshotLabel();
    show();
}