On Thu, Jun 14, 2007 at 02:26:57PM +0200, Leuven, E. wrote: > > i subclass qstyle to increase the height of the tear-off as follows: > > class MyStyle : public QStyle > { > public: > MyStyle() {} > int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, > const QWidget * widget = 0) const; > }; > > > int MyStyle::pixelMetric(PixelMetric metric, const QStyleOption * option, > const QWidget * widget) const > { > if (metric == QStyle::PM_MenuTearoffHeight) > return 10; > return QStyle::pixelMetric(metric, option, widget); > } > > > but i get a link error: > > 2>frontend_qt4.lib(QLToolbar.obj) : error LNK2019: unresolved external symbol > "__declspec(dllimport) public: virtual int __thiscall > QStyle::pixelMetric(enum QStyle::PixelMetric,class QStyleOption const *,class > QWidget const *)const " ([EMAIL PROTECTED]@@[EMAIL > PROTECTED]@PBVQStyleOption@@PBVQWidget@@@Z) referenced in function "public: > virtual int __thiscall lyx::frontend::MyStyle::pixelMetric(enum > QStyle::PixelMetric,class QStyleOption const *,class QWidget const *)const " > ([EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL > PROTECTED]@@PBVQStyleOption@@PBVQWidget@@@Z) > 2>C:\lyx\build-msvc\bin\Release\lyx-qt4.exe : fatal error LNK1120: 1 > unresolved externals > > > someone knows what i am doing wrong?
Yes. QStyle::pixelMetric is pure virtual without implementation. To do what you want you need to derive from a concrete style, which, of course is not very practical since you do not know what style a user uses. I think the solution are style sheets but I've never used them myself. Andre'