summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/ktoolbarbutton.cpp
Side-by-side diff
Diffstat (limited to 'microkde/kdeui/ktoolbarbutton.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/ktoolbarbutton.cpp106
1 files changed, 60 insertions, 46 deletions
diff --git a/microkde/kdeui/ktoolbarbutton.cpp b/microkde/kdeui/ktoolbarbutton.cpp
index 1d5d0e5..7b98b32 100644
--- a/microkde/kdeui/ktoolbarbutton.cpp
+++ b/microkde/kdeui/ktoolbarbutton.cpp
@@ -35,3 +35,3 @@
#include <qbitmap.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qcursor.h>
@@ -39,2 +39,6 @@
#include <qlayout.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <QMouseEvent>
+#include <QEvent>
@@ -50,3 +54,3 @@
-template class QIntDict<KToolBarButton>;
+template class Q3IntDict<KToolBarButton>;
@@ -117,3 +121,3 @@ KToolBarButton::KToolBarButton( const QString& _icon, int _id,
- setFocusPolicy( NoFocus );
+ setFocusPolicy( Qt::NoFocus );
@@ -148,3 +152,3 @@ KToolBarButton::KToolBarButton( const QPixmap& pixmap, int _id,
- setFocusPolicy( NoFocus );
+ setFocusPolicy( Qt::NoFocus );
@@ -163,3 +167,3 @@ KToolBarButton::KToolBarButton( const QPixmap& pixmap, int _id,
// set our pixmap and do our initial setup
- setIconSet( QIconSet( pixmap ));
+ setIconSet( QIcon( pixmap ));
modeChange();
@@ -294,3 +298,3 @@ void KToolBarButton::setIcon( const QString &icon )
-void KToolBarButton::setIconSet( const QIconSet &iconset )
+void KToolBarButton::setIconSet( const QIcon &iconset )
{
@@ -307,4 +311,4 @@ void KToolBarButton::setPixmap( const QPixmap &pixmap )
}
- QIconSet set = iconSet();
- set.setPixmap( pixmap, QIconSet::Automatic, QIconSet::Active );
+ QIcon set = iconSet();
+ set.setPixmap( pixmap, QIcon::Automatic, QIcon::Active );
QToolButton::setIconSet( set );
@@ -314,4 +318,4 @@ void KToolBarButton::setDefaultPixmap( const QPixmap &pixmap )
{
- QIconSet set = iconSet();
- set.setPixmap( pixmap, QIconSet::Automatic, QIconSet::Normal );
+ QIcon set = iconSet();
+ set.setPixmap( pixmap, QIcon::Automatic, QIcon::Normal );
QToolButton::setIconSet( set );
@@ -321,4 +325,4 @@ void KToolBarButton::setDisabledPixmap( const QPixmap &pixmap )
{
- QIconSet set = iconSet();
- set.setPixmap( pixmap, QIconSet::Automatic, QIconSet::Disabled );
+ QIcon set = iconSet();
+ set.setPixmap( pixmap, QIcon::Automatic, QIcon::Disabled );
QToolButton::setIconSet( set );
@@ -328,3 +332,3 @@ void KToolBarButton::setDefaultIcon( const QString& icon )
{
- QIconSet set = iconSet();
+ QIcon set = iconSet();
QPixmap pm;
@@ -336,3 +340,3 @@ void KToolBarButton::setDefaultIcon( const QString& icon )
d->m_iconSize );
- set.setPixmap( pm, QIconSet::Automatic, QIconSet::Normal );
+ set.setPixmap( pm, QIcon::Automatic, QIcon::Normal );
QToolButton::setIconSet( set );
@@ -342,3 +346,3 @@ void KToolBarButton::setDisabledIcon( const QString& icon )
{
- QIconSet set = iconSet();
+ QIcon set = iconSet();
QPixmap pm;
@@ -350,3 +354,3 @@ void KToolBarButton::setDisabledIcon( const QString& icon )
d->m_iconSize );
- set.setPixmap( pm, QIconSet::Automatic, QIconSet::Disabled );
+ set.setPixmap( pm, QIcon::Automatic, QIcon::Disabled );
QToolButton::setIconSet( set );
@@ -354,3 +358,3 @@ void KToolBarButton::setDisabledIcon( const QString& icon )
-QPopupMenu *KToolBarButton::popup()
+QMenu *KToolBarButton::popup()
{
@@ -361,3 +365,3 @@ QPopupMenu *KToolBarButton::popup()
-void KToolBarButton::setPopup(QPopupMenu *p, bool)
+void KToolBarButton::setPopup(Q3PopupMenu *p, bool)
{
@@ -368,3 +372,3 @@ void KToolBarButton::setPopup(QPopupMenu *p, bool)
-void KToolBarButton::setDelayedPopup (QPopupMenu *p, bool)
+void KToolBarButton::setDelayedPopup (Q3PopupMenu *p, bool)
{
@@ -453,17 +457,23 @@ void KToolBarButton::drawButton( QPainter *_painter )
#ifdef DESKTOP_VERSION
- QStyle::SFlags flags = QStyle::Style_Default;
- QStyle::SCFlags active = QStyle::SC_None;
+ QStyle::State flags = QStyle::State_None;
+ QStyle::SubControls active = QStyle::SC_None;
if (isDown()) {
- flags |= QStyle::Style_Down;
+ flags |= QStyle::State_DownArrow;
active |= QStyle::SC_ToolButton;
}
- if (isEnabled()) flags |= QStyle::Style_Enabled;
- if (isOn()) flags |= QStyle::Style_On;
- if (isEnabled() && d->m_isRaised) flags |= QStyle::Style_Raised;
- if (hasFocus()) flags |= QStyle::Style_HasFocus;
+ if (isEnabled()) flags |= QStyle::State_Enabled;
+ if (isOn()) flags |= QStyle::State_On;
+ if (isEnabled() && d->m_isRaised) flags |= QStyle::State_Raised;
+ if (hasFocus()) flags |= QStyle::State_HasFocus;
+
+ QStyleOptionToolButton qsotb;
+ qsotb.initFrom(this);
+ qsotb.state = flags;
+ qsotb.activeSubControls = active;
+ qsotb.rect = rect();
+ qsotb.palette = palette();
// Draw a styled toolbutton
- style().drawComplexControl(QStyle::CC_ToolButton, _painter, this, rect(),
- colorGroup(), flags, QStyle::SC_ToolButton, active, QStyleOption());
+ style()->drawComplexControl(QStyle::CC_ToolButton, &qsotb, _painter, this);
@@ -486,5 +496,5 @@ void KToolBarButton::drawButton( QPainter *_painter )
*/
- QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic,
- isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) :
- QIconSet::Disabled);
+ QPixmap pixmap = iconSet().pixmap( QIcon::Automatic,
+ isEnabled() ? (d->m_isActive ? QIcon::Active : QIcon::Normal) :
+ QIcon::Disabled);
@@ -510,5 +520,5 @@ void KToolBarButton::drawButton( QPainter *_painter )
*/
- QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic,
- isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) :
- QIconSet::Disabled);
+ QPixmap pixmap = iconSet().pixmap( QIcon::Automatic,
+ isEnabled() ? (d->m_isActive ? QIcon::Active : QIcon::Normal) :
+ QIcon::Disabled);
@@ -528,3 +538,3 @@ void KToolBarButton::drawButton( QPainter *_painter )
{
- textFlags = AlignVCenter|AlignLeft;
+ textFlags = Qt::AlignVCenter|Qt::AlignLeft;
if (!pixmap.isNull())
@@ -546,3 +556,3 @@ void KToolBarButton::drawButton( QPainter *_painter )
{
- textFlags = AlignVCenter|AlignLeft;
+ textFlags = Qt::AlignVCenter|Qt::AlignLeft;
dx = (width() - fm.width(textLabel())) / 2;
@@ -565,5 +575,5 @@ void KToolBarButton::drawButton( QPainter *_painter )
*/
- QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic,
- isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) :
- QIconSet::Disabled);
+ QPixmap pixmap = iconSet().pixmap( QIcon::Automatic,
+ isEnabled() ? (d->m_isActive ? QIcon::Active : QIcon::Normal) :
+ QIcon::Disabled);
@@ -583,3 +593,3 @@ void KToolBarButton::drawButton( QPainter *_painter )
{
- textFlags = AlignBottom|AlignHCenter;
+ textFlags = Qt::AlignBottom|Qt::AlignHCenter;
dx = (width() - fm.width(textLabel())) / 2;
@@ -612,10 +622,14 @@ void KToolBarButton::drawButton( QPainter *_painter )
#ifdef DESKTOP_VERSION
- QStyle::SFlags arrowFlags = QStyle::Style_Default;
+ QStyle::State arrowFlags = QStyle::State_None;
+
+ if (isDown()) arrowFlags |= QStyle::State_DownArrow;
+ if (isEnabled()) arrowFlags |= QStyle::State_Enabled;
- if (isDown()) arrowFlags |= QStyle::Style_Down;
- if (isEnabled()) arrowFlags |= QStyle::Style_Enabled;
+ QStyleOption qso;
+ qso.initFrom(this);
+ qso.state = arrowFlags;
+ qso.rect = QRect(width()-7, height()-7, 7, 7);
+ qso.palette = palette();
- style().drawPrimitive(QStyle::PE_ArrowDown, _painter,
- QRect(width()-7, height()-7, 7, 7), colorGroup(),
- arrowFlags, QStyleOption() );
+ style()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &qso, _painter);
#else