aboutsummaryrefslogtreecommitdiff
path: root/libs/installer_omod/src/oldstuff/DialogSelect.h
blob: 0e0f1bb60299b367020849bd5680f24b5c90f7f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once

#include <optional>

#include <QLabel>
#include <QVector>
#include <QWidget>

std::optional<QVector<int>> DialogSelect(QWidget* parent, const QString& title, const QVector<QString>& items,
                                         const QVector<QString>& descriptions, const QVector<QString>& pixmaps,
                                         bool multiSelect);


// For some reason, this can be resized bigger but not smaller.
class FixedAspectRatioImageLabel : public QLabel
{
  Q_OBJECT

  Q_PROPERTY(QPixmap unscaledPixmap READ unscaledPixmap WRITE setUnscaledPixmap)

public:
  FixedAspectRatioImageLabel() = default;

  FixedAspectRatioImageLabel(QWidget* parent);

  void setUnscaledPixmap(const QPixmap& pixmap);

  const QPixmap& unscaledPixmap() const;

  QSize sizeHint() const override;

  bool hasHeightForWidth() const override;

  int heightForWidth(int width) const override;

  int widthForHeight(int height) const;

protected:
  void resizeEvent(QResizeEvent* resizeEvent) override;

private:
  void rescalePixmap(const QSize& size);

  QPixmap mUnscaledPixmap;
  QLabel copySizeLabel;
};