Skip to content
  • 0 Votes
    6 Posts
    2k Views
    SGaistS

    The idea is that you have your container widget getting resized and in its resize event, you change the size of the inner widgets with the ratio you want.

  • 0 Votes
    5 Posts
    3k Views
    A

    @marcbf said in Remember window size before maximization (or Detect if QResizeEvent is maximization):

    int w = currentSize.width();
    int h = currentSize.height();

    if (restoresize)
    {
    w = qMax(settings["Width"].Value(0), w);
    h = qMax(settings["Height"].Value(0), h);
    }

    Man, this is the deal!!! Everything worked perfectly after I fine tuned your code to my context! Thank you very much.

    The trick was really to use normalGeometry and windowState, so these two are the answer to my question.

  • 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; }