Leuven, E. <[EMAIL PROTECTED]> writes:

> 
> > Maybe you just forgot to relaunch CMake so that MyStyle.cpp is
> > included in your MSVC project (or Makefile)?
> 
> if i subclass QWindowsStyle then things are ok (but i don 't think the mac
people are gonna like this ... 
> 

Maybe not, from Qt4.3 docs:

| The QMacStyle class provides a Mac OS X style using the Apple Appearance 
| Manager. More...
| 
|  #include <QMacStyle>
| 
| Inherits QWindowsStyle.
| 

QStyle is an abstract class, you should either subclass QMacStyle,
QWindowsStyle, or QCommonStyle, or delegate all calls to another style.

Eg.

class QStyleAdapter : public QStyle
{
public QStyleAdapter(const QStyle* delegate) : QStyle(), m_delegate(delegate) {}

int pixelMetric(PixelMetric metric, const QStyleOption * option, const QWidget *
widget) const
{
        return m_delegate->pixelMetric(metric, option, widget);
}

....
} // class StyleAdapter


and then:

class MyStyle : public QStyleAdapter
{

public:
   MyStyle() : QStyleAdapter(QApplication::style()) {}


int MyStyle::pixelMetric(PixelMetric metric, const QStyleOption * option, const
QWidget * widget) const
{
        if (metric == QStyle::PM_MenuTearoffHeight)
                return 10;
        return QStyleAdapter::pixelMetric(metric, option, widget);
}
}



/Andreas

Reply via email to