bool QPushButtonPrivate::hitButton(const QPoint &pos) { Q_Q(QPushButton); QRect roundedRect(q->rect().left() + QMacStylePrivate::PushButtonLeftOffset, q->rect().top() + QMacStylePrivate::PushButtonContentPadding, q->rect().width() - QMacStylePrivate::PushButtonRightOffset, q->rect().height() - QMacStylePrivate::PushButtonBottomOffset); return roundedRect.contains(pos); }
RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const { IntRect snappedBorderRect(pixelSnappedIntRect(borderRect)); RoundedRect roundedRect(snappedBorderRect); if (hasBorderRadius()) { RoundedRect::Radii radii = calcRadiiFor(surround->border, snappedBorderRect.size()); radii.scale(calcBorderRadiiConstraintScaleFor(borderRect, radii)); roundedRect.includeLogicalEdges(radii, includeLogicalLeftEdge, includeLogicalRightEdge); } return roundedRect; }
void TextImageContent::draw ( ) { ofSetColor ( 255 , 255 , 255 ) ; maskShader.begin(); //our shader uses two textures, the top layer and the alpha //we can load two textures into a shader using the multi texture coordinate extensions glActiveTexture(GL_TEXTURE0_ARB); image.getTextureReference().bind(); glActiveTexture(GL_TEXTURE1_ARB); mask.getTextureReference().bind(); //draw a quad the size of the frame glBegin(GL_QUADS); ofFill() ; ofSetColor ( 255 , 255 , 255 , 255 ) ; float maskOffset = -scroll.y ; //15 - mouseY; /* glMultiTexCoord2d(GL_TEXTURE0_ARB, 0, maskOffset); glMultiTexCoord2d(GL_TEXTURE1_ARB, 0, 0); glVertex2f( bounds.x, bounds.y ); glMultiTexCoord2d(GL_TEXTURE0_ARB, image.getWidth(), maskOffset); glMultiTexCoord2d(GL_TEXTURE1_ARB, mask.getWidth(), 0); glVertex2f( bounds.x + bounds.width , bounds.y ); glMultiTexCoord2d(GL_TEXTURE0_ARB, image.getWidth(), mask.getHeight() + maskOffset ); glMultiTexCoord2d(GL_TEXTURE1_ARB, mask.getWidth(), mask.getHeight() ); glVertex2f( bounds.x + bounds.width , bounds.y + bounds.height ); glMultiTexCoord2d(GL_TEXTURE0_ARB, 0, mask.getHeight() + maskOffset ); glMultiTexCoord2d(GL_TEXTURE1_ARB, 0, mask.getHeight() ); glVertex2f( bounds.x , bounds.y + bounds.height ); glEnd() ; //deactive and clean up glActiveTexture(GL_TEXTURE1_ARB); mask.getTextureReference().unbind(); glActiveTexture(GL_TEXTURE0_ARB); image.getTextureReference().unbind(); maskShader.end(); //draw scrollbar indicator ofEnableAlphaBlending() ; ofSetColor ( 15 , 15 , 15 , 200 ) ; roundedRect ( bounds.x + bounds.width + 5 , bounds.y + (-scroll.y *.85) , 4 , 40 , 5 ) ; }
void EWATextLabel::drawBackground() { QRect fullRect = rect(); QRect roundedRect( QPoint( fullRect.topLeft().x()+1, fullRect.topLeft().y() ), QPoint( fullRect.width()-1, fullRect.height() ) ); QPainter painter( this ); painter.fillRect( fullRect, Qt::transparent ); painter.setPen( Qt::NoPen ); painter.setBrush( m_color ); painter.setRenderHints( EWAApplication::getRenderHints() ); painter.setOpacity(0.5); painter.drawRoundedRect( roundedRect, 5, 5, Qt::AbsoluteSize ); }
RoundedRect RenderStyle::getRoundedInnerBorderFor(const LayoutRect& borderRect, int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const { LayoutRect innerRect(borderRect.x() + leftWidth, borderRect.y() + topWidth, borderRect.width() - leftWidth - rightWidth, borderRect.height() - topWidth - bottomWidth); RoundedRect roundedRect(pixelSnappedIntRect(innerRect)); if (hasBorderRadius()) { RoundedRect::Radii radii = getRoundedBorderFor(borderRect).radii(); radii.shrink(topWidth, bottomWidth, leftWidth, rightWidth); roundedRect.includeLogicalEdges(radii, includeLogicalLeftEdge, includeLogicalRightEdge); } return roundedRect; }
void SearchLineWidget::paintEvent(QPaintEvent *e) { e->accept(); QPainter p(this); p.setRenderHint(QPainter::Antialiasing, true); p.setPen(QColor(211, 215, 224)); QRect roundedRect(e->rect().x(), e->rect().y(), e->rect().width(), e->rect().height()); qreal bottomLeftRadius, bottomRightRadius, topLeftRadius, topRightRadius; bottomLeftRadius = bottomRightRadius = topLeftRadius = topRightRadius = 15; QPainterPath path(QPoint(roundedRect.left(), roundedRect.top() + topLeftRadius)); path.quadTo(roundedRect.left(), roundedRect.top(), roundedRect.left() + topLeftRadius, roundedRect.top()); path.lineTo(roundedRect.right() - topRightRadius, roundedRect.top()); path.quadTo(roundedRect.right(), roundedRect.top(), roundedRect.right(), roundedRect.top() + topRightRadius); path.lineTo(roundedRect.right(), roundedRect.bottom() - bottomRightRadius); path.quadTo(roundedRect.right(), roundedRect.bottom(), roundedRect.right() - bottomRightRadius, roundedRect.bottom()); path.lineTo(roundedRect.left() + bottomLeftRadius, roundedRect.bottom()); path.quadTo(roundedRect.left(), roundedRect.bottom(), roundedRect.left(), roundedRect.bottom() - bottomLeftRadius); path.closeSubpath(); p.drawPath(path); QIcon iconAdvSearch(":/actions/advanced_search"); QIcon iconSearch(":/actions/search"); QRect rectAdvSearch(5, 5, e->rect().height()-10, e->rect().height()-10); iconAdvSearch.paint(&p, rectAdvSearch, Qt::AlignCenter); QRect rectSearch(width()-e->rect().height(), 0, e->rect().height(), e->rect().height()); iconSearch.paint(&p, rectSearch, Qt::AlignCenter); }
void ofxSimpleGuiTitle::draw(float x, float y) { setPos(x, y); if(hasTitle == false) return; glPushMatrix(); glTranslatef(x, y, 0); ofEnableAlphaBlending(); ofFill(); // setTextBGColor(value != NULL); // ofSetHexColor(0, 0, 0); ofSetHexColor(config->fullActiveColor); if(config->rounded) { roundedRect(0, 0, width, height,config->rectRadius); } else { ofRect(0, 0, width, height); } // if a toggle if(value && (*value) && beToggle) { setTextColor(); //ofLine(0, 0, box.width, box.height); //ofLine(box.width, 0, 0, box.height); } setTextColor(value != NULL); ofDrawBitmapString(name, 3, 15); ofDisableAlphaBlending(); glPopMatrix(); }
void LabyrinthParser::mouseMoveEvent(QMouseEvent * e) { __carring = section(__mouse); switch (__carring) { case Qt::BottomSection: case Qt::TopSection: this->setCursor(QCursor(Qt::SizeVerCursor)); break; case Qt::LeftSection: case Qt::RightSection: this->setCursor(QCursor(Qt::SizeHorCursor)); break; case Qt::BottomLeftSection: case Qt::TopRightSection: this->setCursor(QCursor(Qt::SizeBDiagCursor)); break; case Qt::TopLeftSection: case Qt::BottomRightSection: this->setCursor(QCursor(Qt::SizeFDiagCursor)); break; case Qt::TitleBarArea: this->setCursor(QCursor(Qt::SizeAllCursor)); break; case Qt::NoSection: default: this->setCursor(QCursor(Qt::ArrowCursor)); break; } const QPoint delta(e->pos() - __mouse); __mouse = e->pos(); if (e->buttons() & Qt::LeftButton) { switch (__carring) { case Qt::LeftSection: __rect.setLeft(__rect.left() + delta.x()); break; case Qt::RightSection: __rect.setRight(__rect.right() + delta.x()); break; case Qt::TopSection: __rect.setTop(__rect.top() + delta.y()); break; case Qt::BottomSection: __rect.setBottom(__rect.bottom() + delta.y()); break; case Qt::TopLeftSection: __rect.setTopLeft(__rect.topLeft() + delta); break; case Qt::TopRightSection: __rect.setTopRight(__rect.topRight() + delta); break; case Qt::BottomLeftSection: __rect.setBottomLeft(__rect.bottomLeft() + delta); break; case Qt::BottomRightSection: __rect.setBottomRight(__rect.bottomRight() + delta); break; case Qt::TitleBarArea: __rect.moveTo(__rect.topLeft() + delta); break; default: break; } __rect = __rect.normalized(); this->repaint(); const Labyrinth currentLabyrint(Labyrinth::fromImage(__labyrint.copy(roundedRect()))); if (currentLabyrint.size() != QSize()) { emit newLabyrinthAppeared(currentLabyrint); } } }
void QNanoPainter::roundedRect(const QRectF &rect, float radius) { roundedRect(rect.x(), rect.y(), rect.width(), rect.height(), radius); }