squawk/ui/widgets/settings/settingslist.h

44 lines
1.3 KiB
C
Raw Normal View History

/*
* Squawk messenger.
* Copyright (C) 2019 Yury Gubich <blue@macaw.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2024-12-13 23:53:04 +00:00
#pragma once
2022-01-16 19:54:57 +00:00
#include <QListWidget>
#include <QResizeEvent>
2024-12-13 23:53:04 +00:00
#include <QStyleOptionViewItem>
2022-01-16 19:54:57 +00:00
2024-12-13 23:53:04 +00:00
class SettingsList : public QListWidget {
2022-01-16 19:54:57 +00:00
Q_OBJECT
public:
SettingsList(QWidget* parent = nullptr);
~SettingsList();
protected:
2024-12-13 23:53:04 +00:00
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
void initViewItemOption(QStyleOptionViewItem* option) const override;
#else
2022-01-16 19:54:57 +00:00
QStyleOptionViewItem viewOptions() const override;
2024-12-13 23:53:04 +00:00
#endif
2022-01-16 19:54:57 +00:00
void resizeEvent(QResizeEvent * event) override;
QRect visualRect(const QModelIndex & index) const override;
2022-01-16 19:54:57 +00:00
private:
int lastWidth;
};