Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-44667

QGraphicsDropShadowEffect and winId() weird behaviour

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: P2: Important P2: Important
    • None
    • 4.8.6
    • None
    • Windows 8.1 + Visual Studio 2008 SP1 + Qt 4.8.6

      The following code produces strange looking results when the window is resized (the image is attached).

      mainwindow.cpp
      MainWindow::MainWindow()
      {
      	QGraphicsDropShadowEffect * effect = new QGraphicsDropShadowEffect;
      	effect->setBlurRadius(2);
      	effect->setOffset(0, 5);
      	effect->setColor(QColor::fromRgbF(0, 0, 0, 0.25));
      
      	QToolBar *toolbar = new QToolBar;
      	toolbar->setMovable(false);
      	toolbar->setFloatable(false);
      	toolbar->setAutoFillBackground(true);
      	toolbar->setGraphicsEffect(effect);	// want a shadow under toolbar (1)
      	
      	QToolButton *tb1 = new QToolButton;
      	tb1->setText("Button 1");
      	
      	QToolButton *tb2 = new QToolButton;
      	tb2->setText("Button 2");
      	
      	QToolButton *tb3 = new QToolButton;
      	tb3->setText("Button 3");
      
      	QWidget *widg = new QWidget;
      	widg->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
      	QHBoxLayout *lay = new QHBoxLayout;
      	lay->setContentsMargins(0,0,0,0);
      	lay->addWidget(tb1);
      	lay->addWidget(tb2);
      	lay->addStretch(1);
      	lay->addWidget(tb3);
      	widg->setLayout(lay);
      	toolbar->addWidget(widg);
      
      	addToolBar(Qt::TopToolBarArea, toolbar);
      
      
      	QFrame *wnd = new QFrame;	
      	wnd->winId();	// i need a win id (2)
      	setCentralWidget(wnd);
      
      	//resize(800, 600);
      }
      

      In order to see the bug the window must be resized.

      Removing either (1) or (2) eliminates the issue.

        1. bug.png
          10 kB
          Pugach Yaroslav
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            mmutz Marc Mutz
            mentalmushroom Pugach Yaroslav
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes