chore: 格式化ElaWidgetTools代码
This commit is contained in:
@@ -26,31 +26,26 @@ Q_PROPERTY_CREATE_Q_CPP(ElaWindow, int, ThemeChangeTime)
|
||||
Q_PROPERTY_CREATE_Q_CPP(ElaWindow, ElaNavigationType::NavigationDisplayMode, NavigationBarDisplayMode)
|
||||
Q_PROPERTY_CREATE_Q_CPP(ElaWindow, ElaWindowType::StackSwitchMode, StackSwitchMode)
|
||||
Q_TAKEOVER_NATIVEEVENT_CPP(ElaWindow, d_func()->_appBar);
|
||||
ElaWindow::ElaWindow(QWidget* parent)
|
||||
: QMainWindow{parent}, d_ptr(new ElaWindowPrivate())
|
||||
{
|
||||
ElaWindow::ElaWindow(QWidget *parent) : QMainWindow{parent}, d_ptr(new ElaWindowPrivate()) {
|
||||
Q_D(ElaWindow);
|
||||
d->q_ptr = this;
|
||||
d->q_ptr = this;
|
||||
d->_pStackSwitchMode = ElaWindowType::StackSwitchMode::Popup;
|
||||
setProperty("ElaBaseClassName", "ElaWindow");
|
||||
resize(1020, 680); // 默认宽高
|
||||
|
||||
d->_pThemeChangeTime = 700;
|
||||
d->_pThemeChangeTime = 700;
|
||||
d->_pNavigationBarDisplayMode = ElaNavigationType::NavigationDisplayMode::Auto;
|
||||
connect(this, &ElaWindow::pNavigationBarDisplayModeChanged, d, &ElaWindowPrivate::onDisplayModeChanged);
|
||||
|
||||
// 自定义AppBar
|
||||
d->_appBar = new ElaAppBar(this);
|
||||
connect(d->_appBar, &ElaAppBar::routeBackButtonClicked, this, []() {
|
||||
ElaNavigationRouter::getInstance()->navigationRouteBack();
|
||||
});
|
||||
connect(d->_appBar, &ElaAppBar::routeBackButtonClicked, this, []() { ElaNavigationRouter::getInstance()->navigationRouteBack(); });
|
||||
connect(d->_appBar, &ElaAppBar::closeButtonClicked, this, &ElaWindow::closeButtonClicked);
|
||||
// 导航栏
|
||||
d->_navigationBar = new ElaNavigationBar(this);
|
||||
// 返回按钮状态变更
|
||||
connect(ElaNavigationRouter::getInstance(), &ElaNavigationRouter::navigationRouterStateChanged, this, [d](bool isEnable) {
|
||||
d->_appBar->setRouteBackButtonEnable(isEnable);
|
||||
});
|
||||
connect(ElaNavigationRouter::getInstance(), &ElaNavigationRouter::navigationRouterStateChanged, this,
|
||||
[d](bool isEnable) { d->_appBar->setRouteBackButtonEnable(isEnable); });
|
||||
|
||||
// 转发用户卡片点击信号
|
||||
connect(d->_navigationBar, &ElaNavigationBar::userInfoCardClicked, this, &ElaWindow::userInfoCardClicked);
|
||||
@@ -68,7 +63,7 @@ ElaWindow::ElaWindow(QWidget* parent)
|
||||
// 导航中心堆栈窗口
|
||||
d->_navigationCenterStackedWidget = new ElaCentralStackedWidget(this);
|
||||
d->_navigationCenterStackedWidget->setContentsMargins(0, 0, 0, 0);
|
||||
QWidget* navigationCentralWidget = new QWidget(this);
|
||||
QWidget *navigationCentralWidget = new QWidget(this);
|
||||
navigationCentralWidget->setObjectName("ElaWindowNavigationCentralWidget");
|
||||
navigationCentralWidget->setStyleSheet("#ElaWindowNavigationCentralWidget{background-color:transparent;}");
|
||||
navigationCentralWidget->installEventFilter(this);
|
||||
@@ -100,155 +95,124 @@ ElaWindow::ElaWindow(QWidget* parent)
|
||||
setStyleSheet("#ElaWindow{background-color:transparent;}");
|
||||
setStyle(new ElaWindowStyle(style()));
|
||||
|
||||
//延时渲染
|
||||
// 延时渲染
|
||||
QTimer::singleShot(1, this, [=] {
|
||||
QPalette palette = this->palette();
|
||||
palette.setBrush(QPalette::Window, ElaThemeColor(d->_themeMode, WindowBase));
|
||||
this->setPalette(palette);
|
||||
});
|
||||
eApp->syncWindowDisplayMode(this);
|
||||
connect(eApp, &ElaApplication::pWindowDisplayModeChanged, this, [=]() {
|
||||
d->onThemeModeChanged(d->_themeMode);
|
||||
});
|
||||
connect(eApp, &ElaApplication::pWindowDisplayModeChanged, this, [=]() { d->onThemeModeChanged(d->_themeMode); });
|
||||
}
|
||||
|
||||
ElaWindow::~ElaWindow()
|
||||
{
|
||||
ElaWindow::~ElaWindow() {
|
||||
eApp->syncWindowDisplayMode(this, false);
|
||||
delete this->style();
|
||||
}
|
||||
|
||||
void ElaWindow::setIsStayTop(bool isStayTop)
|
||||
{
|
||||
void ElaWindow::setIsStayTop(bool isStayTop) {
|
||||
Q_D(ElaWindow);
|
||||
d->_appBar->setIsStayTop(isStayTop);
|
||||
Q_EMIT pIsStayTopChanged();
|
||||
}
|
||||
|
||||
bool ElaWindow::getIsStayTop() const
|
||||
{
|
||||
return d_ptr->_appBar->getIsStayTop();
|
||||
}
|
||||
bool ElaWindow::getIsStayTop() const { return d_ptr->_appBar->getIsStayTop(); }
|
||||
|
||||
void ElaWindow::setIsFixedSize(bool isFixedSize)
|
||||
{
|
||||
void ElaWindow::setIsFixedSize(bool isFixedSize) {
|
||||
Q_D(ElaWindow);
|
||||
d->_appBar->setIsFixedSize(isFixedSize);
|
||||
Q_EMIT pIsFixedSizeChanged();
|
||||
}
|
||||
|
||||
bool ElaWindow::getIsFixedSize() const
|
||||
{
|
||||
return d_ptr->_appBar->getIsFixedSize();
|
||||
}
|
||||
bool ElaWindow::getIsFixedSize() const { return d_ptr->_appBar->getIsFixedSize(); }
|
||||
|
||||
void ElaWindow::setIsDefaultClosed(bool isDefaultClosed)
|
||||
{
|
||||
void ElaWindow::setIsDefaultClosed(bool isDefaultClosed) {
|
||||
Q_D(ElaWindow);
|
||||
d->_appBar->setIsDefaultClosed(isDefaultClosed);
|
||||
Q_EMIT pIsDefaultClosedChanged();
|
||||
}
|
||||
|
||||
bool ElaWindow::getIsDefaultClosed() const
|
||||
{
|
||||
return d_ptr->_appBar->getIsDefaultClosed();
|
||||
}
|
||||
bool ElaWindow::getIsDefaultClosed() const { return d_ptr->_appBar->getIsDefaultClosed(); }
|
||||
|
||||
void ElaWindow::setAppBarHeight(int appBarHeight)
|
||||
{
|
||||
void ElaWindow::setAppBarHeight(int appBarHeight) {
|
||||
Q_D(ElaWindow);
|
||||
d->_appBar->setAppBarHeight(appBarHeight);
|
||||
Q_EMIT pAppBarHeightChanged();
|
||||
}
|
||||
|
||||
int ElaWindow::getAppBarHeight() const
|
||||
{
|
||||
int ElaWindow::getAppBarHeight() const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_appBar->getAppBarHeight();
|
||||
}
|
||||
|
||||
void ElaWindow::setCustomWidget(ElaAppBarType::CustomArea customArea, QWidget* widget)
|
||||
{
|
||||
void ElaWindow::setCustomWidget(ElaAppBarType::CustomArea customArea, QWidget *widget) {
|
||||
Q_D(ElaWindow);
|
||||
d->_appBar->setCustomWidget(customArea, widget);
|
||||
Q_EMIT customWidgetChanged();
|
||||
}
|
||||
|
||||
QWidget* ElaWindow::getCustomWidget() const
|
||||
{
|
||||
QWidget *ElaWindow::getCustomWidget() const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_appBar->getCustomWidget();
|
||||
}
|
||||
|
||||
void ElaWindow::setCustomMenu(QMenu* customMenu)
|
||||
{
|
||||
void ElaWindow::setCustomMenu(QMenu *customMenu) {
|
||||
Q_D(ElaWindow);
|
||||
d->_appBar->setCustomMenu(customMenu);
|
||||
Q_EMIT customMenuChanged();
|
||||
}
|
||||
|
||||
QMenu* ElaWindow::getCustomMenu() const
|
||||
{
|
||||
QMenu *ElaWindow::getCustomMenu() const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_appBar->getCustomMenu();
|
||||
}
|
||||
|
||||
void ElaWindow::setCustomWidgetMaximumWidth(int width)
|
||||
{
|
||||
void ElaWindow::setCustomWidgetMaximumWidth(int width) {
|
||||
Q_D(ElaWindow);
|
||||
d->_appBar->setCustomWidgetMaximumWidth(width);
|
||||
Q_EMIT pCustomWidgetMaximumWidthChanged();
|
||||
}
|
||||
|
||||
int ElaWindow::getCustomWidgetMaximumWidth() const
|
||||
{
|
||||
int ElaWindow::getCustomWidgetMaximumWidth() const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_appBar->getCustomWidgetMaximumWidth();
|
||||
}
|
||||
|
||||
void ElaWindow::setIsCentralStackedWidgetTransparent(bool isTransparent)
|
||||
{
|
||||
void ElaWindow::setIsCentralStackedWidgetTransparent(bool isTransparent) {
|
||||
Q_D(ElaWindow);
|
||||
d->_navigationCenterStackedWidget->setIsTransparent(isTransparent);
|
||||
}
|
||||
|
||||
bool ElaWindow::getIsCentralStackedWidgetTransparent() const
|
||||
{
|
||||
bool ElaWindow::getIsCentralStackedWidgetTransparent() const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationCenterStackedWidget->getIsTransparent();
|
||||
}
|
||||
|
||||
void ElaWindow::setIsAllowPageOpenInNewWindow(bool isAllowPageOpenInNewWindow)
|
||||
{
|
||||
void ElaWindow::setIsAllowPageOpenInNewWindow(bool isAllowPageOpenInNewWindow) {
|
||||
Q_D(ElaWindow);
|
||||
d->_navigationBar->setIsAllowPageOpenInNewWindow(isAllowPageOpenInNewWindow);
|
||||
Q_EMIT pIsAllowPageOpenInNewWindowChanged();
|
||||
}
|
||||
|
||||
bool ElaWindow::getIsAllowPageOpenInNewWindow() const
|
||||
{
|
||||
bool ElaWindow::getIsAllowPageOpenInNewWindow() const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationBar->getIsAllowPageOpenInNewWindow();
|
||||
}
|
||||
|
||||
void ElaWindow::setNavigationBarWidth(int navigationBarWidth)
|
||||
{
|
||||
void ElaWindow::setNavigationBarWidth(int navigationBarWidth) {
|
||||
Q_D(ElaWindow);
|
||||
d->_navigationBar->setNavigationBarWidth(navigationBarWidth);
|
||||
Q_EMIT pNavigationBarWidthChanged();
|
||||
}
|
||||
|
||||
int ElaWindow::getNavigationBarWidth() const
|
||||
{
|
||||
int ElaWindow::getNavigationBarWidth() const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationBar->getNavigationBarWidth();
|
||||
}
|
||||
|
||||
void ElaWindow::setCurrentStackIndex(int currentStackIndex)
|
||||
{
|
||||
void ElaWindow::setCurrentStackIndex(int currentStackIndex) {
|
||||
Q_D(ElaWindow);
|
||||
if (currentStackIndex >= d->_centerStackedWidget->count() || currentStackIndex < 0 || currentStackIndex == d->_centralStackTargetIndex)
|
||||
{
|
||||
if (currentStackIndex >= d->_centerStackedWidget->count() || currentStackIndex < 0 || currentStackIndex == d->_centralStackTargetIndex) {
|
||||
return;
|
||||
}
|
||||
d->_centralStackTargetIndex = currentStackIndex;
|
||||
@@ -259,16 +223,13 @@ void ElaWindow::setCurrentStackIndex(int currentStackIndex)
|
||||
Q_EMIT pCurrentStackIndexChanged();
|
||||
}
|
||||
|
||||
int ElaWindow::getCurrentStackIndex() const
|
||||
{
|
||||
int ElaWindow::getCurrentStackIndex() const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_centerStackedWidget->currentIndex();
|
||||
}
|
||||
|
||||
void ElaWindow::moveToCenter()
|
||||
{
|
||||
if (isMaximized() || isFullScreen())
|
||||
{
|
||||
void ElaWindow::moveToCenter() {
|
||||
if (isMaximized() || isFullScreen()) {
|
||||
return;
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
@@ -279,8 +240,7 @@ void ElaWindow::moveToCenter()
|
||||
setGeometry((geometry.left() + geometry.right() - width()) / 2, (geometry.top() + geometry.bottom() - height()) / 2, width(), height());
|
||||
}
|
||||
|
||||
void ElaWindow::setIsNavigationBarEnable(bool isVisible)
|
||||
{
|
||||
void ElaWindow::setIsNavigationBarEnable(bool isVisible) {
|
||||
Q_D(ElaWindow);
|
||||
d->_isNavigationEnable = isVisible;
|
||||
d->_navigationBar->setVisible(isVisible);
|
||||
@@ -288,241 +248,200 @@ void ElaWindow::setIsNavigationBarEnable(bool isVisible)
|
||||
d->_navigationCenterStackedWidget->setIsHasRadius(isVisible);
|
||||
}
|
||||
|
||||
bool ElaWindow::getIsNavigationBarEnable() const
|
||||
{
|
||||
return d_ptr->_isNavigationEnable;
|
||||
}
|
||||
bool ElaWindow::getIsNavigationBarEnable() const { return d_ptr->_isNavigationEnable; }
|
||||
|
||||
void ElaWindow::setUserInfoCardVisible(bool isVisible)
|
||||
{
|
||||
void ElaWindow::setUserInfoCardVisible(bool isVisible) {
|
||||
Q_D(ElaWindow);
|
||||
d->_navigationBar->setUserInfoCardVisible(isVisible);
|
||||
}
|
||||
|
||||
void ElaWindow::setUserInfoCardPixmap(QPixmap pix)
|
||||
{
|
||||
void ElaWindow::setUserInfoCardPixmap(QPixmap pix) {
|
||||
Q_D(ElaWindow);
|
||||
d->_navigationBar->setUserInfoCardPixmap(pix);
|
||||
}
|
||||
|
||||
void ElaWindow::setUserInfoCardTitle(QString title)
|
||||
{
|
||||
void ElaWindow::setUserInfoCardTitle(QString title) {
|
||||
Q_D(ElaWindow);
|
||||
d->_navigationBar->setUserInfoCardTitle(title);
|
||||
}
|
||||
|
||||
void ElaWindow::setUserInfoCardSubTitle(QString subTitle)
|
||||
{
|
||||
void ElaWindow::setUserInfoCardSubTitle(QString subTitle) {
|
||||
Q_D(ElaWindow);
|
||||
d->_navigationBar->setUserInfoCardSubTitle(subTitle);
|
||||
}
|
||||
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addExpanderNode(QString expanderTitle, QString& expanderKey, ElaIconType::IconName awesome) const
|
||||
{
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addExpanderNode(QString expanderTitle, QString &expanderKey,
|
||||
ElaIconType::IconName awesome) const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationBar->addExpanderNode(expanderTitle, expanderKey, awesome);
|
||||
}
|
||||
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addExpanderNode(QString expanderTitle, QString& expanderKey, QString targetExpanderKey, ElaIconType::IconName awesome) const
|
||||
{
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addExpanderNode(QString expanderTitle, QString &expanderKey, QString targetExpanderKey,
|
||||
ElaIconType::IconName awesome) const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationBar->addExpanderNode(expanderTitle, expanderKey, targetExpanderKey, awesome);
|
||||
}
|
||||
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addPageNode(QString pageTitle, QWidget* page, ElaIconType::IconName awesome) const
|
||||
{
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addPageNode(QString pageTitle, QWidget *page, ElaIconType::IconName awesome) const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationBar->addPageNode(pageTitle, page, awesome);
|
||||
}
|
||||
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addPageNode(QString pageTitle, QWidget* page, QString targetExpanderKey, ElaIconType::IconName awesome) const
|
||||
{
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addPageNode(QString pageTitle, QWidget *page, QString targetExpanderKey,
|
||||
ElaIconType::IconName awesome) const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationBar->addPageNode(pageTitle, page, targetExpanderKey, awesome);
|
||||
}
|
||||
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addPageNode(QString pageTitle, QWidget* page, int keyPoints, ElaIconType::IconName awesome) const
|
||||
{
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addPageNode(QString pageTitle, QWidget *page, int keyPoints,
|
||||
ElaIconType::IconName awesome) const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationBar->addPageNode(pageTitle, page, keyPoints, awesome);
|
||||
}
|
||||
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addPageNode(QString pageTitle, QWidget* page, QString targetExpanderKey, int keyPoints, ElaIconType::IconName awesome) const
|
||||
{
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addPageNode(QString pageTitle, QWidget *page, QString targetExpanderKey, int keyPoints,
|
||||
ElaIconType::IconName awesome) const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationBar->addPageNode(pageTitle, page, targetExpanderKey, keyPoints, awesome);
|
||||
}
|
||||
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addFooterNode(QString footerTitle, QString& footerKey, int keyPoints, ElaIconType::IconName awesome) const
|
||||
{
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addFooterNode(QString footerTitle, QString &footerKey, int keyPoints,
|
||||
ElaIconType::IconName awesome) const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationBar->addFooterNode(footerTitle, nullptr, footerKey, keyPoints, awesome);
|
||||
}
|
||||
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addFooterNode(QString footerTitle, QWidget* page, QString& footerKey, int keyPoints, ElaIconType::IconName awesome) const
|
||||
{
|
||||
ElaNavigationType::NodeOperateReturnType ElaWindow::addFooterNode(QString footerTitle, QWidget *page, QString &footerKey, int keyPoints,
|
||||
ElaIconType::IconName awesome) const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationBar->addFooterNode(footerTitle, page, footerKey, keyPoints, awesome);
|
||||
}
|
||||
|
||||
void ElaWindow::addCentralWidget(QWidget* centralWidget)
|
||||
{
|
||||
void ElaWindow::addCentralWidget(QWidget *centralWidget) {
|
||||
Q_D(ElaWindow);
|
||||
if (!centralWidget)
|
||||
{
|
||||
if (!centralWidget) {
|
||||
return;
|
||||
}
|
||||
d->_centerStackedWidget->addWidget(centralWidget);
|
||||
}
|
||||
|
||||
QWidget* ElaWindow::getCentralWidget(int index) const
|
||||
{
|
||||
QWidget *ElaWindow::getCentralWidget(int index) const {
|
||||
Q_D(const ElaWindow);
|
||||
if (index >= d->_centerStackedWidget->count() || index < 1)
|
||||
{
|
||||
if (index >= d->_centerStackedWidget->count() || index < 1) {
|
||||
return nullptr;
|
||||
}
|
||||
return d->_centerStackedWidget->widget(index);
|
||||
}
|
||||
|
||||
bool ElaWindow::getNavigationNodeIsExpanded(QString expanderKey) const
|
||||
{
|
||||
bool ElaWindow::getNavigationNodeIsExpanded(QString expanderKey) const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationBar->getNavigationNodeIsExpanded(expanderKey);
|
||||
}
|
||||
|
||||
void ElaWindow::expandNavigationNode(QString expanderKey)
|
||||
{
|
||||
void ElaWindow::expandNavigationNode(QString expanderKey) {
|
||||
Q_D(ElaWindow);
|
||||
d->_navigationBar->expandNavigationNode(expanderKey);
|
||||
}
|
||||
|
||||
void ElaWindow::collpaseNavigationNode(QString expanderKey)
|
||||
{
|
||||
void ElaWindow::collpaseNavigationNode(QString expanderKey) {
|
||||
Q_D(ElaWindow);
|
||||
d->_navigationBar->collpaseNavigationNode(expanderKey);
|
||||
}
|
||||
|
||||
void ElaWindow::removeNavigationNode(QString nodeKey) const
|
||||
{
|
||||
void ElaWindow::removeNavigationNode(QString nodeKey) const {
|
||||
Q_D(const ElaWindow);
|
||||
d->_navigationBar->removeNavigationNode(nodeKey);
|
||||
}
|
||||
|
||||
int ElaWindow::getPageOpenInNewWindowCount(QString nodeKey) const
|
||||
{
|
||||
int ElaWindow::getPageOpenInNewWindowCount(QString nodeKey) const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationBar->getPageOpenInNewWindowCount(nodeKey);
|
||||
}
|
||||
|
||||
void ElaWindow::setNodeKeyPoints(QString nodeKey, int keyPoints)
|
||||
{
|
||||
void ElaWindow::setNodeKeyPoints(QString nodeKey, int keyPoints) {
|
||||
Q_D(ElaWindow);
|
||||
d->_navigationBar->setNodeKeyPoints(nodeKey, keyPoints);
|
||||
}
|
||||
|
||||
int ElaWindow::getNodeKeyPoints(QString nodeKey) const
|
||||
{
|
||||
int ElaWindow::getNodeKeyPoints(QString nodeKey) const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationBar->getNodeKeyPoints(nodeKey);
|
||||
}
|
||||
|
||||
void ElaWindow::navigation(QString pageKey)
|
||||
{
|
||||
void ElaWindow::navigation(QString pageKey) {
|
||||
Q_D(ElaWindow);
|
||||
d->_navigationBar->navigation(pageKey);
|
||||
}
|
||||
|
||||
int ElaWindow::getCurrentNavigationIndex() const
|
||||
{
|
||||
int ElaWindow::getCurrentNavigationIndex() const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationCenterStackedWidget->currentIndex();
|
||||
}
|
||||
|
||||
QString ElaWindow::getCurrentNavigationPageKey() const
|
||||
{
|
||||
QString ElaWindow::getCurrentNavigationPageKey() const {
|
||||
Q_D(const ElaWindow);
|
||||
return d->_navigationCenterStackedWidget->currentWidget()->property("ElaPageKey").toString();
|
||||
}
|
||||
|
||||
void ElaWindow::setWindowButtonFlag(ElaAppBarType::ButtonType buttonFlag, bool isEnable)
|
||||
{
|
||||
void ElaWindow::setWindowButtonFlag(ElaAppBarType::ButtonType buttonFlag, bool isEnable) {
|
||||
Q_D(ElaWindow);
|
||||
d->_appBar->setWindowButtonFlag(buttonFlag, isEnable);
|
||||
}
|
||||
|
||||
void ElaWindow::setWindowButtonFlags(ElaAppBarType::ButtonFlags buttonFlags)
|
||||
{
|
||||
void ElaWindow::setWindowButtonFlags(ElaAppBarType::ButtonFlags buttonFlags) {
|
||||
Q_D(ElaWindow);
|
||||
d->_appBar->setWindowButtonFlags(buttonFlags);
|
||||
}
|
||||
|
||||
ElaAppBarType::ButtonFlags ElaWindow::getWindowButtonFlags() const
|
||||
{
|
||||
return d_ptr->_appBar->getWindowButtonFlags();
|
||||
}
|
||||
ElaAppBarType::ButtonFlags ElaWindow::getWindowButtonFlags() const { return d_ptr->_appBar->getWindowButtonFlags(); }
|
||||
|
||||
void ElaWindow::closeWindow()
|
||||
{
|
||||
void ElaWindow::closeWindow() {
|
||||
Q_D(ElaWindow);
|
||||
d->_isWindowClosing = true;
|
||||
d->_appBar->closeWindow();
|
||||
}
|
||||
|
||||
bool ElaWindow::eventFilter(QObject* watched, QEvent* event)
|
||||
{
|
||||
bool ElaWindow::eventFilter(QObject *watched, QEvent *event) {
|
||||
Q_D(ElaWindow);
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::Resize:
|
||||
{
|
||||
switch (event->type()) {
|
||||
case QEvent::Resize: {
|
||||
d->_doNavigationDisplayModeChange();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return QMainWindow::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
QMenu* ElaWindow::createPopupMenu()
|
||||
{
|
||||
ElaMenu* menu = nullptr;
|
||||
QList<QDockWidget*> dockwidgets = findChildren<QDockWidget*>();
|
||||
if (dockwidgets.size())
|
||||
{
|
||||
QMenu *ElaWindow::createPopupMenu() {
|
||||
ElaMenu *menu = nullptr;
|
||||
QList<QDockWidget *> dockwidgets = findChildren<QDockWidget *>();
|
||||
if (dockwidgets.size()) {
|
||||
menu = new ElaMenu(this);
|
||||
for (int i = 0; i < dockwidgets.size(); ++i)
|
||||
{
|
||||
QDockWidget* dockWidget = dockwidgets.at(i);
|
||||
if (dockWidget->parentWidget() == this)
|
||||
{
|
||||
for (int i = 0; i < dockwidgets.size(); ++i) {
|
||||
QDockWidget *dockWidget = dockwidgets.at(i);
|
||||
if (dockWidget->parentWidget() == this) {
|
||||
menu->addAction(dockwidgets.at(i)->toggleViewAction());
|
||||
}
|
||||
}
|
||||
menu->addSeparator();
|
||||
}
|
||||
|
||||
QList<QToolBar*> toolbars = findChildren<QToolBar*>();
|
||||
if (toolbars.size())
|
||||
{
|
||||
if (!menu)
|
||||
{
|
||||
QList<QToolBar *> toolbars = findChildren<QToolBar *>();
|
||||
if (toolbars.size()) {
|
||||
if (!menu) {
|
||||
menu = new ElaMenu(this);
|
||||
}
|
||||
for (int i = 0; i < toolbars.size(); ++i)
|
||||
{
|
||||
QToolBar* toolBar = toolbars.at(i);
|
||||
if (toolBar->parentWidget() == this)
|
||||
{
|
||||
for (int i = 0; i < toolbars.size(); ++i) {
|
||||
QToolBar *toolBar = toolbars.at(i);
|
||||
if (toolBar->parentWidget() == this) {
|
||||
menu->addAction(toolbars.at(i)->toggleViewAction());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (menu)
|
||||
{
|
||||
if (menu) {
|
||||
menu->setMenuItemHeight(28);
|
||||
}
|
||||
return menu;
|
||||
|
||||
Reference in New Issue
Block a user