Add getContentWidget
This commit is contained in:
parent
7beeadccf6
commit
c729b34716
|
@ -2,6 +2,7 @@
|
|||
#define QTMATERIALDIALOG_H
|
||||
|
||||
#include <QScopedPointer>
|
||||
#include <qwidget.h>
|
||||
|
||||
#include "qt-material-widgets/lib/qtmaterialoverlaywidget.h"
|
||||
|
||||
|
@ -19,6 +20,7 @@ public:
|
|||
|
||||
QLayout *windowLayout() const;
|
||||
void setWindowLayout(QLayout *layout);
|
||||
QWidget* getContentWidget() const;
|
||||
|
||||
public slots:
|
||||
void showDialog();
|
||||
|
@ -34,4 +36,5 @@ private:
|
|||
Q_DECLARE_PRIVATE(QtMaterialDialog)
|
||||
};
|
||||
|
||||
|
||||
#endif // QTMATERIALDIALOG_H
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
#include "qtmaterialdialog.h"
|
||||
#include "qtmaterialdialog_p.h"
|
||||
#include <QtWidgets/QStackedLayout>
|
||||
#include <QtWidgets/QGraphicsDropShadowEffect>
|
||||
#include <QStateMachine>
|
||||
#include <QState>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QPainter>
|
||||
#include "qtmaterialdialog_internal.h"
|
||||
#include <QPropertyAnimation>
|
||||
#include <QState>
|
||||
#include <QStateMachine>
|
||||
|
||||
#include "qtmaterialdialog.h"
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QtWidgets/QGraphicsDropShadowEffect>
|
||||
#include <QtWidgets/QStackedLayout>
|
||||
|
||||
#include "lib/qtmaterialstatetransition.h"
|
||||
#include "qtmaterialdialog_internal.h"
|
||||
#include "qtmaterialdialog_p.h"
|
||||
|
||||
/*!
|
||||
* \class QtMaterialDialogPrivate
|
||||
|
@ -20,9 +23,7 @@ QtMaterialDialogPrivate::QtMaterialDialogPrivate(QtMaterialDialog *q)
|
|||
{
|
||||
}
|
||||
|
||||
QtMaterialDialogPrivate::~QtMaterialDialogPrivate()
|
||||
{
|
||||
}
|
||||
QtMaterialDialogPrivate::~QtMaterialDialogPrivate() {}
|
||||
|
||||
void QtMaterialDialogPrivate::init()
|
||||
{
|
||||
|
@ -94,10 +95,12 @@ void QtMaterialDialogPrivate::init()
|
|||
animation->setEasingCurve(QEasingCurve::OutCirc);
|
||||
stateMachine->addDefaultAnimation(animation);
|
||||
|
||||
QObject::connect(visibleState, SIGNAL(propertiesAssigned()),
|
||||
proxy, SLOT(makeOpaque()));
|
||||
QObject::connect(hiddenState, SIGNAL(propertiesAssigned()),
|
||||
proxy, SLOT(makeTransparent()));
|
||||
QObject::connect(
|
||||
visibleState, SIGNAL(propertiesAssigned()), proxy, SLOT(makeOpaque()));
|
||||
QObject::connect(hiddenState,
|
||||
SIGNAL(propertiesAssigned()),
|
||||
proxy,
|
||||
SLOT(makeTransparent()));
|
||||
|
||||
stateMachine->start();
|
||||
QCoreApplication::processEvents();
|
||||
|
@ -108,15 +111,13 @@ void QtMaterialDialogPrivate::init()
|
|||
*/
|
||||
|
||||
QtMaterialDialog::QtMaterialDialog(QWidget* parent)
|
||||
: QtMaterialOverlayWidget(parent),
|
||||
d_ptr(new QtMaterialDialogPrivate(this))
|
||||
: QtMaterialOverlayWidget(parent)
|
||||
, d_ptr(new QtMaterialDialogPrivate(this))
|
||||
{
|
||||
d_func()->init();
|
||||
}
|
||||
|
||||
QtMaterialDialog::~QtMaterialDialog()
|
||||
{
|
||||
}
|
||||
QtMaterialDialog::~QtMaterialDialog() {}
|
||||
|
||||
QLayout* QtMaterialDialog::windowLayout() const
|
||||
{
|
||||
|
@ -125,6 +126,13 @@ QLayout *QtMaterialDialog::windowLayout() const
|
|||
return d->dialogWindow->layout();
|
||||
}
|
||||
|
||||
QWidget* QtMaterialDialog::getContentWidget() const
|
||||
{
|
||||
Q_D(const QtMaterialDialog);
|
||||
|
||||
return d->dialogWindow;
|
||||
}
|
||||
|
||||
void QtMaterialDialog::setWindowLayout(QLayout* layout)
|
||||
{
|
||||
Q_D(QtMaterialDialog);
|
||||
|
@ -136,7 +144,8 @@ void QtMaterialDialog::showDialog()
|
|||
{
|
||||
Q_D(QtMaterialDialog);
|
||||
|
||||
d->stateMachine->postEvent(new QtMaterialStateTransitionEvent(DialogShowTransition));
|
||||
d->stateMachine->postEvent(
|
||||
new QtMaterialStateTransitionEvent(DialogShowTransition));
|
||||
raise();
|
||||
}
|
||||
|
||||
|
@ -144,7 +153,8 @@ void QtMaterialDialog::hideDialog()
|
|||
{
|
||||
Q_D(QtMaterialDialog);
|
||||
|
||||
d->stateMachine->postEvent(new QtMaterialStateTransitionEvent(DialogHideTransition));
|
||||
d->stateMachine->postEvent(
|
||||
new QtMaterialStateTransitionEvent(DialogHideTransition));
|
||||
setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
d->proxyStack->setCurrentIndex(1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue