64 lines
1.7 KiB
C
Raw Normal View History

/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
2021-08-04 10:11:12 +02:00
#pragma once
#include "GridAccessor.h"
#include <QWidget>
2019-07-25 18:39:50 +02:00
class QLabel;
class TestBox : public QWidget, public GridAccessor
{
public:
2019-07-25 18:39:50 +02:00
enum
{
Skinny,
Widgets,
Graphics,
Quick,
GridCount
};
TestBox( QWidget* parent = nullptr );
~TestBox() override;
2019-07-29 17:34:46 +02:00
void reset();
2019-07-23 18:35:51 +02:00
void setColumns( int );
2019-07-25 18:39:50 +02:00
void enableGrid( int, bool on );
2019-07-23 18:35:51 +02:00
void insert( const QByteArray& colorName,
int row, int column, int rowSpan, int columnSpan ) override;
void setSpacing( Qt::Orientations, int spacing ) override;
2019-07-25 18:39:50 +02:00
using GridAccessor::setSpacing;
2019-07-23 18:35:51 +02:00
void setStretchFactor( int pos, Qt::Orientation, int stretch ) override;
void setSizeHint( int pos, Qt::Orientation, Qt::SizeHint, int hint ) override;
2019-07-23 18:35:51 +02:00
void setSizeHintAt( int index, Qt::Orientation, Qt::SizeHint, int hint ) override;
void setSizePolicyAt( int index, Qt::Orientation, int policy ) override;
void setAlignmentAt( int index, Qt::Alignment ) override;
void setRetainSizeWhenHiddenAt( int index, bool on ) override;
2019-07-25 18:39:50 +02:00
void setVisibleAt( int index, bool on ) override;
QSize preferredSize() const override;
protected:
2019-07-25 18:39:50 +02:00
bool event( QEvent* ) override;
void resizeEvent( QResizeEvent* ) override;
2019-07-29 17:34:46 +02:00
void updateLabels();
private:
2019-07-23 18:35:51 +02:00
void layoutGrids();
2019-07-25 18:39:50 +02:00
QWidget* m_grids[ GridCount ];
QLabel* m_labels[ GridCount ];
2019-07-23 18:35:51 +02:00
int m_columnCount = 2;
};