rid ourselves of the Q3Buttons
svn path=/trunk/KDE/kdebase/kwin/; revision=449967
This commit is contained in:
parent
8f209fb84f
commit
5da7024486
16 changed files with 61 additions and 13 deletions
|
@ -625,6 +625,11 @@ void KDEDefaultButton::setBitmap(const unsigned char *bitmap)
|
|||
}
|
||||
}
|
||||
|
||||
void KDEDefaultButton::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter p(this);
|
||||
drawButton(&p);
|
||||
}
|
||||
|
||||
void KDEDefaultButton::drawButton(QPainter *p)
|
||||
{
|
||||
|
|
|
@ -60,6 +60,7 @@ class KDEDefaultButton : public KCommonDecorationButton
|
|||
protected:
|
||||
void enterEvent(QEvent *);
|
||||
void leaveEvent(QEvent *);
|
||||
void paintEvent(QPaintEvent *);
|
||||
void drawButton(QPainter *p);
|
||||
void drawButtonLabel(QPainter*) {;}
|
||||
|
||||
|
|
|
@ -299,6 +299,12 @@ void LaptopButton::setBitmap(const unsigned char *bitmap)
|
|||
repaint();
|
||||
}
|
||||
|
||||
void LaptopButton::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter p(this);
|
||||
drawButton(&p);
|
||||
}
|
||||
|
||||
void LaptopButton::drawButton(QPainter *p)
|
||||
{
|
||||
bool smallBtn = width() == btnWidth1;
|
||||
|
|
|
@ -24,6 +24,7 @@ public:
|
|||
virtual void reset(unsigned long changed);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
virtual void drawButton(QPainter *p);
|
||||
QBitmap deco;
|
||||
};
|
||||
|
|
|
@ -350,6 +350,12 @@ void ModernButton::setBitmap(const unsigned char *bitmap)
|
|||
deco.setMask(deco);
|
||||
}
|
||||
|
||||
void ModernButton::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter p(this);
|
||||
drawButton(&p);
|
||||
}
|
||||
|
||||
void ModernButton::drawButton(QPainter *p)
|
||||
{
|
||||
if(decoration()->isActive()){
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
void setBitmap(const unsigned char *bitmap);
|
||||
virtual void reset(unsigned long changed);
|
||||
protected:
|
||||
|
||||
void paintEvent(QPaintEvent *);
|
||||
virtual void drawButton(QPainter *p);
|
||||
void drawButtonLabel(QPainter *){;}
|
||||
QBitmap deco;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
// #include <kwin/options.h>
|
||||
|
||||
#include <Q3Button>
|
||||
#include <QAbstractButton>
|
||||
#include <qbitmap.h>
|
||||
#include <qpainter.h>
|
||||
#include <qpixmap.h>
|
||||
|
@ -146,7 +146,7 @@ void PlastikButton::animate()
|
|||
|
||||
void PlastikButton::enterEvent(QEvent *e)
|
||||
{
|
||||
Q3Button::enterEvent(e);
|
||||
QAbstractButton::enterEvent(e);
|
||||
|
||||
hover = true;
|
||||
animate();
|
||||
|
@ -154,12 +154,18 @@ void PlastikButton::enterEvent(QEvent *e)
|
|||
|
||||
void PlastikButton::leaveEvent(QEvent *e)
|
||||
{
|
||||
Q3Button::leaveEvent(e);
|
||||
QAbstractButton::leaveEvent(e);
|
||||
|
||||
hover = false;
|
||||
animate();
|
||||
}
|
||||
|
||||
void PlastikButton::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter p(this);
|
||||
drawButton(&p);
|
||||
}
|
||||
|
||||
void PlastikButton::drawButton(QPainter *painter)
|
||||
{
|
||||
QRect r(0,0,width(),height());
|
||||
|
|
|
@ -47,6 +47,9 @@ public:
|
|||
protected slots:
|
||||
void animate();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
|
||||
private:
|
||||
void enterEvent(QEvent *e);
|
||||
void leaveEvent(QEvent *e);
|
||||
|
|
|
@ -444,6 +444,12 @@ void QuartzButton::setBitmap(const unsigned char *bitmap)
|
|||
}
|
||||
}
|
||||
|
||||
void QuartzButton::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter p(this);
|
||||
drawButton(&p);
|
||||
}
|
||||
|
||||
void QuartzButton::drawButton(QPainter *p)
|
||||
{
|
||||
// Never paint if the pixmaps have not been created
|
||||
|
|
|
@ -58,6 +58,7 @@ class QuartzButton : public KCommonDecorationButton
|
|||
void reset(unsigned long changed);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
void drawButton(QPainter *p);
|
||||
|
||||
QBitmap* deco;
|
||||
|
|
|
@ -300,6 +300,11 @@ void RedmondButton::setPixmap( const QPixmap &p )
|
|||
repaint(false);
|
||||
}
|
||||
|
||||
void RedmondButton::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter p(this);
|
||||
drawButton(&p);
|
||||
}
|
||||
|
||||
void RedmondButton::drawButton(QPainter *p)
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
void reset(unsigned long changed);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
virtual void drawButton(QPainter *p);
|
||||
void drawButtonLabel(QPainter *){;}
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ WebButton::enterEvent(QEvent * e)
|
|||
{
|
||||
mouseOver_ = true;
|
||||
repaint();
|
||||
Q3Button::enterEvent(e);
|
||||
QAbstractButton::enterEvent(e);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -138,7 +138,13 @@ WebButton::leaveEvent(QEvent * e)
|
|||
{
|
||||
mouseOver_ = false;
|
||||
repaint();
|
||||
Q3Button::leaveEvent(e);
|
||||
QAbstractButton::leaveEvent(e);
|
||||
}
|
||||
|
||||
void WebButton::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter p(this);
|
||||
drawButton(&p);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -52,6 +52,7 @@ namespace Web
|
|||
|
||||
void enterEvent(QEvent *);
|
||||
void leaveEvent(QEvent *);
|
||||
void paintEvent(QPaintEvent *);
|
||||
void drawButton(QPainter *p);
|
||||
|
||||
private:
|
||||
|
|
|
@ -872,7 +872,7 @@ QRect KCommonDecoration::titleRect() const
|
|||
|
||||
|
||||
KCommonDecorationButton::KCommonDecorationButton(ButtonType type, KCommonDecoration *parent, const char *name)
|
||||
: Q3Button(parent->widget(), name),
|
||||
: QAbstractButton(parent->widget(), name),
|
||||
m_decoration(parent),
|
||||
m_type(type),
|
||||
m_realizeButtons(Qt::LeftButton),
|
||||
|
@ -933,14 +933,14 @@ void KCommonDecorationButton::setTipText(const QString &tip) {
|
|||
|
||||
void KCommonDecorationButton::setToggleButton(bool toggle)
|
||||
{
|
||||
Q3Button::setToggleButton(toggle);
|
||||
QAbstractButton::setToggleButton(toggle);
|
||||
reset(ToggleChange);
|
||||
}
|
||||
|
||||
void KCommonDecorationButton::setOn(bool on)
|
||||
{
|
||||
if (on != isOn() ) {
|
||||
Q3Button::setOn(on);
|
||||
QAbstractButton::setOn(on);
|
||||
reset(StateChange);
|
||||
}
|
||||
}
|
||||
|
@ -952,7 +952,7 @@ void KCommonDecorationButton::mousePressEvent(QMouseEvent* e)
|
|||
QMouseEvent me(e->type(), e->pos(), e->globalPos(),
|
||||
(e->button()&m_realizeButtons)?Qt::LeftButton : Qt::NoButton, e->state());
|
||||
|
||||
Q3Button::mousePressEvent(&me);
|
||||
QAbstractButton::mousePressEvent(&me);
|
||||
}
|
||||
|
||||
void KCommonDecorationButton::mouseReleaseEvent(QMouseEvent* e)
|
||||
|
@ -962,5 +962,5 @@ void KCommonDecorationButton::mouseReleaseEvent(QMouseEvent* e)
|
|||
QMouseEvent me(e->type(), e->pos(), e->globalPos(),
|
||||
(e->button()&m_realizeButtons)?Qt::LeftButton : Qt::NoButton, e->state());
|
||||
|
||||
Q3Button::mouseReleaseEvent(&me);
|
||||
QAbstractButton::mouseReleaseEvent(&me);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#ifndef KCOMMONDECORATION_H
|
||||
#define KCOMMONDECORATION_H
|
||||
|
||||
#include <Q3Button>
|
||||
#include <QAbstractButton>
|
||||
#include "kdecoration.h"
|
||||
|
||||
class KDecorationBridge;
|
||||
|
@ -285,7 +285,7 @@ class KWIN_EXPORT KCommonDecoration : public KDecoration
|
|||
/**
|
||||
* Title bar buttons of KCommonDecoration need to inherit this class.
|
||||
*/
|
||||
class KWIN_EXPORT KCommonDecorationButton : public Q3Button
|
||||
class KWIN_EXPORT KCommonDecorationButton : public QAbstractButton
|
||||
{
|
||||
friend class KCommonDecoration;
|
||||
|
||||
|
|
Loading…
Reference in a new issue