void CVOpenGLWidget::resizeGL(int width, int height) { glViewport(0, 0, (GLint)width, (GLint)height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, width, 0, height, 0, 1); // To draw image in the center of the area glMatrixMode(GL_MODELVIEW); // Scaled Image sizes resizedImageHeight_ = width/imageRatio_; resizedImageWidth_ = width; if( resizedImageHeight_ > height) { resizedImageWidth_ = height * imageRatio_; resizedImageHeight_ = height; } emit imageSizeChanged( resizedImageWidth_, resizedImageHeight_ ); positionX_ = (width - resizedImageWidth_)/2; positionY_ = (height - resizedImageHeight_)/2; sceneChanged_ = true; paintGL(); }
void OpenCVwidget::resizeGL(int width, int height) { makeCurrent(); glViewport(0, 0, (GLint)width, (GLint)height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, width, 0, height, 0, 1); glMatrixMode(GL_MODELVIEW); mOutH = width/mImgRatio; mOutW = width; if(mOutH>height) { mOutW = height*mImgRatio; mOutH = height; } emit imageSizeChanged( mOutW, mOutH ); mPosX = (width-mOutW)/2; mPosY = (height-mOutH)/2; mSceneChanged = true; updateScene(); }
void QtOpenCVViewerGl::resizeGL(int width, int height) { makeCurrent(); glViewport(0, 0, (GLint)width, (GLint)height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, width, 0, height, 0, 1); // To Draw image in the center of the area glMatrixMode(GL_MODELVIEW); // ---> Scaled Image Sizes mOutH = width/mImgRatio; mOutW = width; if(mOutH>height) { mOutW = height*mImgRatio; mOutH = height; } emit imageSizeChanged( mOutW, mOutH ); // <--- Scaled Image Sizes mPosX = (width-mOutW)/2; mPosY = (height-mOutH)/2; mSceneChanged = true; updateScene(); }
void OpenCVViewer::resizeGL(int width, int height) { makeCurrent(); glViewport(0, 0, (GLint)width, (GLint)height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Draw image in the center of the area. glOrtho(0, width, 0, height, 0, 1); glMatrixMode(GL_MODELVIEW); outH = width/imgRatio; outW = width; if(outH > height) { outW = height*imgRatio; outH = height; } emit imageSizeChanged(outW, outH); posX = (width - outW)/2; posY = (height - outH)/2; isSceneChanged = true; updateScene(); }
void TelegramFileLocation::setImageSize(const QSizeF &imageSize) { if(p->imageSize == imageSize) return; p->imageSize = imageSize; Q_EMIT imageSizeChanged(); }
TableEditor::TableEditor(QWidget *parent): Editor(parent) { QVBoxLayout *layout = new QVBoxLayout(this); setLayout(layout); // toolbar _toolbar = new QWidget(this); layout->addWidget(_toolbar); _ui_toolbar = new Ui::TableEditorToolbar; _ui_toolbar->setupUi(_toolbar); _ui_toolbar->firstPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/allLeft"))); _ui_toolbar->previousPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/left"))); _ui_toolbar->nextPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/right"))); _ui_toolbar->lastPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/allRight"))); _ui_toolbar->refreshButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/refresh"))); _ui_toolbar->addRowButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/general/add"))); _ui_toolbar->deleteRowButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/general/remove"))); _ui_toolbar->commitButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/checked"))); _ui_toolbar->rollbackButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/rollback"))); _ui_toolbar->dumpDataButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/export"))); _tableView = new QTableView(this); _tableModel = new QSqlTableModel(_tableView /* TODO database connection */); _tableView->setModel(_tableModel); layout->addWidget(_tableView); // connections connect(_ui_toolbar->commitButton, SIGNAL(clicked()), _tableModel, SLOT(submitAll())); connect(_ui_toolbar->rollbackButton, SIGNAL(clicked()), _tableModel, SLOT(revertAll())); connect(_ui_toolbar->addRowButton, SIGNAL(clicked()), this, SLOT(addRow())); connect(_ui_toolbar->deleteRowButton, SIGNAL(clicked()), this, SLOT(deleteRows())); connect(_ui_toolbar->refreshButton, SIGNAL(clicked()), _tableModel, SLOT(select())); connect(_ui_toolbar->toolButtonExportImage, SIGNAL(clicked()),_imageView, SLOT(exportImage())); connect(_ui_toolbar->toolButtonZoomIn, SIGNAL(clicked()),_imageView,SLOT(zoomIn())); connect(_ui_toolbar->toolButtonZoomOut, SIGNAL(clicked()),_imageView, SLOT(zoomOut())); connect(_ui_toolbar->toolButtonFitToScreen, SIGNAL(clicked()),_imageView, SLOT(fitToScreen())); connect(_ui_toolbar->toolButtonOriginalSize, SIGNAL(clicked()),_imageView, SLOT(resetToOriginalSize())); connect(_ui_toolbar->toolButtonBackground, SIGNAL(toggled()),_imageView, SLOT(setViewBackground())); connect(_ui_toolbar->toolButtonOutline, SIGNAL(toggled()),_imageView, SLOT(setViewOutline())); connect(_ui_toolbar->toolButtonPlayPause, SIGNAL(clicked()),this, SLOT(playToggled())); connect(_file, SIGNAL(imageSizeChanged()),this, SLOT(imageSizeUpdated())); connect(_file, SIGNAL(openFinished()),_imageView, SLOT(createScene())); connect(_file, SIGNAL(openFinished()),this, SLOT(updateToolButtons())); connect(_file, SIGNAL(aboutToReload()),_imageView, SLOT(reset())); connect(_file, SIGNAL(reloadFinished()),_imageView, SLOT(createScene())); connect(_file, SIGNAL(isPausedChanged()),this, SLOT(updatePauseAction())); connect(_imageView, SIGNAL(scaleFactorChanged()),this, SLOT(scaleFactorUpdate())); }
void Emulation::setImageSize(int lines, int columns) { //kDebug() << "Resizing image to: " << lines << "by" << columns << QTime::currentTime().msec(); Q_ASSERT( lines > 0 ); Q_ASSERT( columns > 0 ); _screen[0]->resizeImage(lines,columns); _screen[1]->resizeImage(lines,columns); emit imageSizeChanged(lines,columns); bufferedUpdate(); }
void TelegramImageElement::setImage(const QString &image) { initImage(); if(QFileInfo(image).exists()) { QImageReader reader(image); p->imageSize = reader.size(); } else p->imageSize = QSizeF(); QVariant value = (image.isEmpty() ? QUrl() : QUrl::fromLocalFile(image)); p->image->setProperty("source", value); p->properties["source"] = value; Q_EMIT imageSizeChanged(); Q_EMIT currentImageChanged(); }
void OpenCVWidget::resizeGL(int width, int height) { _width = width; _height = height; makeCurrent(); glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); // Select the projection matrix glLoadIdentity(); // Reset the projection matrix // gluOrtho2D(0, width, 0, height); // set origin to bottom left corner gluPerspective(53, 1, _imgRatio, 50.0); // maintainAspectRatio(width, height); emit imageSizeChanged( width, height ); gluLookAt(0.0, 0.0, 2.0, // eye 0.0, 0.0, 0.0, // center 0.0, 1.0, 0.0); // up glMatrixMode(GL_MODELVIEW); // Select the model view matrix glLoadIdentity(); // Reset the model view matrix }
void KisSketchView::documentChanged() { d->doc = DocumentManager::instance()->document(); if (!d->doc) return; connect(d->doc, SIGNAL(modified(bool)), SIGNAL(modifiedChanged())); KisSketchPart *part = DocumentManager::instance()->part(); Q_ASSERT(part); QPointer<KisView2> view = qobject_cast<KisView2*>(part->createView(d->doc, QApplication::activeWindow())); d->view = view; d->view->setShowFloatingMessage(false); connect(d->view, SIGNAL(floatingMessageRequested(QString,QString)), this, SIGNAL(floatingMessageRequested(QString,QString))); d->view->canvasControllerWidget()->setGeometry(x(), y(), width(), height()); d->view->hide(); d->canvas = d->view->canvasBase(); d->undoStack = d->doc->undoStack(); d->undoAction = d->view->actionCollection()->action("edit_undo"); connect(d->undoAction, SIGNAL(changed()), this, SIGNAL(canUndoChanged())); d->redoAction = d->view->actionCollection()->action("edit_redo"); connect(d->redoAction, SIGNAL(changed()), this, SIGNAL(canRedoChanged())); KoToolManager::instance()->switchToolRequested( "KritaShape/KisToolBrush" ); d->canvasWidget = d->canvas->canvasWidget(); connect(d->doc->image(), SIGNAL(sigImageUpdated(QRect)), SLOT(imageUpdated(QRect))); connect(d->view->canvasControllerWidget()->proxyObject, SIGNAL(moveDocumentOffset(QPoint)), SLOT(documentOffsetMoved())); connect(d->view->zoomController(), SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)), SLOT(zoomChanged())); connect(d->canvas, SIGNAL(updateCanvasRequested(QRect)), SLOT(imageUpdated(QRect))); connect(d->doc->image()->signalRouter(), SIGNAL(sigRemoveNodeAsync(KisNodeSP)), SLOT(removeNodeAsync(KisNodeSP))); connect(d->doc->image()->signalRouter(), SIGNAL(sigSizeChanged(QPointF,QPointF)), SIGNAL(imageSizeChanged())); if(scene()) { SketchDeclarativeView *v = qobject_cast<SketchDeclarativeView*>(scene()->views().at(0)); if (v) { v->setCanvasWidget(d->canvasWidget); v->setDrawCanvas(true); } } d->imageUpdated(d->canvas->image()->bounds()); static_cast<KoZoomHandler*>(d->canvas->viewConverter())->setResolution(d->doc->image()->xRes(), d->doc->image()->yRes()); d->view->zoomController()->setZoomMode(KoZoomMode::ZOOM_PAGE); d->view->canvasControllerWidget()->setScrollBarValue(QPoint(0, 0)); d->view->canvasControllerWidget()->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); d->view->canvasControllerWidget()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); geometryChanged(QRectF(x(), y(), width(), height()), QRectF()); d->loadedTimer->start(100); d->view->actionCollection()->action("zoom_to_100pct")->trigger(); d->resetDocumentPosition(); emit viewChanged(); }