add tooltipdialog class
Let's try to share more code with dialog -- especially sizing, frame painting and positioning with dialog. This means a bit of rewiring, but should result in more lazy-loaded, shared objects. The idea is to have at most one window, which is recycled for all tooltips, making it possible to animate transitions.
This commit is contained in:
parent
95dddcea35
commit
e48908eb70
@ -19,6 +19,7 @@ set(corebindings_SRCS
|
||||
framesvgitem.cpp
|
||||
dialog.cpp
|
||||
tooltip.cpp
|
||||
tooltipdialog.cpp
|
||||
tooltipwindow.cpp
|
||||
dataenginebindings.cpp
|
||||
iconitem.cpp
|
||||
|
@ -34,8 +34,7 @@
|
||||
#include <kwindoweffects.h>
|
||||
#include <Plasma/Plasma>
|
||||
#include <Plasma/Corona>
|
||||
// #include <Plasma/Dialog>
|
||||
//#include <Plasma/WindowEffects>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
// just for debugging purposes, FIXME: remove later
|
||||
@ -59,7 +58,6 @@ QString locString(const Plasma::Location l) {
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
DialogProxy::DialogProxy(QQuickItem *parent)
|
||||
: QQuickWindow(),
|
||||
m_activeWindow(false),
|
||||
|
@ -160,14 +160,15 @@ protected:
|
||||
void focusInEvent(QFocusEvent *ev);
|
||||
void focusOutEvent(QFocusEvent *ev);
|
||||
|
||||
private:
|
||||
Qt::WindowFlags m_flags;
|
||||
QTimer *m_syncTimer;
|
||||
QWeakPointer<QQuickItem> m_mainItem;
|
||||
QWeakPointer<QQuickItem> m_visualParent;
|
||||
bool m_activeWindow;
|
||||
Plasma::Location m_location;
|
||||
Plasma::FrameSvgItem *m_frameSvgItem;
|
||||
QWeakPointer<QQuickItem> m_mainItem;
|
||||
QWeakPointer<QQuickItem> m_visualParent;
|
||||
|
||||
private:
|
||||
Qt::WindowFlags m_flags;
|
||||
bool m_activeWindow;
|
||||
QRect m_cachedGeometry;
|
||||
};
|
||||
|
||||
|
34
src/declarativeimports/core/tooltipdialog.cpp
Normal file
34
src/declarativeimports/core/tooltipdialog.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
/***************************************************************************
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org> *
|
||||
* *
|
||||
* 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 . *
|
||||
***************************************************************************/
|
||||
|
||||
#include "tooltipdialog.h"
|
||||
|
||||
#include <QQuickItem>
|
||||
#include <QDebug>
|
||||
|
||||
ToolTipDialog::ToolTipDialog(QQuickItem *parent)
|
||||
: DialogProxy(parent)
|
||||
{
|
||||
}
|
||||
|
||||
ToolTipDialog::~ToolTipDialog()
|
||||
{
|
||||
}
|
||||
|
||||
|
51
src/declarativeimports/core/tooltipdialog.h
Normal file
51
src/declarativeimports/core/tooltipdialog.h
Normal file
@ -0,0 +1,51 @@
|
||||
/***************************************************************************
|
||||
* Copyright 2013 Sebastian Kügler <sebas@kde.org> *
|
||||
* *
|
||||
* 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 TOOLTIPDIALOG_H
|
||||
#define TOOLTIPDIALOG_H
|
||||
|
||||
#include "dialog.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QQuickWindow>
|
||||
#include <QWeakPointer>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
class QQuickItem;
|
||||
class QGraphicsWidget;
|
||||
|
||||
/**
|
||||
* QML wrapper for kdelibs Plasma::ToolTipDialog
|
||||
*
|
||||
* Exposed as `ToolTipDialog` in QML.
|
||||
*/
|
||||
class ToolTipDialog : public DialogProxy
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ToolTipDialog(QQuickItem *parent = 0);
|
||||
~ToolTipDialog();
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user