[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdeplasma-addons] applets/kimpanel/src: use a transparent widget to workaround background artifects
From: Weng Xuetian <wengxt () gmail ! com>
Date: 2012-08-31 21:04:12
Message-ID: 20120831210412.DD607A60A6 () git ! kde ! org
[Download RAW message or body]
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 which are \
listed at that page.
http://commits.kde.org/kdeplasma-addons/d7379bbd107992e94fa09e8e56586839bd29f3b3
diff --git a/applets/kimpanel/src/CMakeLists.txt \
b/applets/kimpanel/src/CMakeLists.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/dummywidget.cpp new file mode 100644
index 0000000..ae8e2f2
--- /dev/null
+++ b/applets/kimpanel/src/dummywidget.cpp
@@ -0,0 +1,17 @@
+#include "dummywidget.h"
+#include <QPainter>
+#include <QStyleOption>
+
+DummyWidget::DummyWidget(QGraphicsWidget* parent) : QGraphicsWidget(parent)
+{
+ setMinimumSize(0, 0);
+ setMaximumSize(INT_MAX, 1);
+ setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+}
+
+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/dummywidget.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 <wengxt@gmail.com> *
+ * *
+ * 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 <QGraphicsWidget>
+
+class DummyWidget: public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+
+ DummyWidget(QGraphicsWidget* parent = 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 <KIconLoader>
@@ -40,6 +41,7 @@ KimpanelInputPanelGraphics::KimpanelInputPanelGraphics(QGraphicsItem* \
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(QGraphicsItem* \
parent, Qt
m_upperLayout->setSpacing(0);
m_upperLayout->setContentsMargins(0, 0, 0, 0);
- m_upperLayout->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ m_upperLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
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(lookupTablePageUp()));
connect(m_pageDownIcon, SIGNAL(clicked()), this, SIGNAL(lookupTablePageDown()));
connect(KimpanelSettings::self(), SIGNAL(configChanged()), this, \
SLOT(loadSettings())); + connect(m_preeditLabel, SIGNAL(sizeChanged()), this, \
SLOT(updateDummyWidget())); + connect(m_auxLabel, SIGNAL(sizeChanged()), this, \
SLOT(updateDummyWidget())); }
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/kimpanel/src/kimpanelinputpanelgraphics.h index c895645..7b4eebc 100644
--- a/applets/kimpanel/src/kimpanelinputpanelgraphics.h
+++ b/applets/kimpanel/src/kimpanelinputpanelgraphics.h
@@ -26,6 +26,7 @@
#include <QGraphicsLinearLayout>
#include <QSignalMapper>
+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<KimpanelLabelGraphics *> m_tableEntryLabels;
QSignalMapper *m_tableEntryMapper;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic