Skip to content
QtWS25 Last Chance
  • InnerShadow in Qt6

    Unsolved QML and Qt Quick shadow effects qt6 qt5compat
    1
    0 Votes
    1 Posts
    189 Views
    No one has replied
  • Weird shadow map with texture

    Unsolved QML and Qt Quick qt quick 3d texture shadow
    2
    0 Votes
    2 Posts
    213 Views
    J
    If you are trying to create a cube then it looks like your cube data is wrong as you can see from this picture: [image: 2567a1f1-8200-4647-8e5d-026f709ee0a4.png]
  • QScrollBar slider shadow

    Unsolved General and Desktop qscrollbar shadow qt5.9.0
    1
    0 Votes
    1 Posts
    196 Views
    No one has replied
  • QGraphicsDropShadowEffect bug

    Moved Solved Qt for Python qgraphicsdropsh bug pyside6 shadow
    3
    0 Votes
    3 Posts
    548 Views
    EmrecpE
    @SGaist Thanks problem solved! (PySide6 updated to 6.3.1)
  • Applying shadows for multiple objects

    Solved General and Desktop qgraphicseffect shadow c++
    2
    0 Votes
    2 Posts
    434 Views
    eyllanescE
    Well unfortunately you will have to create an "effect"" for each widget
  • 0 Votes
    6 Posts
    871 Views
    H
    Fixed. Use QQuickView instead of QQuickWidget
  • Remove shadow from QTabWidget

    Solved General and Desktop shadow border qtabwidget
    3
    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
    6k 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
  • Draw shadow in the top of the widget.

    Unsolved General and Desktop qwidget qpainter shadow
    1
    0 Votes
    1 Posts
    677 Views
    No one has replied
  • 0 Votes
    3 Posts
    2k 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
    951 Views
    X
    Will BorderImage work?
  • 0 Votes
    1 Posts
    827 Views
    No one has replied
  • 0 Votes
    1 Posts
    2k Views
    No one has replied