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