void BenchmarkViewer::onSplitterHorizontalMoved(int pos, int index) { if (!currRGB.isNull()) ui->labelRGB->setPixmap(getPixmap(currRGB, ui->labelRGB->size())); if (!currDepth.isNull()) ui->labelDepth->setPixmap(getPixmap(currDepth, ui->labelDepth->size())); }
void MainWindow::updateScene() { unsigned currentImage = ui.listWidget->currentRow(); gs.clear(); if (ui.actionShowImage->isChecked() && currentImage < g_gradmagBitmapList.size()) { BitmapType::Pointer bitmap2; bitmap2 = g_gradmagBitmapList[currentImage]; gs.addPixmap(getPixmap(bitmap2)); } if (ui.actionShowShapeMask->isChecked() && currentImage < g_maskBitmapList.size()) { if (!g_maskBitmapList.empty()) { BitmapType::Pointer bitmap = g_maskBitmapList[currentImage]; gs.addPixmap(getPixmap(bitmap)); } } else if (ui.actionShowShapeDistanceMap->isChecked() && currentImage < g_distanceMapBitmapList.size()) { if (!g_distanceMapBitmapList.empty()) { BitmapType::Pointer bitmap = g_distanceMapBitmapList[currentImage]; gs.addPixmap(getPixmap(bitmap)); } } if (g_pointList.size() > 0) { int nPoints = g_pointList[0].size() / POINT_DIMENSIONS; itk::Function::HSVColormapFunction<double, itk::RGBAPixel<unsigned char> >::Pointer colorFunc = itk::Function::HSVColormapFunction<double, itk::RGBAPixel<unsigned char> >::New(); colorFunc->SetMinimumInputValue(0); colorFunc->SetMaximumInputValue(nPoints); for (int j = 0; j < nPoints; j++) { double x = g_pointList[currentImage][POINT_DIMENSIONS * j]; double y = g_pointList[currentImage][POINT_DIMENSIONS * j + 1]; QColor pointColor = Qt::black; if (ui.actionParticleRed->isChecked()) { pointColor = Qt::red; } else if (ui.actionParticleGreen->isChecked()) { pointColor = Qt::green; } else if (ui.actionParticleBlue->isChecked()) { pointColor = Qt::blue; } else if (ui.actionParticleWhite->isChecked()) { pointColor = Qt::white; } else if (ui.actionParticleHSV->isChecked()) { itk::RGBAPixel<unsigned char> rgb = colorFunc->operator()(j); pointColor = QColor(rgb[0], rgb[1], rgb[2]); } gs.addEllipse(x, y, 1, 1, QPen(pointColor), QBrush(pointColor, Qt::SolidPattern)); } } bool drawPhantoms = ui.actionShowPhantomParticles->isChecked() && (g_phantomParticles.size() > 0); if (drawPhantoms) { std::vector<float>& phantoms = g_phantomParticles[currentImage]; for (unsigned j = 0; j < phantoms.size(); j += 2) { gs.addEllipse(phantoms[j], phantoms[j+1], 1, 1, QPen(Qt::white), QBrush(Qt::white, Qt::SolidPattern)); } } }
void BenchmarkViewer::resizeEvent(QResizeEvent *event) { if (!currRGB.isNull()) { ui->labelRGB->setPixmap(getPixmap(currRGB, ui->labelRGB->size())); } if (!currDepth.isNull()) { ui->labelDepth->setPixmap(getPixmap(currDepth, ui->labelDepth->size())); } }
const QPixmap& Environment::getPixmap( const QString& _objectName, const QString& _skinId ) const { QString animationName( generateAnimationName( _skinId , _objectName , Core::LandscapeModel::ObjectState::Standing , Core::LandscapeModel::Direction::South ) ); if ( m_pluginInstance.getAnimationsCache()->hasAnimation( animationName ) ) { const Framework::GUI::AnimationManager::AnimationInfo& animationInfo = m_pluginInstance.getAnimationsCache()->getAnimation( animationName ); Framework::GUI::ImagesManager::IImagesManager::TransformationData transformationData( animationInfo.m_frames[ 0 ].m_frame ); return m_pluginInstance.getImagesManager()->getPixmap( animationInfo.m_atlasName, transformationData ); } else { return getPixmap( _objectName, IGraphicsInfo::ms_anySkinIdentifier ); } } // Environment::getPixmap
void MainUI::mouseReleaseEvent(QMouseEvent *ev){ if(mousegrabbed){ mousegrabbed = false; this->centralWidget()->setEnabled(true); this->releaseMouse(); //In the middle of selecting a window to take a screenshot // Get the window underneath the mouse click and take the screenshot QList<WId> wins = XCB->WindowList(); QList<WId> stack = XCB->WM_Get_Client_List(true); cwin = 0; //qDebug() << "Try to select window:" << ev->globalPos(); //for(int i=0; i<stack.length(); i++){ for(int i=stack.length()-1; i>=0 && cwin==0; i--){ //work top->bottom in the stacking order if(!wins.contains(stack[i])){ continue; } if( XCB->WindowGeometry(stack[i], true).contains(ev->globalPos()) && XCB->WindowState(stack[i])!=LXCB::INVISIBLE ){ qDebug() << "Found Window:" << i << XCB->WindowClass(stack[i]); cwin = stack[i]; } } qDebug() << " - Got window:" << cwin; if(cwin==this->winId()){ return; } //cancelled this->hide(); QTimer::singleShot(50+ui->spin_delay->value()*1000, this, SLOT(getPixmap())); }else{ QMainWindow::mouseReleaseEvent(ev); //normal processing } }
void processFile(char *file, char *map) { FILE *fd; char buffer[1024*8]; char buf[1024*8]; int first; Projection *p; fd = NULL; p = malloc(sizeof(Projection)); first = 0; fd = fopen(file,"r"); if(fd == NULL){ err(1,"fopen"); } (*p).proj = getPixmap(map); while(fgets(buffer,sizeof(buffer),fd) != 0){ if(first == 0){ first = 1; writePixmap(buffer,p); buf[0] = buffer[strlen(buffer)-1]; strcpy(buf,buf); }else{ strcat(buf,buffer); writePixmap(buf,p); erreaseBuffer(buf); buf[0] = '\n'; } } fclose(fd); }
void QOpenFileDialog::update(const std::string &selectedNodeName) { myStateLine->setText(QString::fromLocal8Bit(state()->name().c_str())); myListView->clear(); QListViewItem *item = 0; QListViewItem *selectedItem = 0; const std::vector<ZLTreeNodePtr> &subnodes = state()->subnodes(); for (std::vector<ZLTreeNodePtr>::const_iterator it = subnodes.begin(); it != subnodes.end(); ++it) { item = new QOpenFileDialogItem(myListView, item, *it); item->setPixmap(0, getPixmap(*it)); if ((*it)->name() == selectedNodeName) { selectedItem = item; } } if (selectedItem == 0) { selectedItem = myListView->firstChild(); } myListView->setSelected(selectedItem, true); if (selectedItem != myListView->firstChild()) { myListView->ensureItemVisible(selectedItem); } }
void MainUI::startScreenshot(){ if(mousegrabbed){ return; } lastgeom = this->geometry(); if( !getWindow() ){ return; } this->hide(); QTimer::singleShot(50+ui->spin_delay->value()*1000, this, SLOT(getPixmap())); }
// Get a pixmap when only width is given (this keeps the aspect ratio) const QPixmap ThemeManager::getPixmap(const QString &svgid, double width) { QRectF rect = mRenderer->boundsOnElement(svgid); double factor = width/rect.width(); QSize size = QSize(int(width), int(rect.height()*factor)); return getPixmap(svgid, size); }
QPixmap StatusNotifierIconProvider::requestPixmap(const QString &id, QSize *realSize, const QSize &requestedSize) { QSize size(requestedSize); if (size.width() < 1) size.setWidth(1); if (size.height() < 1) size.setHeight(1); *realSize = size; #define FAIL \ qWarning("StatusNotifierIconProvider: cannot load icon \"%s\".", qPrintable(id)); \ return QIcon::fromTheme("image-missing").pixmap(size); QStringList l = id.split('/'); if (l.size() != 2) { FAIL } QString service = l.first(); QString name = l.at(1); StatusNotifierItem *item = m_service->item(service); if (item) { QPixmap pix = getPixmap(item, size, name); if (!pix.isNull()) return pix; } FAIL }
QPixmap View::getPixmapForTile( std::string const & inTileId, View::Rotation inRotation ) { QPixmap const pixmap = getPixmap( inTileId ); QTransform rotation = QTransform(); rotation.rotate( getAngle( inRotation ) ); return pixmap.transformed( rotation ); }
QPixmap SplicePicturesImageItem::getTransformedPixmap(TransformFlag flag) { QMatrix matrix; int flagint = (int)flag; if (flagint & TRANS_SCALE) matrix.scale((double)getZoom(), (double)getZoom()); if (flagint & TRANS_ROTATE) matrix.rotate((double)getRotation()); // if (flagint & TRANS_MOVE) matrix.translate(getX(), getY()); return getPixmap()->transformed(matrix); }
void BenchmarkViewer::ShowRGBImage(QImage *rgb) { if (rgb == nullptr) return; currRGB = rgb->copy(0, 0, rgb->width(), rgb->height()); ui->labelRGB->setPixmap(getPixmap(currRGB, ui->labelRGB->size())); }
void BenchmarkViewer::ShowDepthImage(QImage *depth) { if (depth == nullptr) return; currDepth = depth->copy(0, 0, depth->width(), depth->height()); ui->labelDepth->setPixmap(getPixmap(currDepth, ui->labelDepth->size())); }
QPixmap Tileset::getPixmap(TilesetType tileset, int tile, int size) { if (m_tilesets.value(tileset, NULL)) { return getPixmap(m_tilesets[tileset]->getTile(tile), size); } return QPixmap(); }
AlbumWidget::AlbumWidget(Album *album): QWidget(0), ui(new Ui::AlbumWidget) { this->album = album; ui->setupUi(this); ui->titleLabel->setText(album->getTitle() + " (" + album->getNumPhotos() + ")"); ui->iconLabel->setPixmap(getPixmap(album->getThumbnailUrl())); }
AboutDialog::AboutDialog(QWidget* parent):QDialog(parent) { setupUi(this); createBanner(&BannerPixmap,getPixmap("keepassx"),QString("%1 %2").arg(APP_DISPLAY_NAME, APP_VERSION),width()); labelAppName->setText(APP_DISPLAY_NAME); labelAppFunc->setText(QString(" - ").append(APP_LONG_FUNC)); QString AboutTr=QString("<b>%1: %2</b><br><br>").arg(tr("Current Translation")).arg(tr("None","Please replace 'None' with the language of your translation")); if(isTranslationActive()){ AboutTr+=QString("<b>%1:</b> %2<br>").arg(tr("Author")).arg(QApplication::translate("Translation", "$TRANSLATION_AUTHOR")); QString mail=QApplication::translate("Translation", "$TRANSLATION_AUTHOR_EMAIL","Here you can enter your email or homepage if you want."); if(!mail.isEmpty()){ AboutTr+=mail+"<br>"; } AboutTr+="<br>"; } Edit_Translation->setHtml(AboutTr+tr("Information on how to translate KeePassX can be found under:") +"<br>http://www.keepassx.org/"); QString str; str+="<b>"+tr("Team")+"</b><br>"; str+="<div style='margin-left:10px;'>"; str+="<u>Tarek Saidi</u><br>"+tr("Developer, Project Admin")+"<br>[email protected]<br>"; str+="<br>"; str+="<u>Felix Geyer</u><br>"+tr("Developer, Project Admin")+"<br>[email protected]<br>"; str+="<br>"; str+="<u>Brandon Mayes</u><br>"+tr("Developer")+"<br>[email protected]<br>"; str+="<br>"; str+="<u>Eugen Gorschenin</u><br>"+tr("Web Designer")+"<br>[email protected]<br>"; str+="<br>"; str+="<u>Juan J González Cárdenas [Jota Jota]</u><br>"+tr("Developer")+"<br>[email protected]<br>"; str+="</div><br><div style='margin-left:0px;'>"; str+="<b>"+tr("Thanks To")+"</b><br>"; str+="</div><div style='margin-left:10px;'>"; str+="<u>Matthias Miller</u><br>"+tr("Patches for better MacOS X support")+"<br>www.outofhanwell.com<br>"; str+="<br>"; str+="<u>James Nicholls</u><br>"+tr("Main Application Icon")/*+"<br>"+tr("mailto:???")*/+"<br>"; str+="<br>"; str+="<u>Constantin Makshin</u><br>"+tr("Various fixes and improvements")+"<br>[email protected]<br>"; str+="<br>"; str+="<u>Lev Shamardin</u><br>"+tr("Lock with dialogs option")+"<br>[email protected]<br>"; str += "</div>"; Edit_Thanks->setHtml(str); QFile gpl(DataDir+"/license.html"); if (!gpl.open(QIODevice::ReadOnly)){ QMessageBox::critical(this,tr("Error"),tr("File '%1' could not be found.") .arg("'license.html'")+"\n"+tr("Make sure that the program is installed correctly.") ,tr("OK"),0,0,2,1); } Edit_License->setHtml(QString::fromUtf8(gpl.readAll())); connect(ButtonBox, SIGNAL(rejected()), SLOT(close())); }
HighlightItem::HighlightItem(qreal x, qreal y, Board* board, Square* s1, Square* s2, Direction dir) : QGraphicsPixmapItem(getPixmap(dir), board), board(board), s1(s1), s2(s2), direction(dir), visibilityVal(0), anim(0), active(0) { qreal scaleF; if (dir == horizontal) scaleF = WFactor()*Square::size()/getPixmap(dir).height(); else scaleF = WFactor()*Square::size()/getPixmap(dir).width(); setScale(scaleF); setZValue(1); setPos(x-scaleF*getPixmap(dir).width()/2, y-scaleF*getPixmap(dir).height()/2); //nie jestem pewien, czy ten efekt jest potrzebny, ale uzycie zwyklego //opacity jakos nawalalo - przezroczysty element nie dostawal mouseEventow setGraphicsEffect(new QGraphicsOpacityEffect()); setVisibility(0); setAcceptHoverEvents(1); };
bool Icon::save(QString filename) { if (pixmap.isNull()) { // Don't save an empty icon (but don't throw error). return true; } if (filename.isNull()) { filename = filename_original; } return getPixmap().save(filename, NULL, 100); }
static QSize getPixmapSize(QTextDocument *doc, const QTextImageFormat &format) { QPixmap pm; const bool hasWidth = format.hasProperty(QTextFormat::ImageWidth); const int width = qRound(format.width()); const bool hasHeight = format.hasProperty(QTextFormat::ImageHeight); const int height = qRound(format.height()); QSize size(width, height); if (!hasWidth || !hasHeight) { pm = getPixmap(doc, format); const int pmWidth = pm.width() / pm.devicePixelRatio(); const int pmHeight = pm.height() / pm.devicePixelRatio(); if (!hasWidth) { if (!hasHeight) size.setWidth(pmWidth); else size.setWidth(qRound(height * (pmWidth / (qreal) pmHeight))); } if (!hasHeight) { if (!hasWidth) size.setHeight(pmHeight); else size.setHeight(qRound(width * (pmHeight / (qreal) pmWidth))); } } qreal scale = 1.0; QPaintDevice *pdev = doc->documentLayout()->paintDevice(); if (pdev) { if (pm.isNull()) pm = getPixmap(doc, format); if (!pm.isNull()) scale = qreal(pdev->logicalDpiY()) / qreal(qt_defaultDpi()); } size *= scale; return size; }
QList<QPixmap> Square::getPixmaps(SquareType s) { BitType t; QList<QPixmap> l; do{ t=s&0xFF; s=s>>8; l.prepend(getPixmap(t)); } while(t>=128); return l; }
void CSettingsDlg::OnColor1() { QColor c=QColorDialog::getColor(color1,this); if(c.isValid()){ color1=c; QPixmap *px=new QPixmap(pixmColor1->width(),pixmColor1->height()); px->fill(c); pixmColor1->clear(); pixmColor1->setPixmap(*px); createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width(),color1,color2,textcolor); } }
void QTextImageHandler::drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format) { Q_UNUSED(posInDocument) const QTextImageFormat imageFormat = format.toImageFormat(); if (qApp->thread() != QThread::currentThread()) { const QImage image = getImage(doc, imageFormat); p->drawImage(rect, image, image.rect()); } else { const QPixmap pixmap = getPixmap(doc, imageFormat); p->drawPixmap(rect, pixmap, pixmap.rect()); } }
void ZLQtSelectionDialog::updateList() { myListView->clear(); const std::vector<ZLTreeNodePtr> &subnodes = handler().subnodes(); if (subnodes.size() > 0) { QListViewItem *item = 0; for (std::vector<ZLTreeNodePtr>::const_iterator it = subnodes.begin(); it != subnodes.end(); ++it) { item = new ZLQtSelectionDialogItem(myListView, item, *it); item->setPixmap(0, getPixmap(*it)); } } }
void PixmapCollectionChooser::slotUser1() { QPointer <PixmapCollectionEditor> dialog = new PixmapCollectionEditor(m_collection, parentWidget()); dialog->exec(); m_iconView->clear(); PixmapMap::ConstIterator it; PixmapMap::ConstIterator endIt = m_collection->m_pixmaps.constEnd(); for (it = m_collection->m_pixmaps.constBegin(); it != endIt; ++it) new PixmapIconViewItem(m_iconView, it.key(), getPixmap(it.key())); delete dialog; }
AddBookmarkDlg::AddBookmarkDlg(QWidget* parent, QString DefaultFilename, int _ItemID):QDialog(parent) { setupUi(this); ItemID=_ItemID; connect(Button_Browse,SIGNAL(clicked()),this,SLOT(OnButtonBrowse())); connect(buttonBox->button(QDialogButtonBox::Ok),SIGNAL(clicked()),this,SLOT(OnButtonOk())); connect(buttonBox->button(QDialogButtonBox::Cancel),SIGNAL(clicked()),this,SLOT(reject())); if(ItemID==-1){ createBanner(&BannerPixmap,getPixmap("bookmark_add"),tr("Add Bookmark"),width()); if(DefaultFilename.isEmpty()) OnButtonBrowse(); else Edit_Filename->setText(DefaultFilename); } else { createBanner(&BannerPixmap,getPixmap("bookmark_edit"),tr("Edit Bookmark"),width()); Edit_Title->setText(KpxBookmarks::title(ItemID)); Edit_Filename->setText(KpxBookmarks::path(ItemID)); setWindowTitle(tr("Edit Bookmark")); } }
AppState* TriggerRecognizer::recognize(QImage image_) { image = image_; auto pixmap = getPixmap(); std::set<QPoint> visited; std::vector<std::pair<QRgb, QPoint> > cells; for (int i = 0; i < image.width(); i++) for (int j = 0; j < image.height(); j++) { if ( (pixmap[i][j] == red || pixmap[i][j] == blue) && !visited.count(QPoint(i, j))) { std::set<QPoint> tmp; exploreRegion(QPoint(i, j), pixmap, tmp, pixmap[i][j]); if ((int)tmp.size() >= minRegionSize) { cells.push_back(std::make_pair(pixmap[i][j], meanPoint(tmp))); visited.insert(tmp.begin(), tmp.end()); } } } //std::cerr << "game consists of " << cells.size() << " cells" << std::endl; auto preField = cluster(cells); int width, height; if (preField.empty()) width = height = 0; else { width = preField[0].size(); height = preField.size(); } TriggerInternalState* internalState = new TriggerInternalState(height, width); TriggerExternalState* externalState = new TriggerExternalState(height, width); for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { internalState->setField(i, j, preField[i][j].first == red); QPoint point = preField[i][j].second; externalState->setCoordinate(i, j, point.x(), point.y()); } } return new AppState(internalState, externalState); }
QPixmap * KviIconManager::getBigIcon(const QString & szName) { QPixmap * pPix = getPixmap(szName); if(pPix) return pPix; bool bOk; int iIdx = szName.toInt(&bOk); if(bOk && (iIdx >= 0)) { // was a number : this is not a filename // it was a small icon: scale it and cache it QString szTmpName = szName; szTmpName += ".scaled16to32"; pPix = getPixmap(szTmpName); if(pPix) return pPix; pPix = getSmallIcon(iIdx % KviIconManager::IconCount); if(pPix) { QImage tmp = pPix->toImage(); QImage tmp2 = tmp.scaled(32,32,Qt::IgnoreAspectRatio,Qt::SmoothTransformation); QPixmap * pPix2 = new QPixmap(); *pPix2 = QPixmap::fromImage(tmp2); KviCachedPixmap * pCache = new KviCachedPixmap(pPix2,QString()); addToCache(szTmpName,pCache); return pCache->pixmap(); } } pPix = getPixmap("kvi_bigicon_unknown.png"); if(pPix) return pPix; KviCachedPixmap * pCache = new KviCachedPixmap(new QPixmap(32,32),QString()); addToCache(szName,pCache); return pCache->pixmap(); }
/* \internal Starts double buffered painting in the area specified by \a x, \a y, \a w and \a h on \a widget. Painting should be done using the QPainter returned by QSharedDoubleBuffer::painter(). The double buffered area will be updated when calling end(). \sa painter() isActive() end() */ bool QSharedDoubleBuffer::begin( QWidget* widget, int x, int y, int w, int h ) { if ( isActive() ) { #if defined(QT_CHECK_STATE) qWarning( "QSharedDoubleBuffer::begin: Buffer is already active." "\n\tYou must end() the buffer before a second begin()" ); #endif // QT_CHECK_STATE return FALSE; } state = Active; wid = widget; rx = x; ry = y; rw = w <= 0 ? wid->width() : w; rh = h <= 0 ? wid->height() : h; if ( ( pix = getPixmap() ) ) { #ifdef Q_WS_X11 if ( wid->x11Screen() != pix->x11Screen() ) pix->x11SetScreen( wid->x11Screen() ); QPixmap::x11SetDefaultScreen( pix->x11Screen() ); #endif // Q_WS_X11 state |= BufferActive; if ( flags & InitBG ) { pix->fill( wid, rx, ry ); } p = new QPainter( pix, wid ); // newly created painters should be translated to the origin // of the widget, so that paint methods can draw onto the double // buffered painter in widget coordinates. p->setBrushOrigin( -rx, -ry ); p->translate( -rx, -ry ); } else { if ( external_p ) { state |= ExternalPainter; p = external_p; } else { p = new QPainter( wid ); } if ( flags & InitBG ) { wid->erase( rx, ry, rw, rh ); } } return TRUE; }
QPixmap Tileset::getPixmap(TileInformation tile, int size) { if (size == -1) { size = SettingsManager::getValue("tileSize").toInt(); } if (tile.tileset == m_cachedTileset && size == m_textureSize) { QPixmap pixmap; if (QPixmapCache::find(QString::number(tile.id), &pixmap)) { return pixmap; } } QString fileName = QString("%1texpages%2tertilesc%3hw-%4%5tile-%6%7.png") .arg(SettingsManager::getValue("dataPath").toString() + QDir::separator()) .arg(QDir::separator()) .arg(static_cast<int>(tile.tileset)) .arg(size) .arg(QDir::separator()) .arg((tile.id < 10) ? QString('0') : QString()) .arg(tile.id); if (tile.valid && QFile::exists(fileName)) { if (tile.background) { QPixmap background = getPixmap(Tileset::getTileset(tile.tileset)->getTiles(false, tile.background).first(), size); QPainter painter(&background); painter.drawPixmap(0, 0, QPixmap(fileName)); return background; } else { return QPixmap(fileName); } } else { QPixmap debugPixmap(size, size); debugPixmap.fill(Qt::red); return debugPixmap; } }