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

no member named 'init' in 'QStyleOption'

    XMLWordPrintable

Details

    • All
    • d6bdc5e9b (dev), 16d67bcb3 (6.4), b8eeb2d68 (6.5), df8cf211c (tqtc/lts-6.2)
    • DaVinci 74

    Description

      Hello, on https://doc.qt.io/qt-6/stylesheet-reference.html#list-of-stylable-widgets, in the QWidget cell, one reads

       

      Supports only the background, background-clip and background-origin properties.

      If you subclass from QWidget, you need to provide a paintEvent for your custom QWidget as below:
      void CustomWidget::paintEvent(QPaintEvent *)

      { [QStyleOption|https://doc.qt.io/qt-6/qstyleoption.html] opt; opt.init(this); [QPainter|https://doc.qt.io/qt-6/qpainter.html] p(this); style()->drawPrimitive([QStyle|https://doc.qt.io/qt-6/qstyle.html]::PE_Widget, &opt, &p, this); }

      opt.init(this); should read opt.initFrom(this). QStyleOption has no init() member in either Qt5 or Qt6.

      Attachments

        For Gerrit Dashboard: QTBUG-107770
        # Subject Branch Project Status CR V

        Activity

          People

            andreas.eliasson Andreas Eliasson
            delaune Olivier Delaune
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There is 1 open Gerrit change