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. Example from class QStyle's detailed description showing how to draw focus rect doesn't work

Example from class QStyle's detailed description showing how to draw focus rect doesn't work

Scheduled Pinned Locked Moved Unsolved General and Desktop
qstylefocus rectmacosqt 6.4
4 Posts 2 Posters 446 Views
  • 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.
  • S Offline
    S Offline
    Sky Lian
    wrote on 3 Apr 2023, 18:11 last edited by Sky Lian 4 Mar 2023, 18:12
    #1

    macOS 13.2.1
    Qt 6.4.2

    MyWidget::MyWidget() :
        QWidget()
    {
        setFocusPolicy(Qt::StrongFocus);
        setAttribute(Qt::WA_MacShowFocusRect);
    }
    
    void MyWidget::paintEvent(QPaintEvent *event) {
            QStylePainter painter(this);
    
            QStyleOptionFocusRect option;
            option.initFrom(this);
            option.backgroundColor = Qt::darkCyan;
    
            painter.drawPrimitive(QStyle::PE_FrameFocusRect, option);
    }
    
    S 1 Reply Last reply 3 Apr 2023, 18:42
    0
    • S Sky Lian
      3 Apr 2023, 18:11

      macOS 13.2.1
      Qt 6.4.2

      MyWidget::MyWidget() :
          QWidget()
      {
          setFocusPolicy(Qt::StrongFocus);
          setAttribute(Qt::WA_MacShowFocusRect);
      }
      
      void MyWidget::paintEvent(QPaintEvent *event) {
              QStylePainter painter(this);
      
              QStyleOptionFocusRect option;
              option.initFrom(this);
              option.backgroundColor = Qt::darkCyan;
      
              painter.drawPrimitive(QStyle::PE_FrameFocusRect, option);
      }
      
      S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 3 Apr 2023, 18:42 last edited by
      #2

      Hi and welcome to devnet,

      Can you check whether you have the same issue with 6.5.0 that was just released ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply 11 Apr 2023, 12:02
      0
      • S SGaist
        3 Apr 2023, 18:42

        Hi and welcome to devnet,

        Can you check whether you have the same issue with 6.5.0 that was just released ?

        S Offline
        S Offline
        Sky Lian
        wrote on 11 Apr 2023, 12:02 last edited by
        #3

        @SGaist
        I checked, and the problem remains, even if MyWidget inherits QLabel.

        S 1 Reply Last reply 11 Apr 2023, 19:16
        0
        • S Sky Lian
          11 Apr 2023, 12:02

          @SGaist
          I checked, and the problem remains, even if MyWidget inherits QLabel.

          S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 11 Apr 2023, 19:16 last edited by
          #4

          Looks like you may have unearthed a bug.

          You should check the bug report system to see if there's something already about it and if not please open a new ticket providing your findings.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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