Update tab widget
This commit is contained in:
parent
c1ab9019d7
commit
d649335490
|
@ -12,6 +12,11 @@ class QtMaterialTab;
|
||||||
class QT_MATERIAL_EXPORT QtMaterialTabs : public QWidget
|
class QT_MATERIAL_EXPORT QtMaterialTabs : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(bool haloVisible WRITE setHaloVisible READ isHaloVisible)
|
||||||
|
Q_PROPERTY(MaterialConst::RippleStyle rippleStyle WRITE setRippleStyle READ rippleStyle)
|
||||||
|
Q_PROPERTY(QColor inkColor WRITE setInkColor READ inkColor)
|
||||||
|
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
|
||||||
|
Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QtMaterialTabs(QWidget *parent = 0);
|
explicit QtMaterialTabs(QWidget *parent = 0);
|
||||||
|
|
|
@ -9,6 +9,7 @@ QtMaterialTabWidget::QtMaterialTabWidget(QWidget *parent)
|
||||||
, stackWidget(new QStackedWidget)
|
, stackWidget(new QStackedWidget)
|
||||||
{
|
{
|
||||||
tabBar->setObjectName(QStringLiteral("__qt__passive_tabBar"));
|
tabBar->setObjectName(QStringLiteral("__qt__passive_tabBar"));
|
||||||
|
tabBar->setHaloVisible(false);
|
||||||
|
|
||||||
connect(tabBar, QOverload<int>::of(&QtMaterialTabs::currentChanged),
|
connect(tabBar, QOverload<int>::of(&QtMaterialTabs::currentChanged),
|
||||||
this, &QtMaterialTabWidget::setCurrentIndex);
|
this, &QtMaterialTabWidget::setCurrentIndex);
|
||||||
|
@ -18,6 +19,56 @@ QtMaterialTabWidget::QtMaterialTabWidget(QWidget *parent)
|
||||||
layout->addWidget(stackWidget);
|
layout->addWidget(stackWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtMaterialTabWidget::setHaloVisible(bool value)
|
||||||
|
{
|
||||||
|
tabBar->setHaloVisible(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QtMaterialTabWidget::isHaloVisible() const
|
||||||
|
{
|
||||||
|
return tabBar->isHaloVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QtMaterialTabWidget::setRippleStyle(MaterialConst::RippleStyle style)
|
||||||
|
{
|
||||||
|
tabBar->setRippleStyle(style);
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialConst::RippleStyle QtMaterialTabWidget::rippleStyle() const
|
||||||
|
{
|
||||||
|
return tabBar->rippleStyle();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QtMaterialTabWidget::setInkColor(const QColor &color)
|
||||||
|
{
|
||||||
|
tabBar->setInkColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor QtMaterialTabWidget::inkColor() const
|
||||||
|
{
|
||||||
|
return tabBar->inkColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QtMaterialTabWidget::setBackgroundColor(const QColor &color)
|
||||||
|
{
|
||||||
|
tabBar->setBackgroundColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor QtMaterialTabWidget::backgroundColor() const
|
||||||
|
{
|
||||||
|
return tabBar->backgroundColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QtMaterialTabWidget::setTextColor(const QColor &color)
|
||||||
|
{
|
||||||
|
tabBar->setTextColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor QtMaterialTabWidget::textColor() const
|
||||||
|
{
|
||||||
|
return tabBar->textColor();
|
||||||
|
}
|
||||||
|
|
||||||
QSize QtMaterialTabWidget::sizeHint() const
|
QSize QtMaterialTabWidget::sizeHint() const
|
||||||
{
|
{
|
||||||
return QSize(300, 200);
|
return QSize(300, 200);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "qtmaterial_global.h"
|
#include "qtmaterial_global.h"
|
||||||
|
#include "lib/qtmaterialtheme.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QStackedWidget;
|
class QStackedWidget;
|
||||||
|
@ -14,12 +15,31 @@ class QT_MATERIAL_EXPORT QtMaterialTabWidget : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex)
|
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex)
|
||||||
Q_PROPERTY(QString pageTitle READ pageTitle WRITE setPageTitle STORED false)
|
Q_PROPERTY(QString pageTitle READ pageTitle WRITE setPageTitle STORED false)
|
||||||
|
Q_PROPERTY(bool haloVisible WRITE setHaloVisible READ isHaloVisible)
|
||||||
|
Q_PROPERTY(MaterialConst::RippleStyle rippleStyle WRITE setRippleStyle READ rippleStyle)
|
||||||
|
Q_PROPERTY(QColor inkColor WRITE setInkColor READ inkColor)
|
||||||
|
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
|
||||||
|
Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QtMaterialTabWidget(QWidget *parent = nullptr);
|
explicit QtMaterialTabWidget(QWidget *parent = nullptr);
|
||||||
|
|
||||||
QSize sizeHint() const override;
|
void setHaloVisible(bool value);
|
||||||
|
bool isHaloVisible() const;
|
||||||
|
|
||||||
|
void setRippleStyle(MaterialConst::RippleStyle style);
|
||||||
|
MaterialConst::RippleStyle rippleStyle() const;
|
||||||
|
|
||||||
|
void setInkColor(const QColor &color);
|
||||||
|
QColor inkColor() const;
|
||||||
|
|
||||||
|
void setBackgroundColor(const QColor &color);
|
||||||
|
QColor backgroundColor() const;
|
||||||
|
|
||||||
|
void setTextColor(const QColor &color);
|
||||||
|
QColor textColor() const;
|
||||||
|
|
||||||
|
QSize sizeHint() const override;
|
||||||
|
|
||||||
int count() const;
|
int count() const;
|
||||||
int currentIndex() const;
|
int currentIndex() const;
|
||||||
|
|
|
@ -19,6 +19,12 @@
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="haloVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="rippleStyle">
|
||||||
|
<enum>MaterialConst::PositionedRipple</enum>
|
||||||
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
|
Loading…
Reference in New Issue