Skip to content

QtWS: Super Early Bird Tickets Available!

  • InnerShadow in Qt6

    Unsolved QML and Qt Quick
    1
    0 Votes
    1 Posts
    90 Views
    No one has replied
  • 0 Votes
    1 Posts
    91 Views
    No one has replied
  • 0 Votes
    1 Posts
    145 Views
    No one has replied
  • 0 Votes
    3 Posts
    408 Views
    EmrecpE

    @SGaist Thanks problem solved! (PySide6 updated to 6.3.1)

  • 0 Votes
    2 Posts
    345 Views
    eyllanescE

    Well unfortunately you will have to create an "effect"" for each widget

  • 0 Votes
    6 Posts
    664 Views
    H

    Fixed. Use QQuickView instead of QQuickWidget

  • 0 Votes
    3 Posts
    3k Views
    gde23G

    @mrjj

    Thx for the hint

    setStyleSheet("QTabWidget::pane {border-bottom: 0px;}");

    did the trick

  • 0 Votes
    3 Posts
    2k Views
    J.HilkJ

    Ok,

    I'll mark this as solved.

    I wasn't able to do it with QGraphicsDropShadowEffect, and creating all images twice and including them in the rcs-file is simply a no go.

    Therefore I create a function, that draws a shadow - all 4 sides - around the the QImages, either at startup or during runtime.

    Here it is, in case anyone else needs something like it.

    QImage drawShadow(QImage img) { //Condition img allready has a transparent border 4 Pixel in this case //Create new Img with same Size QImage imgBGround(img.size(), img.format()); //Fill it with transparency QPainter p(&imgBGround); QPen pen; pen.setStyle(Qt::NoPen); p.setPen(pen); p.setRenderHint(QPainter::Antialiasing); p.fillRect(QRect(0,0,img.width(), img.height()), QColor(255,255,255,0)); //Draw Rounded Rectangle as Shadow QPainterPath path; path.addRoundedRect(QRect(0,0,img.width(), img.height()),15,15); p.fillPath(path,QColor(110,152,226)); p.drawPath(path); //Draw Original Img over background p.drawImage(0,0,img); return imgBGround; }
  • 0 Votes
    7 Posts
    5k Views
    IMAN4KI

    Ok.
    It might get better in the future !

    If you wan to get ride of QGraphicsDropShadowEffect :

    void drawShadow(QPainter &_painter, qint16 _margin, qreal _radius, QColor _start, QColor _end, qreal _startPosition, qreal _endPosition0, qreal _endPosition1, qreal _width, qreal _height) { _painter.setPen(Qt::NoPen); QLinearGradient gradient; gradient.setColorAt(_startPosition, _start); gradient.setColorAt(_endPosition0, _end); // Right QPointF right0(_width - _margin, _height / 2); QPointF right1(_width, _height / 2); gradient.setStart(right0); gradient.setFinalStop(right1); _painter.setBrush(QBrush(gradient)); _painter.drawRoundRect(QRectF(QPointF(_width - _margin*_radius, _margin), QPointF(_width, _height - _margin)), 0.0, 0.0); // Left QPointF left0(_margin, _height / 2); QPointF left1(0, _height / 2); gradient.setStart(left0); gradient.setFinalStop(left1); _painter.setBrush(QBrush(gradient)); _painter.drawRoundRect(QRectF(QPointF(_margin *_radius, _margin), QPointF(0, _height - _margin)), 0.0, 0.0); // Top QPointF top0(_width / 2, _margin); QPointF top1(_width / 2, 0); gradient.setStart(top0); gradient.setFinalStop(top1); _painter.setBrush(QBrush(gradient)); _painter.drawRoundRect(QRectF(QPointF(_width - _margin, 0), QPointF(_margin, _margin)), 0.0, 0.0); // Bottom QPointF bottom0(_width / 2, _height - _margin); QPointF bottom1(_width / 2, _height); gradient.setStart(bottom0); gradient.setFinalStop(bottom1); _painter.setBrush(QBrush(gradient)); _painter.drawRoundRect(QRectF(QPointF(_margin, _height - _margin), QPointF(_width - _margin, _height)), 0.0, 0.0); // BottomRight QPointF bottomright0(_width - _margin, _height - _margin); QPointF bottomright1(_width, _height); gradient.setStart(bottomright0); gradient.setFinalStop(bottomright1); gradient.setColorAt(_endPosition1, _end); _painter.setBrush(QBrush(gradient)); _painter.drawRoundRect(QRectF(bottomright0, bottomright1), 0.0, 0.0); // BottomLeft QPointF bottomleft0(_margin, _height - _margin); QPointF bottomleft1(0, _height); gradient.setStart(bottomleft0); gradient.setFinalStop(bottomleft1); gradient.setColorAt(_endPosition1, _end); _painter.setBrush(QBrush(gradient)); _painter.drawRoundRect(QRectF(bottomleft0, bottomleft1), 0.0, 0.0); // TopLeft QPointF topleft0(_margin, _margin); QPointF topleft1(0, 0); gradient.setStart(topleft0); gradient.setFinalStop(topleft1); gradient.setColorAt(_endPosition1, _end); _painter.setBrush(QBrush(gradient)); _painter.drawRoundRect(QRectF(topleft0, topleft1), 0.0, 0.0); // TopRight QPointF topright0(_width - _margin, _margin); QPointF topright1(_width, 0); gradient.setStart(topright0); gradient.setFinalStop(topright1); gradient.setColorAt(_endPosition1, _end); _painter.setBrush(QBrush(gradient)); _painter.drawRoundRect(QRectF(topright0, topright1), 0.0, 0.0); // Widget _painter.setBrush(QBrush("#FFFFFF")); _painter.setRenderHint(QPainter::Antialiasing); _painter.drawRoundRect(QRectF(QPointF(_margin, _margin), QPointF(_width - _margin, _height - _margin)), _radius, _radius); }

    drawShadow(painter, 10, 2.0, QColor(120, 120, 120, 32), QColor(255, 255, 255, 0), 0.0, 1.0, 0.6, width(), height());
    don't forget setAttribute(Qt::WA_TranslucentBackground);
    Final Resualt : https://onedrive.live.com/?cid=8882d1e3bc0f61ab&id=8882D1E3BC0F61AB!7415&authkey=!AH66ZieCJDqvXhk

  • 0 Votes
    1 Posts
    628 Views
    No one has replied
  • 0 Votes
    3 Posts
    1k Views
    C

    @hpollak

    As I mentioned, I tried assigning different Tumbler style properties like:
    background: Rectangle
    {
    color: white
    }

    and the same with foreground and frame style components
    I also tried to set border.width to 0 and still I got this shadow near the borders

  • 0 Votes
    2 Posts
    893 Views
    X

    Will BorderImage work?

  • 0 Votes
    1 Posts
    764 Views
    No one has replied
  • 0 Votes
    1 Posts
    2k Views
    No one has replied