mirror of
https://github.com/tnodir/fort
synced 2024-11-15 05:25:56 +00:00
UI: HomeWindow: Fix window flickering on open
This commit is contained in:
parent
b2bf6ff301
commit
edb0bc5e3f
@ -2,7 +2,7 @@
|
||||
|
||||
#include <QIcon>
|
||||
#include <QLabel>
|
||||
#include <QStackedLayout>
|
||||
#include <QStackedWidget>
|
||||
#include <QToolButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
@ -39,7 +39,7 @@ void HomeMainPage::setupUi()
|
||||
setupStackedLayout();
|
||||
|
||||
layout->addLayout(sideBar);
|
||||
layout->addLayout(m_stackedLayout, 1);
|
||||
layout->addWidget(m_stackedPages, 1);
|
||||
|
||||
this->setLayout(layout);
|
||||
}
|
||||
@ -74,18 +74,18 @@ void HomeMainPage::setupSideBarButtons()
|
||||
|
||||
void HomeMainPage::setupStackedLayout()
|
||||
{
|
||||
m_stackedLayout = new QStackedLayout();
|
||||
m_stackedPages = new QStackedWidget();
|
||||
|
||||
m_stackedLayout->addWidget(new HomePage(ctrl()));
|
||||
m_stackedLayout->addWidget(new AboutPage(ctrl()));
|
||||
m_stackedPages->addWidget(new HomePage(ctrl()));
|
||||
m_stackedPages->addWidget(new AboutPage(ctrl()));
|
||||
}
|
||||
|
||||
void HomeMainPage::setCurrentTab(TabIndex tabIndex)
|
||||
{
|
||||
if (m_stackedLayout->currentIndex() == tabIndex)
|
||||
if (m_stackedPages->currentIndex() == tabIndex)
|
||||
return;
|
||||
|
||||
m_stackedLayout->setCurrentIndex(tabIndex);
|
||||
m_stackedPages->setCurrentIndex(tabIndex);
|
||||
|
||||
buttonAt(tabIndex)->animateClick();
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "homebasepage.h"
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QStackedLayout)
|
||||
QT_FORWARD_DECLARE_CLASS(QStackedWidget)
|
||||
|
||||
class HomeMainPage : public HomeBasePage
|
||||
{
|
||||
@ -30,7 +30,7 @@ private:
|
||||
|
||||
private:
|
||||
QVector<QToolButton *> m_buttons;
|
||||
QStackedLayout *m_stackedLayout = nullptr;
|
||||
QStackedWidget *m_stackedPages = nullptr;
|
||||
};
|
||||
|
||||
#endif // HOMEMAINPAGE_H
|
||||
|
Loading…
Reference in New Issue
Block a user