mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-06 14:29:54 +08:00
MainWindow: fix layout restore issue
This commit is contained in:
parent
cd0abc5323
commit
f56fe42c6c
@ -79,6 +79,9 @@ MainWindow::~MainWindow()
|
|||||||
void MainWindow::kickOffOnStart(const QStringList &p_paths)
|
void MainWindow::kickOffOnStart(const QStringList &p_paths)
|
||||||
{
|
{
|
||||||
QTimer::singleShot(300, [this, p_paths]() {
|
QTimer::singleShot(300, [this, p_paths]() {
|
||||||
|
// Need to load the state of dock widgets again after the main window is shown.
|
||||||
|
loadStateAndGeometry(true);
|
||||||
|
|
||||||
VNoteX::getInst().initLoad();
|
VNoteX::getInst().initLoad();
|
||||||
|
|
||||||
emit mainWindowStarted();
|
emit mainWindowStarted();
|
||||||
@ -453,12 +456,12 @@ void MainWindow::saveStateAndGeometry()
|
|||||||
sessionConfig.setMainWindowStateGeometry(sg);
|
sessionConfig.setMainWindowStateGeometry(sg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::loadStateAndGeometry()
|
void MainWindow::loadStateAndGeometry(bool p_stateOnly)
|
||||||
{
|
{
|
||||||
const auto& sessionConfig = ConfigMgr::getInst().getSessionConfig();
|
const auto& sessionConfig = ConfigMgr::getInst().getSessionConfig();
|
||||||
const auto sg = sessionConfig.getMainWindowStateGeometry();
|
const auto sg = sessionConfig.getMainWindowStateGeometry();
|
||||||
|
|
||||||
if (!sg.m_mainGeometry.isEmpty()) {
|
if (!p_stateOnly && !sg.m_mainGeometry.isEmpty()) {
|
||||||
restoreGeometry(sg.m_mainGeometry);
|
restoreGeometry(sg.m_mainGeometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ namespace vnotex
|
|||||||
|
|
||||||
void saveStateAndGeometry();
|
void saveStateAndGeometry();
|
||||||
|
|
||||||
void loadStateAndGeometry();
|
void loadStateAndGeometry(bool p_stateOnly = false);
|
||||||
|
|
||||||
// Used to test widget in development.
|
// Used to test widget in development.
|
||||||
void demoWidget();
|
void demoWidget();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user