Remove tst_manual_childwidget manual test as irrelevant

Test child widgets (on of which is native) with set cursors.

Similar test as tst_QWidget::setCursor().

Remove tst_manual_childwidget manual test.

Change-Id: Id9f0cf9cdb83ad86534761cf35b5359911a5cc8f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Frédéric Lefebvre 2024-11-28 10:00:35 +01:00
parent 6689921b9d
commit a507507ce1
5 changed files with 1 additions and 88 deletions

View File

@ -2,7 +2,6 @@
# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(allcursors)
add_subdirectory(childwidget)
add_subdirectory(childwindow)
add_subdirectory(childwindowcontainer)
add_subdirectory(grab_override)

View File

@ -1,17 +0,0 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_manual_childwidget Binary:
#####################################################################
qt_internal_add_manual_test(tst_manual_childwidget
GUI
SOURCES
main.cpp
INCLUDE_DIRECTORIES
.
LIBRARIES
Qt::Gui
Qt::Widgets
)

View File

@ -1,6 +0,0 @@
TEMPLATE = app
TARGET = tst_manual_childwidget
INCLUDEPATH += .
QT += widgets
SOURCES += main.cpp

View File

@ -1,63 +0,0 @@
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtWidgets>
class CursorWidget : public QWidget
{
public:
CursorWidget(QCursor cursor, QColor color)
:m_cursor(cursor)
,m_color(color)
{
if (cursor.shape() == Qt::ArrowCursor)
unsetCursor();
else
setCursor(cursor);
}
void paintEvent(QPaintEvent *e)
{
QPainter p(this);
p.fillRect(e->rect(), m_color);
}
void mousePressEvent(QMouseEvent *)
{
// Toggle cursor
QCursor newCursor = (cursor().shape() == m_cursor.shape()) ? QCursor() : m_cursor;
if (newCursor.shape() == Qt::ArrowCursor)
unsetCursor();
else
setCursor(newCursor);
}
private:
QCursor m_cursor;
QColor m_color;
};
int main(int argc, char **argv)
{
QApplication app(argc, argv);
// Test child widgets (one of which is native) with set cursors.
// Click window to toggle cursor.
CursorWidget w1((QCursor(Qt::SizeVerCursor)), QColor(Qt::blue).darker());
w1.resize(200, 200);
w1.show();
CursorWidget w2((QCursor(Qt::OpenHandCursor)), QColor(Qt::red).darker());
w2.setParent(&w1);
w2.setGeometry(0, 0, 100, 100);
w2.show();
CursorWidget w3((QCursor(Qt::IBeamCursor)), QColor(Qt::green).darker());
w3.winId();
w3.setParent(&w1);
w3.setGeometry(100, 100, 100, 100);
w3.show();
return app.exec();
}

View File

@ -1,3 +1,3 @@
TEMPLATE = subdirs
SUBDIRS = allcursors childwidget childwindow childwindowcontainer grab_override qcursorhighdpi
SUBDIRS = allcursors childwindow childwindowcontainer grab_override qcursorhighdpi