Utils: Move reuse.h out of sight

It caused a deprecation warning in each user. The warning itself
is not gone but appears less often now.

Change-Id: I03a995897635a182fa254fa574ccbfbfc7515f1a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-07-04 16:02:09 +02:00
parent 8d84e2f2e1
commit 6e4d0a70e9
7 changed files with 30 additions and 65 deletions

View File

@@ -144,7 +144,6 @@ add_qtc_library(Utils
textutils.cpp textutils.h textutils.cpp textutils.h
theme/theme.cpp theme/theme.h theme/theme_p.h theme/theme.cpp theme/theme.h theme/theme_p.h
tooltip/effects.h tooltip/effects.h
tooltip/reuse.h
tooltip/tips.cpp tooltip/tips.h tooltip/tips.cpp tooltip/tips.h
tooltip/tooltip.cpp tooltip/tooltip.h tooltip/tooltip.cpp tooltip/tooltip.h
touchbar/touchbar.h touchbar/touchbar.h

View File

@@ -1,55 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <utils/hostosinfo.h>
#include <QPoint>
#include <QRect>
#include <QWidget>
#include <QApplication>
#include <QDesktopWidget>
namespace Utils {
namespace Internal {
inline int screenNumber(const QPoint &pos, QWidget *w)
{
if (QApplication::desktop()->isVirtualDesktop())
return QApplication::desktop()->screenNumber(pos);
else
return QApplication::desktop()->screenNumber(w);
}
inline QRect screenGeometry(const QPoint &pos, QWidget *w)
{
if (HostOsInfo::isMacHost())
return QApplication::desktop()->availableGeometry(screenNumber(pos, w));
return QApplication::desktop()->screenGeometry(screenNumber(pos, w));
}
} // namespace Internal
} // namespace Utils

View File

@@ -25,8 +25,8 @@
#include "tips.h" #include "tips.h"
#include "tooltip.h" #include "tooltip.h"
#include "reuse.h"
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QRect> #include <QRect>
@@ -43,6 +43,12 @@
#include <QPaintEvent> #include <QPaintEvent>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QPoint>
#include <QRect>
#include <QWidget>
#include <QApplication>
#include <QDesktopWidget>
#include <memory> #include <memory>
namespace Utils { namespace Utils {
@@ -287,5 +293,21 @@ bool WidgetTip::equals(int typeId, const QVariant &other, const QVariant &otherC
&& other.value<QWidget *>() == m_widget; && other.value<QWidget *>() == m_widget;
} }
int screenNumber(const QPoint &pos, QWidget *w)
{
if (QApplication::desktop()->isVirtualDesktop())
return QApplication::desktop()->screenNumber(pos);
else
return QApplication::desktop()->screenNumber(w);
}
QRect screenGeometry(const QPoint &pos, QWidget *w)
{
if (HostOsInfo::isMacHost())
return QApplication::desktop()->availableGeometry(screenNumber(pos, w));
return QApplication::desktop()->screenGeometry(screenNumber(pos, w));
}
} // namespace Internal } // namespace Internal
} // namespace Utils } // namespace Utils

View File

@@ -36,6 +36,9 @@
namespace Utils { namespace Utils {
namespace Internal { namespace Internal {
int screenNumber(const QPoint &pos, QWidget *w);
QRect screenGeometry(const QPoint &pos, QWidget *w);
class TipLabel : public QLabel class TipLabel : public QLabel
{ {
public: public:

View File

@@ -26,21 +26,19 @@
#include "tooltip.h" #include "tooltip.h"
#include "tips.h" #include "tips.h"
#include "effects.h" #include "effects.h"
#include "reuse.h"
#include <utils/faketooltip.h> #include <utils/faketooltip.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QString> #include <QApplication>
#include <QColor> #include <QColor>
#include <QGuiApplication> #include <QDebug>
#include <QDesktopWidget>
#include <QKeyEvent> #include <QKeyEvent>
#include <QMenu>
#include <QMouseEvent> #include <QMouseEvent>
#include <QWidget> #include <QWidget>
#include <QMenu>
#include <QDebug>
using namespace Utils; using namespace Utils;
using namespace Internal; using namespace Internal;

View File

@@ -214,7 +214,6 @@ HEADERS += \
$$PWD/elidinglabel.h \ $$PWD/elidinglabel.h \
$$PWD/tooltip/tooltip.h \ $$PWD/tooltip/tooltip.h \
$$PWD/tooltip/tips.h \ $$PWD/tooltip/tips.h \
$$PWD/tooltip/reuse.h \
$$PWD/tooltip/effects.h \ $$PWD/tooltip/effects.h \
$$PWD/unixutils.h \ $$PWD/unixutils.h \
$$PWD/ansiescapecodehandler.h \ $$PWD/ansiescapecodehandler.h \

View File

@@ -293,7 +293,6 @@ Project {
prefix: "tooltip/" prefix: "tooltip/"
files: [ files: [
"effects.h", "effects.h",
"reuse.h",
"tips.cpp", "tips.cpp",
"tips.h", "tips.h",
"tooltip.cpp", "tooltip.cpp",