qt5base-lts/tests/manual/findfiles/window.h
Volker Hilsheimer 3fe0bf6e1b Move findfiles example into manual tests
The example follows bad and outdated practices:

- running time consuming and I/O heavy workload in the GUI thread
- calling processEvents to keep the UI responsive
- showing results only at the end of a search rather than continuously

Perhaps this example can be rewritten at some point to apply modern
practices (at least use a thread and emit signals), but it seems
to have low overall educational value.

Moving it to be a manual test for now.

Fixes: QTBUG-111002
Pick-to: 6.5
Change-Id: Id630fd4599096448ea4f96bcbf977b11a039796f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-02-09 00:23:34 +01:00

51 lines
1.0 KiB
C++

// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef WINDOW_H
#define WINDOW_H
#include <QWidget>
#include <QDir>
QT_BEGIN_NAMESPACE
class QComboBox;
class QLabel;
class QPushButton;
class QTableWidget;
class QTableWidgetItem;
QT_END_NAMESPACE
//! [0]
class Window : public QWidget
{
Q_OBJECT
public:
Window(QWidget *parent = nullptr);
private slots:
void browse();
void find();
void animateFindClick();
void openFileOfItem(int row, int column);
void contextMenu(const QPoint &pos);
private:
QStringList findFiles(const QStringList &files, const QString &text);
void showFiles(const QStringList &paths);
QComboBox *createComboBox(const QString &text = QString());
void createFilesTable();
QComboBox *fileComboBox;
QComboBox *textComboBox;
QComboBox *directoryComboBox;
QLabel *filesFoundLabel;
QPushButton *findButton;
QTableWidget *filesTable;
QDir currentDir;
};
//! [0]
#endif