1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:47:35 +00:00

Ladybird: Move Qt-specific classes and functions to a Qt subdirectory

This will help a lot with developing chromes for different UI frameworks
where we can see which helper classes and processes are really using Qt
vs just using it to get at helper data.

As a bonus, remove Qt dependency from WebDriver.
This commit is contained in:
Andrew Kaster 2023-08-05 10:42:26 -06:00 committed by Andrew Kaster
parent ccaa423372
commit 391beef707
53 changed files with 160 additions and 157 deletions

View file

@ -0,0 +1,44 @@
/*
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/Model.h>
#include <QAbstractItemModel>
namespace Ladybird {
class ModelTranslator final : public QAbstractItemModel {
Q_OBJECT
public:
virtual ~ModelTranslator() override;
void set_underlying_model(RefPtr<GUI::Model> model)
{
beginResetModel();
m_model = model;
endResetModel();
}
RefPtr<GUI::Model> underlying_model()
{
return m_model;
}
virtual int columnCount(QModelIndex const& parent) const override;
virtual int rowCount(QModelIndex const& parent) const override;
virtual QVariant data(QModelIndex const&, int role) const override;
virtual QModelIndex index(int row, int column, QModelIndex const& parent) const override;
virtual QModelIndex parent(QModelIndex const& index) const override;
QModelIndex to_qt(GUI::ModelIndex const&) const;
GUI::ModelIndex to_gui(QModelIndex const&) const;
private:
RefPtr<GUI::Model> m_model;
};
}