Review Request 114271: drawFloatFrame for QtQuick menus

Martin Gräßlin mgraesslin at kde.org
Wed Dec 4 06:43:29 UTC 2013



> On Dec. 3, 2013, 3:26 p.m., David Edmundson wrote:
> > kstyles/oxygen/oxygenstyle.cpp, line 2558
> > <http://git.reviewboard.kde.org/r/114271/diff/1/?file=222357#file222357line2558>
> >
> >     in other cases in this file I've done:
> >     
> >     if (option->styleObject->inherits("QQuickStyleItem" ) ) 
> >     which leaves widget code unchanged
> >     
> >     we use inherits not qobject_cast so we don't have an extra dependency on QtQuick in the style.
> >
> 
> David Edmundson wrote:
>     NINJA EDIT: You would need to guard on option->styleObject being null before calling that.
> 
> Martin Gräßlin wrote:
>     :-( doesn't work - seems to not inherit QQuickStyleItem in this case

I found a solution to make it work: patch Qt

diff --git a/src/controls/Private/qquickstyleitem.cpp b/src/controls/Private/qquickstyleitem.cpp
index a14a22d..4aa8ff2 100644
--- a/src/controls/Private/qquickstyleitem.cpp
+++ b/src/controls/Private/qquickstyleitem.cpp
@@ -1578,6 +1578,7 @@ void QQuickStyleItem::paint(QPainter *painter)
             frame.lineWidth = fw;
             frame.midLineWidth = 0;
             frame.rect = m_styleoption->rect;
+            frame.styleObject = this;
             qApp->style()->drawPrimitive(QStyle::PE_FrameMenu, &frame, painter);
         }
     }


- Martin


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/114271/#review45037
-----------------------------------------------------------


On Dec. 3, 2013, 2:57 p.m., Martin Gräßlin wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/114271/
> -----------------------------------------------------------
> 
> (Updated Dec. 3, 2013, 2:57 p.m.)
> 
> 
> Review request for Plasma, David Edmundson and Hugo Pereira Da Costa.
> 
> 
> Repository: kde-workspace
> 
> 
> Description
> -------
> 
> drawFrameMenuPrimitive is entered with a null QWidget if a QQuickMenu is rendered. By handling this case we get the menu to render with a frame. Unfortunately we cannot render the widget background as that really needs a non-null QWidget and we also do not yet get shadows.
> 
> 
> Diffs
> -----
> 
>   kstyles/oxygen/oxygenstyle.cpp 50c217f 
> 
> Diff: http://git.reviewboard.kde.org/r/114271/diff/
> 
> 
> Testing
> -------
> 
> I'm not sure whether this can affect other areas if QWidget is null.
> 
> 
> File Attachments
> ----------------
> 
> QtQuick menu with fix
>   http://git.reviewboard.kde.org/media/uploaded/files/2013/12/03/32336a9f-5bd7-4f47-974f-3420882f7cc3__qml-menu-fixed.png
> QtQuick menu without fix
>   http://git.reviewboard.kde.org/media/uploaded/files/2013/12/03/45e57c8b-324d-4d9a-8fc8-52211f2e8f8d__qml-menu-broken.png
> 
> 
> Thanks,
> 
> Martin Gräßlin
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20131204/9b78bd25/attachment.html>


More information about the Plasma-devel mailing list