[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bplasma-mobile=5D_=3A__a_button_to_close_the_keyboar?=
From: Marco Martin <notmart () gmail ! com>
Date: 2011-02-15 18:29:58
Message-ID: 20110215182958.7A842A60CE () git ! kde ! org
[Download RAW message or body]
Git commit 19b9b6cc9cecd676f513e8db7df0be1c5f535a5d by Marco Martin.
Committed on 26/08/2010 at 15:40.
Pushed by mart into branch 'master'.
a button to close the keyboard
svn path=/trunk/playground/base/plasma/shells/keyboardcontainer/; revision=1168359
M +23 -8 singleview.cpp
M +2 -0 singleview.h
http://commits.kde.org/scratch/mart/plasma-mobile/19b9b6cc9cecd676f513e8db7df0be1c5f535a5d
diff --git a/singleview.cpp b/singleview.cpp
index cb28f2b..afb7d23 100644
--- a/singleview.cpp
+++ b/singleview.cpp
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU Library 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.
+ * 51 Franklin Street, Fifth Floor, Boston, MA \
02110-1m_closeButton->size().height()1, USA.
*/
#include "singleview.h"
@@ -36,6 +36,7 @@
#include <Plasma/PopupApplet>
#include <Plasma/Corona>
#include <Plasma/Containment>
+#include <Plasma/PushButton>
SingleView::SingleView(Plasma::Corona *corona, Plasma::Containment *containment, \
const QString &pluginName, int appletId, const QVariantList &appletArgs, QWidget \
*parent) : QGraphicsView(parent),
@@ -81,15 +82,27 @@ SingleView::SingleView(Plasma::Corona *corona, \
Plasma::Containment *containment, QDesktopWidget *desktop = QApplication::desktop();
QRect screenGeom = desktop->screenGeometry(desktop->screenNumber(this));
- setFixedHeight(static_cast<Plasma::PopupApplet \
*>(applet())->graphicsWidget()->effectiveSizeHint(Qt::PreferredSize).height()+1); + \
m_closeButton = new Plasma::PushButton(); + m_closeButton->setText(i18n("close"));
+ m_closeButton->setIcon(KIcon("window-close"));
+ m_corona->addItem(m_closeButton);
+ connect(m_closeButton, SIGNAL(clicked()), this, SLOT(hide()));
+
+
+
+ setFixedHeight(static_cast<Plasma::PopupApplet \
*>(applet())->graphicsWidget()->effectiveSizeHint(Qt::PreferredSize).height() + \
m_closeButton->size().height()); setFixedWidth(screenGeom.width());
move(screenGeom.left(), screenGeom.height() - height());
+
+ m_closeButton->setPos(size().width() - m_closeButton->size().width(), \
m_applet->pos().y() - m_closeButton->size().height()); +
show();
}
SingleView::~SingleView()
{
delete m_applet;
+ delete m_closeButton;
}
@@ -177,9 +190,9 @@ void SingleView::updateGeometry()
if (m_applet->size().toSize() != transformedSize()) {
if (m_applet) {
- m_applet->resize(transformedSize());
+ m_applet->resize(transformedSize() - QSize(0, \
m_closeButton->size().height())); }
- setSceneRect(m_applet->geometry());
+ setSceneRect(m_applet->geometry().adjusted(0, \
-m_closeButton->size().height(), 0 ,0)); }
}
@@ -219,30 +232,32 @@ void SingleView::setDirection(const Plasma::Direction \
direction) switch (direction) {
case Plasma::Down:
setRotation(180);
- setFixedHeight(static_cast<Plasma::PopupApplet \
*>(applet())->graphicsWidget()->effectiveSizeHint(Qt::PreferredSize).height()+1); + \
setFixedHeight(static_cast<Plasma::PopupApplet \
*>(applet())->graphicsWidget()->effectiveSizeHint(Qt::PreferredSize).height()+m_closeButton->size().height());
setFixedWidth(screenGeom.width());
move(screenGeom.left(), screenGeom.top());
break;
case Plasma::Left:
setRotation(270);
- setFixedWidth(static_cast<Plasma::PopupApplet \
*>(applet())->graphicsWidget()->effectiveSizeHint(Qt::PreferredSize).height()+1); + \
setFixedWidth(static_cast<Plasma::PopupApplet \
*>(applet())->graphicsWidget()->effectiveSizeHint(Qt::PreferredSize).height()+m_closeButton->size().height());
setFixedHeight(screenGeom.width());
move(screenGeom.right() - width(), screenGeom.top());
break;
case Plasma::Right:
setRotation(90);
- setFixedWidth(static_cast<Plasma::PopupApplet \
*>(applet())->graphicsWidget()->effectiveSizeHint(Qt::PreferredSize).height()+1); + \
setFixedWidth(static_cast<Plasma::PopupApplet \
*>(applet())->graphicsWidget()->effectiveSizeHint(Qt::PreferredSize).height()+m_closeButton->size().height());
setFixedHeight(screenGeom.width());
move(screenGeom.left(), screenGeom.top());
break;
case Plasma::Up:
default:
setRotation(0);
- setFixedHeight(static_cast<Plasma::PopupApplet \
*>(applet())->graphicsWidget()->effectiveSizeHint(Qt::PreferredSize).height()+1); + \
setFixedHeight(static_cast<Plasma::PopupApplet \
*>(applet())->graphicsWidget()->effectiveSizeHint(Qt::PreferredSize).height()+m_closeButton->size().height());
setFixedWidth(screenGeom.width());
move(screenGeom.left(), screenGeom.height() - height());
break;
}
+
+ m_closeButton->setPos(size().width() - m_closeButton->size().width(), \
m_applet->pos().y() - m_closeButton->size().height()); }
Plasma::Direction SingleView::direction() const
diff --git a/singleview.h b/singleview.h
index 5699144..ef0587d 100644
--- a/singleview.h
+++ b/singleview.h
@@ -30,6 +30,7 @@ namespace Plasma
class Containment;
class Applet;
class Corona;
+ class PushButton;
} // namespace Plasma
class SingleView;
@@ -71,6 +72,7 @@ private:
Plasma::Containment *m_containment;
Plasma::Corona *m_corona;
Plasma::Direction m_direction;
+ Plasma::PushButton *m_closeButton;
int m_rotation;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic