ladybird/Ladybird/Qt/TabBar.h
Daniel Bertalan c62240aa80 Everywhere: Warn on function definitions without prototypes
If no header includes the prototype of a function, then it cannot be
used from outside the translation unit it was defined in. In that case,
it should be marked as `static`, in order to avoid possible ODR
problems, unnecessary exported symbols, and allow the compiler to better
optimize those.

If this warning triggers in a function defined in a header, `inline`
needs to be added, otherwise if the header is included in more than one
TU, it will fail to link with a duplicate definition error.

The reason this diff got so big is that Lagom-only code wasn't built
with this flag even in Serenity times.
2024-07-17 21:51:29 +02:00

48 lines
898 B
C++

/*
* Copyright (c) 2024, Tim Flynn <trflynn89@serenityos.org>
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <QPushButton>
#include <QTabBar>
#include <QTabWidget>
class QContextMenuEvent;
class QEvent;
class QIcon;
class QWidget;
namespace Ladybird {
class TabBar : public QTabBar {
Q_OBJECT
public:
explicit TabBar(QWidget* parent = nullptr);
virtual QSize tabSizeHint(int index) const override;
virtual void contextMenuEvent(QContextMenuEvent* event) override;
};
class TabWidget : public QTabWidget {
Q_OBJECT
public:
explicit TabWidget(QWidget* parent = nullptr);
};
class TabBarButton : public QPushButton {
Q_OBJECT
public:
explicit TabBarButton(QIcon const& icon, QWidget* parent = nullptr);
protected:
virtual bool event(QEvent* event) override;
};
}