Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsEffect on Mac OS X does not work with QWidgets
Forum Updated to NodeBB v4.3 + New Features

QGraphicsEffect on Mac OS X does not work with QWidgets

Scheduled Pinned Locked Moved General and Desktop
6 Posts 5 Posters 5.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    njeisecke
    wrote on last edited by
    #1

    Hi!

    I've been playing around with setting a QGraphicsBlurEffect on a simple widget.

    This works on Linux and Windows but does not work on Mac OS X.

    I got it working (somehow) by using -graphicssystem raster, but this is not a really an option for Mac OS X because of various painting artefacts (shouldn't raster become default on Mac OS X with Qt 4.7?)

    The docs do not mention anything about limitations on Mac OS X and event google doesn't know.

    I've prepared a small example. Simply a blurred button:

    @
    #include <QtGui>

    int main(int argc, char **argv)
    {
    QApplication app(argc, argv);

    QPushButton *b = new QPushButton("I should be a blurry button on any platform");
    QGraphicsBlurEffect *e = new QGraphicsBlurEffect(b);
    b->setGraphicsEffect(e);

    b->show();

    return app.exec();
    }
    @

    Does anybody have any idea?

    Thanks,

    Nils

    1 Reply Last reply
    0
    • frankcyblogic.deF Offline
      frankcyblogic.deF Offline
      frankcyblogic.de
      wrote on last edited by
      #2

      Oh, that is new to me, that it works with widgets (especially with top-level once). By the way the raster engine is said to become the default with 4.8, although there are still many bugs:http://bugreports.qt.nokia.com/browse/QTBUG-12615 .

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mcohoon
        wrote on last edited by
        #3

        Have you had any success resolving this? I've been using 4.6.* and have not been able to get QGraphicsEffect to work properly, does 4.7 do any better?

        1 Reply Last reply
        0
        • N Offline
          N Offline
          njeisecke
          wrote on last edited by
          #4

          With 4.8 the effect works on Mac OS X (thank to Alien Widgets, I guess):

          @
          #include <QtGui>

          int main(int argc, char **argv)
          {
          QApplication app(argc, argv);

          QWidget *w = new QWidget;
          QHBoxLayout *l = new QHBoxLayout(w);

          QPushButton *b = new QPushButton("I should be a blurry button on any platform");
          QGraphicsBlurEffect *e = new QGraphicsBlurEffect(b);
          b->setGraphicsEffect(e);

          l->addWidget(b);

          w->show();

          return app.exec();
          }
          @

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jimmytfp
            wrote on last edited by
            #5

            Hi,
            This crashes on my 4.8.1 installation.
            Jimmy

            System Version: OS X 10.8 (12A269)
            Kernel Version: Darwin 12.0.0
            Boot Volume: maine
            Boot Mode: Normal
            Computer Name: air-jimmy
            User Name: jimmy (jimmy)
            Secure Virtual Memory: Enabled
            Time since boot: 20:43

            1 Reply Last reply
            0
            • B Offline
              B Offline
              Bargonaut
              wrote on last edited by
              #6

              I also can not use any QGraphicsEffects on OS X without it crashing.
              It runs just fine if I don't set the QGraphicsEffect on the QPushButton,
              but if I do, it crashes as soon as it tries to draw/paint.
              Qt 4.8.3

              This is the error displayed at runtime:
              QPainter::begin: Widget painting can only begin as a result of a paintEvent
              QPainter::translate: Painter not active
              The program has unexpectedly finished.

              ///////////////////////////////////////////////////////////////////////////////////
              Process: QGE_Test [68591]
              Path: /Users/USER/*/QGE_Test.app/Contents/MacOS/QGE_Test
              Identifier: com.yourcompany.QGE_Test
              Version: ??? (???)
              Code Type: X86-64 (Native)
              Parent Process: Qt Creator [67145]

              Date/Time: 2012-11-12 12:46:01.941 -0800
              OS Version: Mac OS X 10.7.4 (11E53)
              Report Version: 9

              Interval Since Last Report: 256420 sec
              Crashes Since Last Report: 13
              Per-App Interval Since Last Report: 4 sec
              Per-App Crashes Since Last Report: 1
              Anonymous UUID: 0B870E43-6B86-4D58-BEE4-896207A07B53

              Crashed Thread: 0 Dispatch queue: com.apple.main-thread

              Exception Type: EXC_BAD_ACCESS (SIGSEGV)
              Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000

              VM Regions Near 0:
              -->
              __TEXT 0000000100000000-0000000100003000 [ 12K] r-x/rwx SM=COW /Users/USER/*/QGE_Test.app/Contents/MacOS/QGE_Test

              Application Specific Information:
              objc[68591]: garbage collection is OFF

              Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
              0 QtGui 0x0000000100706d78 QGraphicsBlurEffect::draw(QPainter*) + 72
              1 QtGui 0x00000001000e43cf QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) + 2607
              2 QtGui 0x00000001000e4b34 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) + 1460
              3 QtGui 0x00000001000e3e50 QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) + 1200
              4 QtGui 0x00000001000337da -[QCocoaView drawRect:] + 1786
              5 com.apple.AppKit 0x00007fff8d9eb97a -[NSView _drawRect:clip:] + 3758
              6 com.apple.AppKit 0x00007fff8da18b4f -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1583
              7 com.apple.AppKit 0x00007fff8da18f7b -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2651
              8 com.apple.AppKit 0x00007fff8d9e8f55 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 1032
              9 com.apple.AppKit 0x00007fff8d9e844f -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 270
              10 com.apple.AppKit 0x00007fff8d9e386f -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 4755
              11 com.apple.AppKit 0x00007fff8d9dc2ed -[NSView displayIfNeeded] + 1676
              12 com.apple.AppKit 0x00007fff8da999ab -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 1306
              13 com.apple.AppKit 0x00007fff8da993a8 -[NSWindow _doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 807
              14 com.apple.AppKit 0x00007fff8da9902c -[NSWindow orderWindow:relativeTo:] + 154
              15 com.apple.AppKit 0x00007fff8da988cd -[NSWindow makeKeyAndOrderFront:] + 49
              16 QtGui 0x000000010002a253 QWidgetPrivate::show_sys() + 1123
              17 QtGui 0x00000001000eabd8 QWidgetPrivate::show_helper() + 408
              18 QtGui 0x00000001000eaf0f QWidget::setVisible(bool) + 511
              19 com.yourcompany.QGE_Test 0x0000000100002ab7 QWidget::show() + 39 (qwidget.h:494)
              20 com.yourcompany.QGE_Test 0x00000001000028da main + 970 (main.cpp:20)
              21 com.yourcompany.QGE_Test 0x00000001000024e4 start + 52

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved