-
Notifications
You must be signed in to change notification settings - Fork 0
/
CardHBoxLayout.h
41 lines (33 loc) · 1.21 KB
/
CardHBoxLayout.h
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
// Author: Annie Berend (5033782) - Jonathan Verbeek (5058288)
#pragma once
#include <QLayout>
#include <QVector>
// An own QLayout implementation, similar to a QHBoxLayout, but with overlapping elements
// See: https://doc.qt.io/qt-5/layout.html
class CCardHBoxLayout : public QLayout
{
public:
// Constructor
CCardHBoxLayout(int spacing) : QLayout() { setSpacing(spacing); }
CCardHBoxLayout(int spacing, QWidget *parent) : QLayout(parent) { setSpacing(spacing); }
// Destructor
~CCardHBoxLayout();
//~ Begin QLayout interface
void addItem(QLayoutItem *item) override;
QSize sizeHint() const override;
QSize minimumSize() const override;
int count() const override;
QLayoutItem *itemAt(int) const override;
QLayoutItem *takeAt(int) override;
void setGeometry(const QRect &rect) override;
//~ End QLayout interface
void clear();
// Adds the card at the last position of the three displayed cards. Is called from GameWindwo
// when a card from the drawStack is moved
void push_back(QWidget *card);
// Returns the number of displayed items
int getItemCount() const;
QLayoutItem* getFirstItem() const;
private:
QVector<QLayoutItem*> m_items;
};