Example #1
0
Screenshot::Screenshot( QWidget *parent, Qt::WFlags f)
{
    screenshotLabel = new QLabel;
    screenshotLabel->setSizePolicy(QSizePolicy::Expanding,
                                   QSizePolicy::Expanding);
    screenshotLabel->setAlignment(Qt::AlignCenter);
//    screenshotLabel->setMinimumSize(240, 160);

    createOptionsGroupBox();
    createButtonsLayout();

    mainLayout = new QVBoxLayout;
    mainLayout->addWidget(screenshotLabel);
    mainLayout->addWidget(optionsGroupBox);
#ifndef Q_WS_QWS
    mainLayout->addLayout(buttonsLayout);
#endif
    setLayout(mainLayout);

    shootScreen();
    delaySpinBox->setValue(5);
    hideThisWindowCheckBox->setChecked(true);
    setWindowTitle(tr("Screenshot"));
#ifndef Q_WS_QWS
    resize(300, 200);
#endif
    QtopiaApplication::instance()->registerRunningTask("ReallyFuckingHideThisAndNotKillIt");

}
Example #2
0
//! [2]
void Screenshot::newScreenshot()
{
    if (hideThisWindowCheckBox->isChecked())
        hide();
    newScreenshotButton->setDisabled(true);

    QTimer::singleShot(delaySpinBox->value() * 1000, this, SLOT(shootScreen()));
}
Example #3
0
//! [0]
Screenshot::Screenshot()
{
    screenshotLabel = new QLabel;
    screenshotLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    screenshotLabel->setAlignment(Qt::AlignCenter);
    screenshotLabel->setMinimumSize(240, 160);

    createOptionsGroupBox();
    createButtonsLayout();

    mainLayout = new QVBoxLayout;
    mainLayout->addWidget(screenshotLabel);
    mainLayout->addWidget(optionsGroupBox);
    mainLayout->addLayout(buttonsLayout);
    setLayout(mainLayout);

    shootScreen();
    delaySpinBox->setValue(5);

    setWindowTitle(tr("Screenshot"));
    resize(300, 200);
}
Example #4
0
//! [0]
Screenshot::Screenshot()
    :  screenshotLabel(new QLabel(this))
{
    screenshotLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    screenshotLabel->setAlignment(Qt::AlignCenter);

    const QRect screenGeometry = QApplication::desktop()->screenGeometry(this);
    screenshotLabel->setMinimumSize(screenGeometry.width() / 1.5, screenGeometry.height() / 1.5);

    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->addWidget(screenshotLabel);

    QGroupBox *optionsGroupBox = new QGroupBox(tr("Veuillez saisir les données"), this);
    x_spinBox = new QSpinBox(optionsGroupBox);
    x_spinBox->setSuffix(tr(" px"));
    x_spinBox->setMaximum(screenGeometry.width());

    y_spinBox = new QSpinBox(optionsGroupBox);
    y_spinBox->setSuffix(tr(" px"));
    y_spinBox->setMaximum(screenGeometry.height());

    width_spinBox = new QSpinBox(optionsGroupBox);
    width_spinBox->setSuffix(tr(" px"));
    //width_spinBox->setPrefix(tr("Width "));
    width_spinBox->setMaximum(screenGeometry.width());

    height_spinBox = new QSpinBox(optionsGroupBox);
    height_spinBox->setSuffix(tr(" px"));
    height_spinBox->setMaximum(screenGeometry.height());

    optionsGroupBox->setFixedWidth(350);

    typedef void (QSpinBox::*QSpinBoxIntSignal)(int);
    connect(x_spinBox, static_cast<QSpinBoxIntSignal>(&QSpinBox::valueChanged),
            this, &Screenshot::updateCheckBox);

    //hideThisWindowCheckBox = new QCheckBox(tr("Hide This Window"), optionsGroupBox);

    QGridLayout *optionsGroupBoxLayout = new QGridLayout(optionsGroupBox);
    optionsGroupBoxLayout->addWidget(new QLabel(tr("Point de départ :"), this), 0, 0);
    optionsGroupBoxLayout->addWidget(x_spinBox, 0, 1);
    optionsGroupBoxLayout->addWidget(y_spinBox, 0, 2);
    //optionsGroupBoxLayout->addWidget(hideThisWindowCheckBox, 1, 0, 1, 2);
    optionsGroupBoxLayout->addWidget(new QLabel("Dimensions :",this),1,0,1,1);
    optionsGroupBoxLayout->addWidget(width_spinBox,1,1);
    optionsGroupBoxLayout->addWidget(height_spinBox,1,2);

    mainLayout->addWidget(optionsGroupBox);

    QHBoxLayout *buttonsLayout = new QHBoxLayout;
    newScreenshotButton = new QPushButton(tr("Commencer le partage"), this);
    connect(newScreenshotButton, &QPushButton::clicked, this, &Screenshot::newScreenshot);
    buttonsLayout->addWidget(newScreenshotButton);
    QPushButton *quitScreenshotButton = new QPushButton(tr("Quitter"), this);
    quitScreenshotButton->setShortcut(Qt::CTRL + Qt::Key_Q);
    connect(quitScreenshotButton, &QPushButton::clicked, this, &QWidget::close);
    buttonsLayout->addWidget(quitScreenshotButton);
    buttonsLayout->addStretch();
    mainLayout->addLayout(buttonsLayout);

    shootScreen();
    //x_spinBox->setValue(5);

    setWindowTitle(tr("Bureau à distance"));
    resize(300, 200);
    rubberBand = NULL;
}
Example #5
0
void MainWidget::on_shotButton_clicked()
{
    hide();
    QTimer::singleShot(ui->delayBox->value() * 1000, this, SLOT(shootScreen()));
}