From kde-commits Mon Aug 31 23:49:15 2009 From: =?utf-8?q?Aaron=20J=2E=20Seigo?= Date: Mon, 31 Aug 2009 23:49:15 +0000 To: kde-commits Subject: KDE/kdebase/workspace/plasma/shells/common/widgetsExplorer Message-Id: <1251762555.630901.9464.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=125176257004520 SVN commit 1017946 by aseigo: selection; painting still cutting off M +2 -2 appleticon.cpp M +18 -10 appletslist.cpp M +7 -0 appletslist.h --- trunk/KDE/kdebase/workspace/plasma/shells/common/widgetsExplorer/appleticon.cpp #1017945:1017946 @@ -124,8 +124,8 @@ const int width = size().width(); const int height = size().height(); - QRect iconRect((width - m_iconHeight) / 2, 0, m_iconHeight, m_iconHeight); - painter->drawPixmap(iconRect, m_appletItem->icon().pixmap(iconRect.size())); + QRect iconRect(qMax(0, (width / 2) - (m_iconHeight / 2)), 0, m_iconHeight, m_iconHeight); + painter->drawPixmap(iconRect, m_appletItem->icon().pixmap(m_iconHeight, m_iconHeight)); QRectF textRect(0, iconRect.bottom() + 2, width, height - iconRect.bottom()); painter->drawText(textRect, Qt::AlignTop | Qt::AlignCenter | Qt::TextWordWrap, m_appletItem->text()); --- trunk/KDE/kdebase/workspace/plasma/shells/common/widgetsExplorer/appletslist.cpp #1017945:1017946 @@ -19,19 +19,21 @@ */ #include "appletslist.h" -#include "widgetexplorer.h" #include -#include -#include -#include +#include -#include -#include +#include +#include +#include -#include +#include +#include +#include +#include "widgetexplorer.h" + #define ICON_SIZE 70 #define FILTER_APPLIANCE_DELAY 400 #define SEARCH_DELAY 300 @@ -42,7 +44,9 @@ using namespace KCategorizedItemsViewModels; AppletsListWidget::AppletsListWidget(Qt::Orientation orientation, QGraphicsItem *parent) - :QGraphicsWidget(parent) + : QGraphicsWidget(parent), + m_selectionIndicator(new Plasma::ItemBackground(this)), + m_hoverIndicator(new Plasma::ItemBackground(this)) { arrowClickStep = 0; wheelStep = 0; @@ -299,7 +303,7 @@ void AppletsListWidget::appletIconHoverEnter(AppletIconWidget *applet) { - if(!m_toolTip->isVisible()) { + if (!m_toolTip->isVisible()) { m_toolTip->setAppletIconWidget(applet); m_toolTipAppearTimer.start(TOOLTIP_APPEAR_DELAY, this); } else { @@ -313,6 +317,8 @@ } m_toolTipDisappearTimer.stop(); } + + m_hoverIndicator->setTargetItem(applet); } void AppletsListWidget::appletIconHoverLeave(AppletIconWidget *applet) @@ -411,11 +417,13 @@ void AppletsListWidget::itemSelected(AppletIconWidget *applet) { - if(m_selectedItem) { + if (m_selectedItem) { m_selectedItem->setSelected(false); } + applet->setSelected(true); m_selectedItem = applet; + m_selectionIndicator->setTargetItem(m_selectedItem); } void AppletsListWidget::appletIconDoubleClicked(AppletIconWidget *applet) --- trunk/KDE/kdebase/workspace/plasma/shells/common/widgetsExplorer/appletslist.h #1017945:1017946 @@ -33,6 +33,11 @@ #include "appleticon.h" #include "applettooltip.h" +namespace Plasma +{ + class ItemBackground; +} // namespace Plasma + class AppletsListWidget : public QGraphicsWidget { @@ -155,6 +160,8 @@ //One single tootip to show applets info AppletToolTipWidget *m_toolTip; + Plasma::ItemBackground *m_selectionIndicator; + Plasma::ItemBackground *m_hoverIndicator; QStandardItemModel *m_modelItems;