1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
#include "mdichild.h"
#include "mdiwindow.h"
#include "iconmanager.h"
#include "mainwindow.h"
#include <QDebug>
MdiChild::MdiChild(QWidget* parent) :
QWidget(parent)
{
}
MdiChild::~MdiChild()
{
}
QVariant MdiChild::getSessionValue()
{
QVariant value = saveSession();
QHash<QString, QVariant> hash = value.toHash();
hash["class"] = QString(metaObject()->className());
return hash;
}
bool MdiChild::applySessionValue(const QVariant& sessionValue)
{
bool result = restoreSession(sessionValue);
return result;
}
MdiWindow* MdiChild::getMdiWindow() const
{
return mdiWindow;
}
void MdiChild::setMdiWindow(MdiWindow* value)
{
mdiWindow = value;
if (mdiWindow)
{
mdiWindow->setWindowTitle(getTitleForMdiWindow());
mdiWindow->setWindowIcon(*getIconNameForMdiWindow());
}
}
bool MdiChild::isInvalid() const
{
return invalid;
}
bool MdiChild::restoreSessionNextTime()
{
return true;
}
void MdiChild::updateWindowTitle()
{
if (mdiWindow)
{
QString newTitle = getTitleForMdiWindow();
if (mdiWindow->windowTitle() != newTitle)
mdiWindow->rename(newTitle);
}
}
bool MdiChild::handleInitialFocus()
{
return false;
}
Db* MdiChild::getAssociatedDb() const
{
return nullptr;
}
void MdiChild::dbClosedFinalCleanup()
{
}
bool MdiChild::isWindowClosingBlocked() const
{
return false;
}
|