File indexing completed on 2025-01-05 03:35:18

0001 /*
0002     File                 : ColorMapsWidget.h
0003     Project              : LabPlot
0004     Description          : widget showing the available color maps
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2021 Alexander Semke <alexander.semke@web.de>
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef COLORMAPSWIDGET_H
0011 #define COLORMAPSWIDGET_H
0012 
0013 #include "ui_colormapswidget.h"
0014 
0015 class QCompleter;
0016 class QStandardItemModel;
0017 class ColorMapsManager;
0018 
0019 class ColorMapsWidget : public QWidget {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit ColorMapsWidget(QWidget*);
0024     ~ColorMapsWidget() override;
0025 
0026     QPixmap previewPixmap();
0027     QString name() const;
0028     QVector<QColor> colors() const;
0029 
0030 private:
0031     Ui::ColorMapsWidget ui;
0032     QCompleter* m_completer{nullptr};
0033     QPixmap m_pixmap;
0034     QVector<QColor> m_colormap;
0035     QStandardItemModel* m_model{nullptr};
0036     ColorMapsManager* m_manager{nullptr};
0037 
0038     void loadCollections();
0039     void activateIconViewItem(const QString& name);
0040     void activateListViewItem(const QString& name);
0041 
0042 private Q_SLOTS:
0043     void collectionChanged(int);
0044     void colorMapChanged();
0045     void showInfo();
0046     void toggleIconView();
0047     void viewModeChanged(int);
0048     void activated(const QString&);
0049 
0050 Q_SIGNALS:
0051     void doubleClicked();
0052 };
0053 
0054 #endif // COLORMAPSWIDGET_H