/****************************************************************************** * Repaint the widget. */ void ExtraSpinBox::paintEvent(QPaintEvent* e) { SpinBox::paintEvent(e); if (!mInhibitPaintSignal) Q_EMIT painted(); else --mInhibitPaintSignal; }
void QITreeWidget::paintEvent (QPaintEvent *aEvent) { /* Opens Items Painter */ QPainter painter; painter.begin (viewport()); /* Notify connected objects about painting */ QTreeWidgetItemIterator it (this); while (*it) { emit painted (*it, &painter); ++ it; } /* Close Items Painter */ painter.end(); /* Base-class paint-event */ QTreeWidget::paintEvent (aEvent); }
void SpinBox2::init() { if (mRightToLeft < 0) mRightToLeft = QApplication::isRightToLeft() ? 1 : 0; mMinValue = mSpinbox->minimum(); mMaxValue = mSpinbox->maximum(); mSingleStep = mSpinbox->singleStep(); mSingleShiftStep = mSpinbox->singleShiftStep(); mPageStep = mUpdown2->singleStep(); mPageShiftStep = mUpdown2->singleShiftStep(); mSpinbox->setSelectOnStep(false); // default mUpdown2->setSelectOnStep(false); // always false setFocusProxy(mSpinbox); mUpdown2->setFocusPolicy(Qt::NoFocus); mSpinMirror = new SpinMirror(mUpdown2, mSpinbox, this); mSpinbox->installEventFilter(this); mUpdown2->installEventFilter(this); connect(mSpinbox, SIGNAL(valueChanged(int)), SLOT(valueChange())); connect(mSpinbox, SIGNAL(valueChanged(int)), SIGNAL(valueChanged(int))); connect(mSpinbox, SIGNAL(valueChanged(const QString&)), SIGNAL(valueChanged(const QString&))); connect(mUpdown2, SIGNAL(stepped(int)), SLOT(stepPage(int))); connect(mUpdown2, SIGNAL(painted()), SLOT(paintTimer())); }
/*! Constructs widgets and connections of signals for the main window. */ void MPWindow::initUIComponents() { // Initialise view m_view = new MPMapView(this); connect(m_view, SIGNAL(interactionChanged(Interaction*)), this, SLOT(onInteractionChanged(Interaction*))); connect(m_view, SIGNAL(viewportShift()), this, SLOT(onViewShift())); connect(m_view, SIGNAL(painted(qlonglong)), this, SLOT(onViewPainted(qlonglong))); connect(m_view, SIGNAL(imageRequested(int)), this, SLOT(onViewImageRequested(int))); connect(m_view, SIGNAL(imageReceived()), this, SLOT(onViewImageReceived())); connect(m_view, SIGNAL(imageFinished()), this, SLOT(onViewImageFinished())); connect(m_view, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(onViewMouseMove(QMouseEvent*))); connect(m_view, SIGNAL(featureSnap(Feature*)), this, SLOT(onViewFeatureSnap(Feature*))); setCentralWidget(m_view); // Docks m_infosdock = new InfosDock(this); m_infosdock->setAllowedAreas(Qt::RightDockWidgetArea | Qt::LeftDockWidgetArea); addDockWidget(Qt::RightDockWidgetArea, m_infosdock); connect(m_infosdock, SIGNAL(dockClosed(bool)), this, SLOT(onDisplayInfosDock(bool))); // Status bar m_coordsLabel = new CoordField(this); connect(m_coordsLabel, SIGNAL(centerView(qreal,qreal)), this, SLOT(onCenterView(qreal,qreal))); m_meterPerPixelLabel = new QLabel(this); m_zoomlevelLabel = new QLabel(this); m_paintTimeLabel = new QLabel(this); m_paintTimeLabel->setMinimumWidth(23); m_dataProgress = new QProgressBar(this); m_dataProgress->setMaximumWidth(200); m_dataProgress->setVisible(false); m_imagesProgress = new QProgressBar(this); m_imagesProgress->setMaximumWidth(200); m_imagesProgress->setFormat(tr("tile %v / %m")); m_wsProgress = new QProgressBar(this); m_wsProgress->setMaximumWidth(200); m_wsProgress->setTextVisible(true); m_wsProgress->setFormat(tr("Requesting...")); // This has no effects, because max = 0 m_wsProgress->setVisible(false); m_wsProgress->setMaximum(0); // Separators m_sepCoordZoom = new QFrame(this); m_sepCoordZoom->setFrameStyle(QFrame::VLine); m_sepZoomScale = new QFrame(this); m_sepZoomScale->setFrameStyle(QFrame::VLine); m_sepScaleTime = new QFrame(this); m_sepScaleTime->setFrameStyle(QFrame::VLine); statusBar()->addPermanentWidget(m_imagesProgress); statusBar()->addPermanentWidget(m_dataProgress); statusBar()->addPermanentWidget(m_wsProgress); statusBar()->addPermanentWidget(m_coordsLabel); statusBar()->addPermanentWidget(m_sepCoordZoom); statusBar()->addPermanentWidget(m_zoomlevelLabel); statusBar()->addPermanentWidget(m_sepZoomScale); statusBar()->addPermanentWidget(m_meterPerPixelLabel); statusBar()->addPermanentWidget(m_sepScaleTime); statusBar()->addPermanentWidget(m_paintTimeLabel); }
// Check that row_size is correct CHECK(im.row_size() == 8); CHECK(im2.row_size() == 8); // Check that get_premultiplied is correct CHECK_FALSE(im.get_premultiplied()); CHECK_FALSE(im2.get_premultiplied()); // Check that set premultiplied works im2.set_premultiplied(true); CHECK(im2.get_premultiplied()); // Check that painted is correct CHECK_FALSE(im.painted()); CHECK_FALSE(im2.painted()); // Check that set premultiplied works im2.painted(true); CHECK(im2.painted()); // Check that offset is correct CHECK(im.get_offset() == 0.0); CHECK(im2.get_offset() == 0.0); // Check that set offset works im2.set_offset(2.3); CHECK(im2.get_offset() == 2.3); // Check that scaling is correct CHECK(im.get_scaling() == 1.0);
/*! \fn PartsWidget::paintEvent( QPaintEvent* ) */ void PartsWidget::paintEvent( QPaintEvent* ) { if ( partList.empty() ) { return; } int BLOCK_ROWS = Convert::max(1,height() / 30); double size = partList.getSize(); blockHeight = this->height() / BLOCK_ROWS; numPixels = this->width() * BLOCK_ROWS; pixelPerByte = numPixels / size; QListIterator<Part> it ( partList ); QPainter painter ( this ); int fromPixel, toPixel; Part fromPart, toPart; QColor color; int fromRow; int toRow; qulonglong bytesReady, bytesAvailable, bytesMissing, bytesLessSources; qulonglong partSize; bytesReady = bytesAvailable = bytesMissing = bytesLessSources = 0; toPart = it.next(); while ( it.hasNext() ) { fromPart = toPart; toPart = it.next(); fromPixel = ( int ) ( fromPart.fromPosition * pixelPerByte ); toPixel = ( int ) ( (toPart.fromPosition) * pixelPerByte ); partSize = (toPart.fromPosition) - fromPart.fromPosition; if ( fromPart.fromPosition != toPart.fromPosition ) { switch ( fromPart.type ) { case -1: color.setRgb(READY_COLOR); bytesReady += partSize; break; case 0: color.setRgb(MISSING_COLOR); bytesMissing += partSize; break; default: if ( fromPart.type < 5 ) { color.setRgb ( 255 - fromPart.type * 20, 255 - fromPart.type * 20, fromPart.type * 20 ); bytesLessSources += partSize; } else { int blue = 100 + fromPart.type * 10; if ( blue > 255 ) { blue = 255; } color.setRgb ( 0, 0, blue ); } bytesAvailable += partSize; break; } fromRow = fromPixel / width(); fromPixel = fromPixel % width(); toRow = toPixel / width(); toPixel = toPixel % width(); while ( fromRow < toRow ) { // -- fill until the end of the col -- painter.fillRect ( fromPixel, fromRow*blockHeight, width() - fromPixel, blockHeight, QBrush ( color ) ); fromPixel = 0; fromRow++; } painter.fillRect ( fromPixel, fromRow*blockHeight, toPixel - fromPixel, blockHeight, QBrush ( color ) ); } } painter.end(); ready = bytesReady / size * 100.0; available = bytesAvailable / size * 100.0; lessSources = bytesLessSources / size * 100.0; missing = bytesMissing / size * 100.0; painted(); }