[Development] Cannot use QWindowsVistaStyle::drawPrimitive(PE_PanelItemViewItem ...)

lexxmark lexxmark.dev at gmail.com
Thu Dec 4 23:21:11 CET 2014


Hi everyone,
  I don't know is it bug or not.

I'm developing my custom widget and want to have *style-aware fook&feel*.
I'm trying to draw my item areas using drawPrimitive(PE_PanelItemViewItem
...).

It works fine under Linux (Ubuntu) but failed under Windows [8.1]. After
some investigation I discovered that QWindowsVistaStyle::drawPrimitive
function for PE_PanelItemViewItem element requires widget inherited from
QAbstractItemView.

I thought QStyleOption and derived classed was introduced to encapsulate
all information needed for QStyle class.
QWinget  parameter for QStyle functions declared in Qt documentation as
optional.

But QWindowsVistaStyle::drawPrimitive(PE_PanelItemViewItem totaly breaks
these conventions and cannot be used for custom widgets (not derived from
QAbstractItemView).

If you dig into the QWindowsVistaStyle::drawPrimitive code you will see a
little tune-up code (a few lines) dependent from QAbstractItemView widget (
https://qt.gitorious.org/qt/qt/source/57756e72adf2081137b97f0e689dd16c770d10b1:src/gui/styles/qwindowsvistastyle.cpp#L731).
All other code is general.

I think we should limit QAbstractItemView's check for these few lines only.

-- 
Best regards,
   Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20141205/01f1d30b/attachment.html>


More information about the Development mailing list