コード例 #1
0
ファイル: toolwidgets.cpp プロジェクト: Axure/TeXstudio
void PreviewWidget::previewLatex(const QPixmap& previewImage){
	preViewer->setPixmap(previewImage);
	preViewer->adjustSize();
	pvscaleFactor=1.0;
	if (mFit) fitImage(true);
	if (mCenter) centerImage(true);
}
コード例 #2
0
ファイル: uiimageviewer.cpp プロジェクト: J0s3f/fourchan-dl
void UIImageViewer::loadImage(int i) {
    QFile f;
    QPixmap p;
    QString filename;

    if (!this->isVisible()) {
        ui->image->clear();
        show();
    }

    QLOG_TRACE() << "ImageViewer :: Loading image " << currentImage << "from" << imagesToDisplay.count();
    rotation = 0;

    if (imagesToDisplay.count() > i) {
        filename = imagesToDisplay.value(i);

        if (f.exists(filename)) {
            f.setFileName(filename);
            ui->statusbar->showMessage("Working...");
            if (ui->image->movie() != 0) ui->image->movie()->stop();

            if (filename.endsWith(".gif")) {
                // Always assume gifs are animated -> therefore use QMovie for playback
                QMovie *movie = new QMovie(filename);
                ui->image->setMovie(movie);
                movie->start();
                ui->statusbar->showMessage("Loaded image " + filename, 2000);
                ui->lCurrentImage->setText(QString("%1/%2").arg(currentImage+1).arg(imagesToDisplay.count()));
                ui->lImageInfo->setText("");
            }
            else {
                if (p.load(filename)) {
                    originalPixmap = p;
                    transformPixmap();
                    fitImage();
                    ui->statusbar->showMessage("Loaded image " + filename, 2000);
                    ui->lCurrentImage->setText(QString("%1/%2").arg(currentImage+1).arg(imagesToDisplay.count()));
                    ui->lImageInfo->setText(QString("Resolution: %1x%2, Size: %3kB")
                                            .arg(originalPixmap.width())
                                            .arg(originalPixmap.height())
                                            .arg(f.size()/1024)
                                            );
                }
                else {
                    QLOG_ERROR() << "ImageViewer :: Error loading image" << filename;
                }
            }
        }

        if (runSlideshow)
            slideshowTimer->start();

    }
}
コード例 #3
0
ファイル: ImageArea.cpp プロジェクト: miabrahams/MPhoto
ImageArea::ImageArea(QWidget *parent)
    : QWidget(parent)
    , _front_viewer(nullptr)
    , _dir_view(false)
    , _hide_cursor_timer(0)
    , _enlarge_timer(this)
    , _reduce_timer(this)
    , _fit_timer(this)
    , _enlarge_parameter(0.01)
    , _start_zoom(1.0)
    , _start_pos(0,0)
    , _thumb_zoom(0.05)
{

    setAttribute(Qt::WA_StaticContents);

    _connectSignals( &_image_viewer );
    _image_viewer.setSize( width(), height() );

    _connectSignals( &_dir_viewer );
    _dir_viewer.setSize( width(), height() );

    connect( &_timer, SIGNAL(timeout()), this, SLOT(onTimer()));
    _timer.start( g_config.timer_duration );
    if ( g_config.multitouch )
    {
        setAttribute(Qt::WA_AcceptTouchEvents);
        setMouseTracking(true);
    } else {
        setMouseTracking(true);
    }
    setAcceptDrops(true);

    connect( &_enlarge_timer, SIGNAL(timeout()), this, SLOT(enlargeImage()) );
    connect( &_reduce_timer, SIGNAL(timeout()),this, SLOT(reduceImage()) );
    connect( &_fit_timer, SIGNAL(timeout()), this, SLOT(fitImage()));

    connect( &_image_viewer, SIGNAL(fitImage()), this, SLOT(onFitImage()));
}
コード例 #4
0
ファイル: uiimageviewer.cpp プロジェクト: J0s3f/fourchan-dl
void UIImageViewer::rotateCCW() {
    rotation -= 90;
    transformPixmap();
    fitImage();
}