On Tue, Jun 12, 2007 at 10:26:23PM +0200, Edwin Leuven wrote:
> some people have complained the math panels cannot be torn-off (bugs 
> 3839 and 3840)
> 
> the attached makes this work for QT_VERSION >= QT_VERSION_CHECK(4, 2, 0)
> 
> perhaps people can give it a try?
> 
> 

> Index: src/frontends/qt4/IconPalette.cpp
> ===================================================================
> --- src/frontends/qt4/IconPalette.cpp (revision 18748)
> +++ src/frontends/qt4/IconPalette.cpp (working copy)
> @@ -28,6 +28,85 @@
>  namespace lyx {
>  namespace frontend {
>  
> +#if QT_VERSION >= 0x040200
> +
> +
> +class MathButton : public QToolButton
> +{
> +public:
> +     MathButton(QWidget * parent = 0);
> +     void mouseReleaseEvent(QMouseEvent *event); 
> +};
> +
> +
> +MathButton::MathButton(QWidget * parent)
> +     : QToolButton(parent)
> +{
> +}
> +
> +
> +void MathButton::mouseReleaseEvent(QMouseEvent *event)
> +{
> +     // this one triggers the action and untoggles the button
> +     QToolButton::mouseReleaseEvent(event);
> +     // this one forwards the event to the parent
> +     QWidget::mouseReleaseEvent(event);
> +}

I'd consider

   event->ignore() 

less obfuscated.

> +QWidget * IconPalette::createWidget(QWidget * parent)
> +{
> +     QWidget * panelwidget_ = new QWidget(parent);
> +     QGridLayout * layout_ = new QGridLayout(panelwidget_);

Why the trailing underscore for automatic variables?

>  
> +// FIXME: this can go when we move to Qt 4.3
> +#define QT_VERSION_CHECK(major, minor, patch) 
> ((major<<16)|(minor<<8)|(patch))
> +
> +#if QT_VERSION >= QT_VERSION_CHECK(4, 2, 0)

Wouldn't that give a 'redefine macro' ith 4.3?

Why not simply using 0x40200?

Andre'

Reply via email to