Skip to content
Browse files

Load icon for chainview buttons correctly. Looks like crap though. :-)

  • Loading branch information...
1 parent 14f5b12 commit c3d58871ad2e766fa806cb3091126f0ae47fc68a @laudrup committed
Showing with 1 addition and 23 deletions.
  1. +1 −22 creox/crbutton.cpp
  2. +0 −1 creox/crbutton.h
View
23 creox/crbutton.cpp
@@ -139,9 +139,7 @@ void CrButton::drawButton(QPainter* painter)
//if (isOn())
// option.features |= QStyleOptionButton::DefaultButton;
option.text = text();
- KIconLoader* const iconLoader = KIconLoader::global();
- option.icon = iconLoader->loadIcon(m_iconName, KIconLoader::NoGroup, KIconLoader::SizeSmall,
- KIconLoader::DefaultState);
+ option.icon = KIcon(m_iconName);
//QPainter painter(this);
style()->drawControl(QStyle::CE_PushButton, &option, painter, this);
@@ -154,25 +152,6 @@ void CrButton::drawButton(QPainter* painter)
//drawButtonLabel(painter);
}
-void CrButton::drawButtonLabel(QPainter* painter)
-{
- //drawIcon
- if(!m_iconName.isNull()){
- KIconLoader* const iconLoader = KIconLoader::global();
- const int state = (isOn()) ? KIconLoader::DefaultState : KIconLoader::DisabledState;
- const QPixmap icon = iconLoader->loadIcon(m_iconName, KIconLoader::NoGroup,
- KIconLoader::SizeSmall, state);
- const QPoint point(ICON_HOFFSET, (height() - icon.height())/2);
- painter->drawPixmap(point, icon);
- }
- if(!text().isNull()){
- const int hOffset = ICON_HOFFSET + m_iconWidth + TEXT_HOFFSET ;
- const QRect textRect(hOffset, 0, width() - hOffset - ICON_HOFFSET, height());
- painter->setPen(colorGroup().buttonText());
- painter->drawText(textRect, Qt::AlignLeft|Qt::AlignVCenter, text());
- }
-}
-
void CrButton::setIcon(const QString& iconName)
{
m_iconName = iconName;
View
1 creox/crbutton.h
@@ -44,7 +44,6 @@ class CrButton : public QAbstractButton {
void setIntermediateState(const bool on);
virtual void paintEvent(QPaintEvent* event);
virtual void drawButton(QPainter* painter);
- virtual void drawButtonLabel(QPainter* painter);
private:
QString m_iconName;

0 comments on commit c3d5887

Please sign in to comment.
Something went wrong with that request. Please try again.