* disable drop in qtlineedit
fixes bug where when file is dropped in the lineedit with text,
the the file will be added as text midst the existing text
* move message to start from script before layout loading so it will load right
(only when started without script on linux)
* center subwindow when mainwindow size changes
103 lines
1.4 KiB
C++
103 lines
1.4 KiB
C++
#include "qt/window/QtWindowStack.h"
|
|
|
|
#include "qt/window/QtWindow.h"
|
|
|
|
|
|
QtWindowStackElement::QtWindowStackElement(QWidget* parent)
|
|
: QWidget(parent)
|
|
{
|
|
}
|
|
|
|
QtWindowStack::QtWindowStack(QObject* parent)
|
|
: QObject(parent)
|
|
{
|
|
}
|
|
|
|
QtWindowStackElement* QtWindowStack::getTopWindow()
|
|
{
|
|
if (m_stack.size())
|
|
{
|
|
return m_stack.back();
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
QtWindowStackElement* QtWindowStack::getBottomWindow()
|
|
{
|
|
if (m_stack.size())
|
|
{
|
|
return m_stack.front();
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
size_t QtWindowStack::getWindowCount()
|
|
{
|
|
return m_stack.size();
|
|
}
|
|
|
|
void QtWindowStack::pushWindow(QtWindowStackElement* window)
|
|
{
|
|
if (m_stack.size())
|
|
{
|
|
m_stack.back()->hideWindow();
|
|
}
|
|
|
|
window->showWindow();
|
|
|
|
m_stack.push_back(window);
|
|
|
|
emit push();
|
|
}
|
|
|
|
void QtWindowStack::popWindow()
|
|
{
|
|
if (m_stack.size())
|
|
{
|
|
m_stack.back()->hideWindow();
|
|
delete m_stack.back();
|
|
m_stack.pop_back();
|
|
|
|
emit pop();
|
|
}
|
|
|
|
if (m_stack.size())
|
|
{
|
|
m_stack.back()->showWindow();
|
|
}
|
|
else
|
|
{
|
|
emit empty();
|
|
}
|
|
}
|
|
|
|
void QtWindowStack::centerSubWindows()
|
|
{
|
|
for (QtWindowStackElement* window : m_stack)
|
|
{
|
|
QtWindow* qtWindow = dynamic_cast<QtWindow*>(window);
|
|
if (qtWindow)
|
|
{
|
|
if (qtWindow->isSubWindow())
|
|
{
|
|
qtWindow->moveToCenter();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void QtWindowStack::clearWindows()
|
|
{
|
|
for (QtWindowStackElement* window : m_stack)
|
|
{
|
|
window->hideWindow();
|
|
delete window;
|
|
}
|
|
|
|
m_stack.clear();
|
|
|
|
emit empty();
|
|
}
|