Fixed toolbar handle artifacts with certain themes

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1176911 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent a404b1aa1a
commit 26a188969c

@ -576,8 +576,8 @@ void KStyle::drawPrimitive( PrimitiveElement pe,
// Check if we are a normal toolbar or a hidden dockwidget.
if ( parent &&
(parent->inherits("TQToolBar") || // Normal toolbar
(parent->inherits("TQMainWindow")) )) // Collapsed dock
(parent->inherits("QToolBar") || // Normal toolbar
(parent->inherits("QMainWindow")) )) // Collapsed dock
// Draw a toolbar handle
drawKStylePrimitive( KPE_ToolBarHandle, p, widget, r, cg, flags, opt );
@ -988,8 +988,8 @@ int KStyle::pixelMetric(PixelMetric m, const TQWidget* widget) const
// Check that we are not a normal toolbar or a hidden dockwidget,
// in which case we need to adjust the height for font size
if (widget && (parent = widget->parentWidget() )
&& !parent->inherits("TQToolBar")
&& !parent->inherits("TQMainWindow")
&& !parent->inherits("QToolBar")
&& !parent->inherits("QMainWindow")
&& widget->inherits("QDockWindowHandle") )
return widget->fontMetrics().lineSpacing();
else

@ -5,7 +5,7 @@
based on the KDE3 HighColor Style
Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
(C) 2001-2002 Fredrik Höglund <fredrik@kde.org>
(C) 2001-2002 Fredrik H<EFBFBD>glund <fredrik@kde.org>
Drawing routines adapted from the KDE2 HCStyle,
Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
@ -337,17 +337,17 @@ void KeramikStyle::polish(TQApplication* app)
void KeramikStyle::polish(TQWidget* widget)
{
// Put in order of highest occurrence to maximise hit rate
if ( widget->inherits( "TQPushButton" ) || widget->inherits( "TQComboBox" ) || widget->inherits("TQToolButton") )
if ( widget->inherits( "QPushButton" ) || widget->inherits( "QComboBox" ) || widget->inherits("QToolButton") )
{
widget->installEventFilter(this);
if ( widget->inherits( "TQComboBox" ) )
if ( widget->inherits( "QComboBox" ) )
widget->setBackgroundMode( NoBackground );
}
else if ( widget->inherits( "TQMenuBar" ) || widget->inherits( "TQPopupMenu" ) )
else if ( widget->inherits( "QMenuBar" ) || widget->inherits( "QPopupMenu" ) )
widget->setBackgroundMode( NoBackground );
else if ( widget->parentWidget() &&
( ( widget->inherits( "TQListBox" ) && widget->parentWidget()->inherits( "TQComboBox" ) ) ||
( ( widget->inherits( "QListBox" ) && widget->parentWidget()->inherits( "QComboBox" ) ) ||
widget->inherits( "KCompletionBox" ) ) ) {
TQListBox* listbox = (TQListBox*) widget;
listbox->setLineWidth( 4 );
@ -378,17 +378,17 @@ void KeramikStyle::polish(TQWidget* widget)
void KeramikStyle::unPolish(TQWidget* widget)
{
//### TODO: This needs major cleanup (and so does polish() )
if ( widget->inherits( "TQPushButton" ) || widget->inherits( "TQComboBox" ) )
if ( widget->inherits( "QPushButton" ) || widget->inherits( "QComboBox" ) )
{
if ( widget->inherits( "TQComboBox" ) )
if ( widget->inherits( "QComboBox" ) )
widget->setBackgroundMode( PaletteButton );
widget->removeEventFilter(this);
}
else if ( widget->inherits( "TQMenuBar" ) || widget->inherits( "TQPopupMenu" ) )
else if ( widget->inherits( "QMenuBar" ) || widget->inherits( "QPopupMenu" ) )
widget->setBackgroundMode( PaletteBackground );
else if ( widget->parentWidget() &&
( ( widget->inherits( "TQListBox" ) && widget->parentWidget()->inherits( "TQComboBox" ) ) ||
( ( widget->inherits( "QListBox" ) && widget->parentWidget()->inherits( "QComboBox" ) ) ||
widget->inherits( "KCompletionBox" ) ) ) {
TQListBox* listbox = (TQListBox*) widget;
listbox->setLineWidth( 1 );
@ -1230,7 +1230,7 @@ void KeramikStyle::drawKStylePrimitive( KStylePrimitive kpe,
TQToolBar* parent = 0;
if (widget && widget->parent() && widget->parent()->inherits("TQToolBar"))
if (widget && widget->parent() && widget->parent()->inherits("QToolBar"))
parent = static_cast<TQToolBar*>(widget->parent());
renderToolbarEntryBackground(p, parent, r, cg, (flags & Style_Horizontal));
@ -1358,7 +1358,7 @@ void KeramikStyle::drawControl( ControlElement element,
}
else
{
if (widget->parent() && widget->parent()->inherits("TQToolBar"))
if (widget->parent() && widget->parent()->inherits("QToolBar"))
toolbarBlendWidget = widget;
drawPrimitive( PE_ButtonCommand, p, r, cg, flags );
@ -1465,7 +1465,7 @@ void KeramikStyle::drawControl( ControlElement element,
case CE_ToolButtonLabel:
{
//const TQToolButton *toolbutton = static_cast<const TQToolButton * >(widget);
bool onToolbar = widget->parentWidget() && widget->parentWidget()->inherits( "TQToolBar" );
bool onToolbar = widget->parentWidget() && widget->parentWidget()->inherits( "QToolBar" );
TQRect nr = r;
if (!onToolbar)
@ -1536,7 +1536,7 @@ void KeramikStyle::drawControl( ControlElement element,
case CE_DockWindowEmptyArea:
{
TQRect pr = r;
if (widget && widget->inherits("TQToolBar"))
if (widget && widget->inherits("QToolBar"))
{
const TQToolBar* tb = static_cast<const TQToolBar*>(widget);
if (tb->place() == TQDockWindow::OutsideDock)
@ -1975,7 +1975,7 @@ void KeramikStyle::drawComplexControl( ComplexControl control,
{
//Double-buffer only when we are in the slower full-blend mode
if (widget->parent() &&
( widget->parent()->inherits("TQToolBar")|| !qstrcmp(widget->parent()->name(), kdeToolbarWidget) ) )
( widget->parent()->inherits("QToolBar")|| !qstrcmp(widget->parent()->name(), kdeToolbarWidget) ) )
{
buf = new TQPixmap( r.width(), r.height() );
br.setX(0);
@ -2208,10 +2208,10 @@ void KeramikStyle::drawComplexControl( ComplexControl control,
// -------------------------------------------------------------------
case CC_ToolButton: {
const TQToolButton *toolbutton = (const TQToolButton *) widget;
bool onToolbar = widget->parentWidget() && widget->parentWidget()->inherits( "TQToolBar" );
bool onToolbar = widget->parentWidget() && widget->parentWidget()->inherits( "QToolBar" );
bool onExtender = !onToolbar &&
widget->parentWidget() && widget->parentWidget()->inherits( "QToolBarExtensionWidget") &&
widget->parentWidget()->parentWidget()->inherits( "TQToolBar" );
widget->parentWidget()->parentWidget()->inherits( "QToolBar" );
bool onControlButtons = false;
if (!onToolbar && !onExtender && widget->parentWidget() &&
@ -2440,7 +2440,7 @@ TQSize KeramikStyle::sizeFromContents( ContentsType contents,
case CT_ToolButton:
{
bool onToolbar = widget->parentWidget() && widget->parentWidget()->inherits( "TQToolBar" );
bool onToolbar = widget->parentWidget() && widget->parentWidget()->inherits( "QToolBar" );
if (!onToolbar) //Behaves like a button, so scale appropriately to the border
{
int w = contentSize.width();

@ -1898,23 +1898,23 @@ void KLegacyStyle::polish(TQWidget *widget) {
bool immediateRender = false;
bool bgPixmap = false;
if (widget->inherits("TQButton")) {
if (widget->inherits("QButton")) {
metaobject = TQButton::staticMetaObject();
eventFilter = true;
}
if (widget->inherits("TQComboBox")) {
if (widget->inherits("QComboBox")) {
metaobject = TQComboBox::staticMetaObject();
eventFilter = true;
}
if (widget->inherits("TQScrollBar")) {
if (widget->inherits("QScrollBar")) {
metaobject = TQScrollBar::staticMetaObject();
eventFilter = true;
mouseTrack = true;
}
if (widget->inherits("TQMenuBar")) {
if (widget->inherits("QMenuBar")) {
eventFilter = true;
immediateRender = true;
@ -1930,7 +1930,7 @@ void KLegacyStyle::polish(TQWidget *widget) {
widget->setBackgroundMode(TQWidget::PaletteBackground);
}
if (widget->inherits("TQToolBar")) {
if (widget->inherits("QToolBar")) {
metaobject = TQToolBar::staticMetaObject();
eventFilter = true;
@ -1944,7 +1944,7 @@ void KLegacyStyle::polish(TQWidget *widget) {
widget->setBackgroundMode(TQWidget::PaletteBackground);
}
if (widget->inherits("TQLineEdit")) {
if (widget->inherits("QLineEdit")) {
metaobject = TQLineEdit::staticMetaObject();
eventFilter = true;
@ -1968,7 +1968,7 @@ void KLegacyStyle::polish(TQWidget *widget) {
detail = "base";
}
if (widget->inherits("TQPopupMenu")) {
if (widget->inherits("QPopupMenu")) {
qDebug("polishing popup '%s'", widget->className());
metaobject = TQPopupMenu::staticMetaObject();
widget->setBackgroundMode(TQWidget::PaletteBackground);
@ -2544,7 +2544,7 @@ void KLegacyStyle::drawComboButton(TQPainter *p, int x, int y, int w, int h,
key.data.state = KLegacy::Normal;
key.data.shadow = KLegacy::Out;
if (priv->lastWidget && priv->lastWidget->inherits("TQComboBox"))
if (priv->lastWidget && priv->lastWidget->inherits("QComboBox"))
key.data.state = KLegacy::Prelight;
TQPixmap *pix = gobj->draw(key, w, h, "optionmenu");
@ -3081,7 +3081,7 @@ bool KLegacyStyle::eventFilter(TQObject *obj, TQEvent *e) {
{
TQWidget *w = (TQWidget *) obj;
if (w->inherits("TQPopupMenu") && w->width() < 700) {
if (w->inherits("QPopupMenu") && w->width() < 700) {
GtkObject *gobj = priv->gtkDict.find(TQPopupMenu::staticMetaObject());
if (gobj) {
@ -3151,7 +3151,7 @@ bool KLegacyStyle::eventFilter(TQObject *obj, TQEvent *e) {
if (p && (! p->isNull()))
w->setBackgroundPixmap(*p);
}
} else if (w->inherits("TQLineEdit")) {
} else if (w->inherits("QLineEdit")) {
GtkObject *gobj = priv->gtkDict.find(TQLineEdit::staticMetaObject());
if (gobj) {
@ -3191,8 +3191,8 @@ bool KLegacyStyle::eventFilter(TQObject *obj, TQEvent *e) {
w->setPalette(pal);
}
}
} else if (w->inherits("TQMenuBar") ||
w->inherits("TQToolBar")) {
} else if (w->inherits("QMenuBar") ||
w->inherits("QToolBar")) {
GtkObject *gobj = priv->gtkDict.find(TQMenuBar::staticMetaObject());
if (gobj) {
@ -3256,13 +3256,13 @@ bool KLegacyStyle::eventFilter(TQObject *obj, TQEvent *e) {
case TQEvent::Enter:
{
if (obj->inherits("TQPushButton") ||
obj->inherits("TQComboBox") ||
obj->inherits("TQSlider") ||
if (obj->inherits("QPushButton") ||
obj->inherits("QComboBox") ||
obj->inherits("QSlider") ||
obj->inherits("QScrollbar")) {
priv->lastWidget = (TQWidget *) obj;
priv->lastWidget->repaint(false);
} else if (obj->inherits("TQRadioButton")) {
} else if (obj->inherits("QRadioButton")) {
TQWidget *w = (TQWidget *) obj;
if (! w->isTopLevel() && w->isEnabled()) {
@ -3290,7 +3290,7 @@ bool KLegacyStyle::eventFilter(TQObject *obj, TQEvent *e) {
}
}
}
} else if (obj->inherits("TQCheckBox")) {
} else if (obj->inherits("QCheckBox")) {
TQWidget *w = (TQWidget *) obj;
if (! w->isTopLevel() && w->isEnabled()) {
@ -3328,8 +3328,8 @@ bool KLegacyStyle::eventFilter(TQObject *obj, TQEvent *e) {
if (obj == priv->lastWidget) {
priv->lastWidget = 0;
((TQWidget *) obj)->repaint(false);
} else if (obj->inherits("TQRadioButton") ||
obj->inherits("TQCheckBox")) {
} else if (obj->inherits("QRadioButton") ||
obj->inherits("QCheckBox")) {
TQWidget *w = (TQWidget *) obj;
if (! w->isTopLevel()) {
@ -3346,7 +3346,7 @@ bool KLegacyStyle::eventFilter(TQObject *obj, TQEvent *e) {
{
TQMouseEvent *me = (TQMouseEvent *) e;
priv->mousePos = me->pos();
if (obj->inherits("TQScrollBar") &&
if (obj->inherits("QScrollBar") &&
(! (me->state() & (LeftButton | MidButton | RightButton)))) {
priv->hovering = true;
((TQWidget *) obj)->repaint(false);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Loading…
Cancel
Save