void StelMainGraphicsView::init(QSettings* conf) { Q_ASSERT(glWidget->isValid()); glWidget->makeCurrent(); // Create the main widget for stellarium, which in turn creates the main StelApp instance. mainSkyItem = new StelAppGraphicsWidget(); mainSkyItem->setZValue(-10); mainSkyItem->setContentsMargins(0,0,0,0); QGraphicsGridLayout* l = new QGraphicsGridLayout(backItem); l->setSpacing(0); l->setContentsMargins(0,0,0,0); l->addItem(mainSkyItem, 0, 0); backItem->setLayout(l); scene()->addItem(backItem); // Activate the resizing caused by the layout QCoreApplication::processEvents(); mainSkyItem->setFocus(); flagInvertScreenShotColors = conf->value("main/invert_screenshots_colors", false).toBool(); setFlagCursorTimeout(conf->value("gui/flag_mouse_cursor_timeout", false).toBool()); setCursorTimeout(conf->value("gui/mouse_cursor_timeout", 10.f).toFloat()); maxfps = conf->value("video/maximum_fps",10000.f).toFloat(); minfps = conf->value("video/minimum_fps",10000.f).toFloat(); StelPainter::initSystemGLInfo(glContext); QPainter qPainter(glWidget); StelPainter::setQPainter(&qPainter); // Initialize the core, including the StelApp instance. mainSkyItem->init(conf); // Prevent flickering on mac Leopard/Snow Leopard glWidget->setAutoFillBackground (false); #ifndef DISABLE_SCRIPTING scriptAPIProxy = new StelMainScriptAPIProxy(this); scriptMgr = new StelScriptMgr(this); #endif // Look for a static GUI plugins. foreach (QObject *plugin, QPluginLoader::staticInstances()) { StelGuiPluginInterface* pluginInterface = qobject_cast<StelGuiPluginInterface*>(plugin); if (pluginInterface) { gui = pluginInterface->getStelGuiBase(); } break; }
QImage FileTransferInstance::drawProgressBarImg(const double &part, int w, int h) { QImage progressBar(w, h, QImage::Format_Mono); QPainter qPainter(&progressBar); qPainter.setBrush(Qt::NoBrush); qPainter.setPen(Qt::black); qPainter.drawRect(0, 0, w - 1, h - 1); qPainter.setBrush(Qt::SolidPattern); qPainter.setPen(Qt::black); qPainter.drawRect(1, 0, (w - 2) * (part), h - 1); return progressBar; }
QImage CFileTransferAction::drawProgressBarImg(const double &part, int w, int h, Qt::GlobalColor clrBack, Qt::GlobalColor clrFront) { QImage progressBar(w, h, QImage::Format_RGB16); QPainter qPainter(&progressBar); qPainter.setBrush(QBrush(clrBack)); qPainter.setPen(Qt::white); qPainter.drawRect(0, 0, w, h); if(0 != part) { qPainter.setBrush(QBrush(clrFront)); qPainter.setPen(Qt::green); qPainter.drawRect(0, 0, w * part, h); } return progressBar; }
void PaintArea::paintEvent(QPaintEvent *event) { Q_UNUSED(event); if (webpage->getFirstNode() != NULL) { QPainter qPainter(this); paintNodesVector = webpage->getFirstNode()->getPaintNodes(); drawDocument(&qPainter, paintNodesVector); //Prevents document from moving around while being redrawn. positionSet = true; //This is necessary to show the entire paint area in the scroll area. setMinimumHeight(currentY); setMaximumHeight(currentY); } }
// add a border to all stored faces QPixmap * Manager::frameAllFaces(QPixmap * pixmap, double scaleRatio) { QPainter qPainter(pixmap); qPainter.setBrush(Qt::NoBrush); qPainter.setPen(Qt::red); int element = 0; for(std::vector<FaceObject>::iterator it = this->TagedElements.begin(); it != this->TagedElements.end(); ++it) { FaceObject fo = *it; if(element != selectedFace) { qPainter.setPen(Qt::red); } else { qPainter.setPen(Qt::green); } qPainter.drawRect((int)(fo.x * scaleRatio),(int)(fo.y * scaleRatio),(int)(fo.width * scaleRatio),(int) (fo.height * scaleRatio)); element++; } return pixmap; }