Git commit d7379bbd107992e94fa09e8e56586839bd29f3b3 by Weng Xuetian. Committed on 31/08/2012 at 22:52. Pushed by xuetianweng into branch 'master'. use a transparent widget to workaround background artifects bug. M +1 -0 applets/kimpanel/src/CMakeLists.txt A +17 -0 applets/kimpanel/src/dummywidget.cpp [License: UNKNOWN] = * A +37 -0 applets/kimpanel/src/dummywidget.h [License: GPL (v2+)] M +12 -1 applets/kimpanel/src/kimpanelinputpanelgraphics.cpp M +3 -0 applets/kimpanel/src/kimpanelinputpanelgraphics.h The files marked with a * at the end have a non valid license. Please read:= http://techbase.kde.org/Policies/Licensing_Policy and use the headers whic= h are listed at that page. http://commits.kde.org/kdeplasma-addons/d7379bbd107992e94fa09e8e56586839bd2= 9f3b3 diff --git a/applets/kimpanel/src/CMakeLists.txt b/applets/kimpanel/src/CMa= keLists.txt index 2d7863a..e3a7644 100644 --- a/applets/kimpanel/src/CMakeLists.txt +++ b/applets/kimpanel/src/CMakeLists.txt @@ -11,6 +11,7 @@ set(plasma_applet_kimpanel_SRCS kimpanelstatusbargraphics.cpp icongridlayout.cpp paintutils.cpp + dummywidget.cpp ) = kde4_add_ui_files(plasma_applet_kimpanel_SRCS config.ui) diff --git a/applets/kimpanel/src/dummywidget.cpp b/applets/kimpanel/src/du= mmywidget.cpp new file mode 100644 index 0000000..ae8e2f2 --- /dev/null +++ b/applets/kimpanel/src/dummywidget.cpp @@ -0,0 +1,17 @@ +#include "dummywidget.h" +#include +#include + +DummyWidget::DummyWidget(QGraphicsWidget* parent) : QGraphicsWidget(parent) +{ + setMinimumSize(0, 0); + setMaximumSize(INT_MAX, 1); + setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpan= ding); +} + +void DummyWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem = *option, QWidget *widget) +{ + Q_UNUSED(widget); + painter->fillRect(option->rect, QBrush(Qt::transparent)); + // painter->fillRect(option->rect, QBrush(Qt::blue)); +} diff --git a/applets/kimpanel/src/dummywidget.h b/applets/kimpanel/src/dumm= ywidget.h new file mode 100644 index 0000000..5318f1b --- /dev/null +++ b/applets/kimpanel/src/dummywidget.h @@ -0,0 +1,37 @@ +/*************************************************************************= ** + * Copyright (C) 2012 by CSSlayer = * + * = * + * This program is free software; you can redistribute it and/or modify = * + * it under the terms of the GNU General Public License as published by = * + * the Free Software Foundation; either version 2 of the License, or = * + * (at your option) any later version. = * + * = * + * This program is distributed in the hope that it will be useful, = * + * but WITHOUT ANY WARRANTY; without even the implied warranty of = * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the = * + * GNU General Public License for more details. = * + * = * + * You should have received a copy of the GNU General Public License = * + * along with this program; if not, write to the = * + * Free Software Foundation, Inc., = * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . = * + *************************************************************************= **/ + +#ifndef KIMPANEL_DUMMYWIDGET_H +#define KIMPANEL_DUMMYWIDGET_H + +// Qt +#include + +class DummyWidget: public QGraphicsWidget +{ + Q_OBJECT +public: + + DummyWidget(QGraphicsWidget* parent =3D 0); + +protected: + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *= option, QWidget *widget); +}; + +#endif // KIMPANEL_LABELGRAPHICS_H diff --git a/applets/kimpanel/src/kimpanelinputpanelgraphics.cpp b/applets/= kimpanel/src/kimpanelinputpanelgraphics.cpp index 16b2187..1d511fd 100644 --- a/applets/kimpanel/src/kimpanelinputpanelgraphics.cpp +++ b/applets/kimpanel/src/kimpanelinputpanelgraphics.cpp @@ -21,6 +21,7 @@ #include "kimpanelinputpanelgraphics.h" #include "kimpanellabelgraphics.h" #include "kimpanelsettings.h" +#include "dummywidget.h" = // KDE #include @@ -40,6 +41,7 @@ KimpanelInputPanelGraphics::KimpanelInputPanelGraphics(QG= raphicsItem* parent, Qt m_preeditLabel(new KimpanelLabelGraphics(Preedit, this)), m_pageUpIcon(new Plasma::IconWidget(this)), m_pageDownIcon(new Plasma::IconWidget(this)), + m_dummyWidget(new DummyWidget(this)), m_tableEntryMapper(new QSignalMapper(this)), m_lastVisible(false), m_reverse(false), @@ -59,9 +61,10 @@ KimpanelInputPanelGraphics::KimpanelInputPanelGraphics(Q= GraphicsItem* parent, Qt = m_upperLayout->setSpacing(0); m_upperLayout->setContentsMargins(0, 0, 0, 0); - m_upperLayout->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimu= m); + m_upperLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Mini= mum); m_upperLayout->addItem(m_auxLabel); m_upperLayout->addItem(m_preeditLabel); + m_upperLayout->addItem(m_dummyWidget); = m_lowerLayout->setSpacing(0); m_lowerLayout->setContentsMargins(0, 0, 0, 0); @@ -106,6 +109,8 @@ KimpanelInputPanelGraphics::KimpanelInputPanelGraphics(= QGraphicsItem* parent, Qt connect(m_pageUpIcon, SIGNAL(clicked()), this, SIGNAL(lookupTablePageU= p())); connect(m_pageDownIcon, SIGNAL(clicked()), this, SIGNAL(lookupTablePag= eDown())); connect(KimpanelSettings::self(), SIGNAL(configChanged()), this, SLOT(= loadSettings())); + connect(m_preeditLabel, SIGNAL(sizeChanged()), this, SLOT(updateDummyW= idget())); + connect(m_auxLabel, SIGNAL(sizeChanged()), this, SLOT(updateDummyWidge= t())); } = KimpanelInputPanelGraphics::~KimpanelInputPanelGraphics() @@ -292,6 +297,12 @@ void KimpanelInputPanelGraphics::updateVisible() } } = +void KimpanelInputPanelGraphics::updateDummyWidget() +{ + m_dummyWidget->setMinimumHeight(qMax(m_preeditLabel->minimumHeight(), = m_auxLabel->minimumHeight())); + m_dummyWidget->setMaximumHeight(qMax(m_preeditLabel->minimumHeight(), = m_auxLabel->minimumHeight())); +} + bool KimpanelInputPanelGraphics::markedVisible() { return m_lastVisible; diff --git a/applets/kimpanel/src/kimpanelinputpanelgraphics.h b/applets/ki= mpanel/src/kimpanelinputpanelgraphics.h index c895645..7b4eebc 100644 --- a/applets/kimpanel/src/kimpanelinputpanelgraphics.h +++ b/applets/kimpanel/src/kimpanelinputpanelgraphics.h @@ -26,6 +26,7 @@ #include #include = +class DummyWidget; class KimpanelLabelGraphics; namespace Plasma { @@ -76,6 +77,7 @@ protected: = private slots: void loadSettings(); + void updateDummyWidget(); = private: void clearLookupTable(); @@ -110,6 +112,7 @@ private: KimpanelLabelGraphics *m_preeditLabel; Plasma::IconWidget *m_pageUpIcon; Plasma::IconWidget *m_pageDownIcon; + DummyWidget* m_dummyWidget; QList m_tableEntryLabels; = QSignalMapper *m_tableEntryMapper;