forked from qt-creator/qt-creator
Tooltip: Remove TipFactory
It's not really used as such. Change-Id: Ia748cdb5273d661dfea9f8f39a17a872d3ee4de6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -1,58 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/legal
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Digia. For licensing terms and
|
|
||||||
** conditions see http://qt.digia.com/licensing. For further information
|
|
||||||
** use the contact form at http://qt.digia.com/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Digia gives you certain additional
|
|
||||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "tipfactory.h"
|
|
||||||
#include "tipcontents.h"
|
|
||||||
#include "tips.h"
|
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
|
|
||||||
using namespace Utils;
|
|
||||||
using namespace Internal;
|
|
||||||
|
|
||||||
TipFactory::TipFactory()
|
|
||||||
{}
|
|
||||||
|
|
||||||
TipFactory::~TipFactory()
|
|
||||||
{}
|
|
||||||
|
|
||||||
Internal::QTipLabel *TipFactory::createTip(const TipContent &content, QWidget *w)
|
|
||||||
{
|
|
||||||
if (content.typeId() == TextContent::TEXT_CONTENT_ID)
|
|
||||||
return new TextTip(w);
|
|
||||||
if (content.typeId() == ColorContent::COLOR_CONTENT_ID)
|
|
||||||
return new ColorTip(w);
|
|
||||||
if (content.typeId() == WidgetContent::WIDGET_CONTENT_ID)
|
|
||||||
return new WidgetTip(w);
|
|
||||||
|
|
||||||
QTC_CHECK(false);
|
|
||||||
return 0;
|
|
||||||
}
|
|
@@ -1,55 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/legal
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Digia. For licensing terms and
|
|
||||||
** conditions see http://qt.digia.com/licensing. For further information
|
|
||||||
** use the contact form at http://qt.digia.com/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Digia gives you certain additional
|
|
||||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef TIPFACTORY_H
|
|
||||||
#define TIPFACTORY_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
namespace Utils {
|
|
||||||
|
|
||||||
class TipContent;
|
|
||||||
|
|
||||||
namespace Internal {
|
|
||||||
class QTipLabel;
|
|
||||||
|
|
||||||
class TipFactory
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TipFactory();
|
|
||||||
virtual ~TipFactory();
|
|
||||||
Q_DISABLE_COPY(TipFactory)
|
|
||||||
|
|
||||||
virtual QTipLabel *createTip(const TipContent &content, QWidget *w);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Utils
|
|
||||||
|
|
||||||
#endif // TIPFACTORY_H
|
|
@@ -30,7 +30,6 @@
|
|||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
#include "tips.h"
|
#include "tips.h"
|
||||||
#include "tipcontents.h"
|
#include "tipcontents.h"
|
||||||
#include "tipfactory.h"
|
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
#include "reuse.h"
|
#include "reuse.h"
|
||||||
|
|
||||||
@@ -41,6 +40,7 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
#include <QWidget>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
ToolTip::ToolTip() : m_tipFactory(new TipFactory), m_tip(0), m_widget(0)
|
ToolTip::ToolTip() : m_tip(0), m_widget(0)
|
||||||
{
|
{
|
||||||
connect(&m_showTimer, SIGNAL(timeout()), this, SLOT(hideTipImmediately()));
|
connect(&m_showTimer, SIGNAL(timeout()), this, SLOT(hideTipImmediately()));
|
||||||
connect(&m_hideDelayTimer, SIGNAL(timeout()), this, SLOT(hideTipImmediately()));
|
connect(&m_hideDelayTimer, SIGNAL(timeout()), this, SLOT(hideTipImmediately()));
|
||||||
@@ -57,7 +57,6 @@ ToolTip::ToolTip() : m_tipFactory(new TipFactory), m_tip(0), m_widget(0)
|
|||||||
ToolTip::~ToolTip()
|
ToolTip::~ToolTip()
|
||||||
{
|
{
|
||||||
m_tip = 0;
|
m_tip = 0;
|
||||||
delete m_tipFactory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolTip *ToolTip::instance()
|
ToolTip *ToolTip::instance()
|
||||||
@@ -69,12 +68,23 @@ ToolTip *ToolTip::instance()
|
|||||||
void ToolTip::show(const QPoint &pos, const TipContent &content, QWidget *w, const QRect &rect)
|
void ToolTip::show(const QPoint &pos, const TipContent &content, QWidget *w, const QRect &rect)
|
||||||
{
|
{
|
||||||
if (acceptShow(content, pos, w, rect)) {
|
if (acceptShow(content, pos, w, rect)) {
|
||||||
#ifndef Q_OS_WIN
|
QWidget *target = 0;
|
||||||
m_tip = m_tipFactory->createTip(content, w);
|
if (HostOsInfo::isWindowsHost())
|
||||||
#else
|
target = QApplication::desktop()->screen(Internal::screenNumber(pos, w));
|
||||||
m_tip = m_tipFactory->createTip(
|
else
|
||||||
content, QApplication::desktop()->screen(Internal::screenNumber(pos, w)));
|
target = w;
|
||||||
#endif
|
|
||||||
|
switch (content.typeId()) {
|
||||||
|
case TextContent::TEXT_CONTENT_ID:
|
||||||
|
m_tip = new TextTip(target);
|
||||||
|
break;
|
||||||
|
case ColorContent::COLOR_CONTENT_ID:
|
||||||
|
m_tip = new ColorTip(target);
|
||||||
|
break;
|
||||||
|
case WidgetContent::WIDGET_CONTENT_ID:
|
||||||
|
m_tip = new WidgetTip(target);
|
||||||
|
break;
|
||||||
|
}
|
||||||
setUp(pos, content, w, rect);
|
setUp(pos, content, w, rect);
|
||||||
qApp->installEventFilter(this);
|
qApp->installEventFilter(this);
|
||||||
showTip();
|
showTip();
|
||||||
|
@@ -53,11 +53,7 @@ class QWidget;
|
|||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
namespace Internal { class QTipLabel; }
|
||||||
namespace Internal {
|
|
||||||
class TipFactory;
|
|
||||||
class QTipLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
class TipContent;
|
class TipContent;
|
||||||
|
|
||||||
@@ -95,7 +91,6 @@ private:
|
|||||||
void showTip();
|
void showTip();
|
||||||
void hideTipWithDelay();
|
void hideTipWithDelay();
|
||||||
|
|
||||||
Internal::TipFactory *m_tipFactory;
|
|
||||||
Internal::QTipLabel *m_tip;
|
Internal::QTipLabel *m_tip;
|
||||||
QWidget *m_widget;
|
QWidget *m_widget;
|
||||||
QRect m_rect;
|
QRect m_rect;
|
||||||
|
@@ -84,7 +84,6 @@ SOURCES += $$PWD/environment.cpp \
|
|||||||
$$PWD/tooltip/tooltip.cpp \
|
$$PWD/tooltip/tooltip.cpp \
|
||||||
$$PWD/tooltip/tips.cpp \
|
$$PWD/tooltip/tips.cpp \
|
||||||
$$PWD/tooltip/tipcontents.cpp \
|
$$PWD/tooltip/tipcontents.cpp \
|
||||||
$$PWD/tooltip/tipfactory.cpp \
|
|
||||||
$$PWD/unixutils.cpp
|
$$PWD/unixutils.cpp
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
@@ -174,7 +173,6 @@ HEADERS += \
|
|||||||
$$PWD/tooltip/tipcontents.h \
|
$$PWD/tooltip/tipcontents.h \
|
||||||
$$PWD/tooltip/reuse.h \
|
$$PWD/tooltip/reuse.h \
|
||||||
$$PWD/tooltip/effects.h \
|
$$PWD/tooltip/effects.h \
|
||||||
$$PWD/tooltip/tipfactory.h \
|
|
||||||
$$PWD/unixutils.h
|
$$PWD/unixutils.h
|
||||||
|
|
||||||
FORMS += $$PWD/filewizardpage.ui \
|
FORMS += $$PWD/filewizardpage.ui \
|
||||||
|
@@ -188,8 +188,6 @@ QtcLibrary {
|
|||||||
"reuse.h",
|
"reuse.h",
|
||||||
"tipcontents.cpp",
|
"tipcontents.cpp",
|
||||||
"tipcontents.h",
|
"tipcontents.h",
|
||||||
"tipfactory.cpp",
|
|
||||||
"tipfactory.h",
|
|
||||||
"tips.cpp",
|
"tips.cpp",
|
||||||
"tips.h",
|
"tips.h",
|
||||||
"tooltip.cpp",
|
"tooltip.cpp",
|
||||||
|
Reference in New Issue
Block a user