[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdesdk/kate/app
From: Dominik Haumann <dhdev () gmx ! de>
Date: 2007-03-18 11:35:45
Message-ID: 1174217745.950439.18192.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 643768 by dhaumann:
make the tooltip work, fix the drop down 'new session' button
M +7 -4 katesession.cpp
M +39 -8 katetooltipmenu.cpp
M +29 -3 katetooltipmenu.h
--- trunk/KDE/kdesdk/kate/app/katesession.cpp #643767:643768
@@ -587,15 +587,16 @@
KateSession::Ptr session;
};
-KateSessionChooser::KateSessionChooser (QWidget *parent, const QString &lastSession, \
const QList<KateSessionChooserTemplate> &templates)
- : KDialog ( parent )
+KateSessionChooser::KateSessionChooser (QWidget *parent, const QString &lastSession,
+ const QList<KateSessionChooserTemplate> \
&templates) + : KDialog ( parent )
, m_templates(templates)
{
setCaption( i18n ("Session Chooser") );
setButtons( User1 | User2 | User3 );
setButtonGuiItem( User1, KStandardGuiItem::quit() );
setButtonGuiItem( User2, KGuiItem (i18n ("Open Session"), "document-open") );
- setButtonGuiItem( User3, KGuiItem ((templates.count() > 1) ? i18n ("New Session \
(hold down for template)") : i18n ("New Session"), "document-new") ); + \
setButtonGuiItem( User3, KGuiItem (i18n ("New Session"), "document-new") );
setDefaultButton(KDialog::User2);
setEscapeButton(KDialog::User1);
@@ -653,9 +654,11 @@
connect(this, SIGNAL(user3Clicked()), this, SLOT(slotUser3()));
enableButton (KDialog::User2, true);
m_popup = new KateToolTipMenu(this);
+ if (templates.count() > 1)
+ button(KDialog::User3)->setMenu(m_popup);
+
connect(m_popup, SIGNAL(aboutToShow()), this, SLOT(slotProfilePopup()));
connect(m_popup, SIGNAL(triggered(QAction *)), this, \
SLOT(slotTemplateAction(QAction*)));
- setButtonMenu(KDialog::User3, m_popup, KDialog::DelayedPopup);
}
KateSessionChooser::~KateSessionChooser ()
--- trunk/KDE/kdesdk/kate/app/katetooltipmenu.cpp #643767:643768
@@ -1,3 +1,23 @@
+/* This file is part of the KDE project
+ Copyright (C) 2007 Christoph Cullmann <cullmann@kde.org>
+ Copyright (C) 2005 Joseph Wenninger <jowenn@kde.org>
+ Copyright (C) 2007 Dominik Haumann <dhaumann@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
#include "katetooltipmenu.h"
#include "katetooltipmenu.moc"
@@ -8,9 +28,11 @@
#include <QDesktopWidget>
#include <kdebug.h>
-KateToolTipMenu::KateToolTipMenu(QWidget *parent): QMenu(parent), \
m_currentAction(0), m_toolTip(0) +KateToolTipMenu::KateToolTipMenu(QWidget *parent)
+ : QMenu(parent), m_currentAction(0), m_toolTip(0)
{
connect(this, SIGNAL(hovered(QAction*)), this, SLOT(slotHovered(QAction*)));
+ connect(this, SIGNAL(aboutToHide()), this, SLOT(hideToolTip()));
}
KateToolTipMenu::~KateToolTipMenu()
@@ -43,15 +65,19 @@
m_toolTip = 0;
return;
}
- if (!m_toolTip) m_toolTip = new QLabel(this, Qt::ToolTip);
+ if (!m_toolTip)
+ {
+ m_toolTip = new QLabel(this, Qt::ToolTip);
+ m_toolTip->setFrameStyle(QFrame::Box | QFrame::Plain);
+ }
m_toolTip->setText(m_currentAction->toolTip());
- QRect fg = frameGeometry();
+
+ QRect fg = actionGeometry(a);
+ fg.moveTo(frameGeometry().topLeft() + fg.topLeft());
m_toolTip->ensurePolished();
m_toolTip->resize(m_toolTip->sizeHint());
m_toolTip->setPalette(QToolTip::palette());
- kDebug() << "fg.left" << fg.left() << endl;
- kDebug() << "m_tooltip->width()" << m_toolTip->width() << endl;
- kDebug() << "xpos" << fg.left() - m_toolTip->width() << endl;
+
QRect fgl = m_toolTip->frameGeometry();
QRect dr = QApplication::desktop()->availableGeometry(this);
int posx;
@@ -64,10 +90,15 @@
posy = fg.bottom() - fgl.height();
else
posy = fg.top();
- //m_toolTip->move(fg.left()-m_toolTip->width(),fg.top());
+
m_toolTip->move(posx, posy);
m_toolTip->show();
+}
+void KateToolTipMenu::hideToolTip()
+{
+ delete m_toolTip;
+ m_toolTip = 0;
}
+
// kate: space-indent on; indent-width 2; replace-tabs on;
-
--- trunk/KDE/kdesdk/kate/app/katetooltipmenu.h #643767:643768
@@ -1,25 +1,51 @@
+/* This file is part of the KDE project
+ Copyright (C) 2007 Christoph Cullmann <cullmann@kde.org>
+ Copyright (C) 2005 Joseph Wenninger <jowenn@kde.org>
+ Copyright (C) 2007 Dominik Haumann <dhaumann@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
#ifndef _KATE_TOOLTIP_MENU_
#define _KATE_TOOLTIP_MENU_
+
#include <QMenu>
class QLabel;
+/**
+ * Menu with tooltips on the current hovered item.
+ */
class KateToolTipMenu: public QMenu
{
Q_OBJECT
public:
- KateToolTipMenu(QWidget *parent = 0);
+ explicit KateToolTipMenu(QWidget *parent = 0);
virtual ~KateToolTipMenu();
+
protected:
virtual bool event(QEvent*);
+
private:
QAction *m_currentAction;
QLabel *m_toolTip;
+
private Q_SLOTS:
void slotHovered(QAction*);
+ void hideToolTip();
};
-
#endif
// kate: space-indent on; indent-width 2; replace-tabs on;
-
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic