wip
This commit is contained in:
@@ -147,7 +147,7 @@ QVariantMap Item::toVariantMap() const
|
||||
|
||||
void Item::fillFromVariantMap(const QVariantMap &map, const QHash<QString, GuestInterface *> &widgets)
|
||||
{
|
||||
m_sizingInfo.fromVariantMap(map);
|
||||
m_sizingInfo.fromVariantMap(map[QStringLiteral("sizingInfo")].toMap());
|
||||
m_isVisible = map[QStringLiteral("isVisible")].toBool();
|
||||
setObjectName(map[QStringLiteral("objectName")].toString());
|
||||
|
||||
@@ -468,13 +468,16 @@ void Item::setIsVisible(bool is)
|
||||
if (is != m_isVisible) {
|
||||
m_isVisible = is;
|
||||
Q_EMIT visibleChanged(this, is);
|
||||
}
|
||||
|
||||
if (is) {
|
||||
if (auto w = frame()) {
|
||||
w->setGeometry(mapToRoot(m_sizingInfo.geometry)); // TODO
|
||||
w->setVisible(is); // TODO: Only set visible when apply*() ?
|
||||
w->setVisible(true); // TODO: Only set visible when apply*() ?
|
||||
}
|
||||
updateObjectName();
|
||||
}
|
||||
|
||||
updateObjectName();
|
||||
}
|
||||
|
||||
void Item::setGeometry_recursive(QRect rect)
|
||||
@@ -499,6 +502,11 @@ bool Item::checkSanity()
|
||||
}
|
||||
|
||||
if (auto w = frame()) {
|
||||
if (!w->isVisible() && (!w->parentWidget() || !w->parentWidget()->isVisible())) {
|
||||
qWarning() << Q_FUNC_INFO << "Guest widget isn't visible" << this;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true; // TODO Uncomment only after honouring layoutInvalidated()
|
||||
if (mapFromRoot(w->geometry()) != geometry()) {
|
||||
qWarning() << Q_FUNC_INFO << "Guest widget doesn't have correct geometry. has="
|
||||
@@ -2381,14 +2389,6 @@ void ItemContainer::fillFromVariantMap(const QVariantMap &map,
|
||||
}
|
||||
}
|
||||
|
||||
ItemContainer *ItemContainer::createFromVariantMap(QWidget *hostWidget, ItemContainer *parent,
|
||||
const QVariantMap &map, const QHash<QString, GuestInterface*> &widgets)
|
||||
{
|
||||
auto container = new ItemContainer(hostWidget, parent);
|
||||
container->fillFromVariantMap(map, widgets);
|
||||
return container;
|
||||
}
|
||||
|
||||
QVector<Layouting::Anchor*> ItemContainer::separators_recursive() const
|
||||
{
|
||||
Layouting::Anchor::List separators = m_separators;
|
||||
|
||||
@@ -549,8 +549,6 @@ public:
|
||||
|
||||
QVariantMap toVariantMap() const override;
|
||||
void fillFromVariantMap(const QVariantMap &map, const QHash<QString, GuestInterface *> &widgets) override;
|
||||
static ItemContainer* createFromVariantMap(QWidget *hostWidget, ItemContainer *parent,
|
||||
const QVariantMap &map, const QHash<QString, GuestInterface*> &widgets);
|
||||
|
||||
Q_SIGNALS:
|
||||
void itemsChanged();
|
||||
|
||||
@@ -99,7 +99,10 @@ static bool serializeDeserializeTest(const std::unique_ptr<ItemContainer> &root)
|
||||
|
||||
static std::unique_ptr<ItemContainer> createRoot()
|
||||
{
|
||||
auto root = new ItemContainer(new QWidget()); // todo WIDGET
|
||||
auto hostWidget = new QWidget();
|
||||
hostWidget->setObjectName("HostWidget");
|
||||
hostWidget->show();
|
||||
auto root = new ItemContainer(hostWidget); // todo WIDGET
|
||||
root->setSize({ 1000, 1000 });
|
||||
return std::unique_ptr<ItemContainer>(root);
|
||||
}
|
||||
@@ -108,7 +111,10 @@ static Item* createItem()
|
||||
{
|
||||
static int count = 0;
|
||||
count++;
|
||||
auto item = new Item(new QWidget());
|
||||
auto hostWidget = new QWidget();
|
||||
hostWidget->setObjectName("HostWidget");
|
||||
hostWidget->show();
|
||||
auto item = new Item(hostWidget);
|
||||
item->setGeometry(QRect(0, 0, 200, 200));
|
||||
item->setObjectName(QStringLiteral("%1").arg(count));
|
||||
auto guest = new GuestWidget();
|
||||
|
||||
@@ -1144,7 +1144,7 @@ void TestDocks::tst_restoreSimplest()
|
||||
EnsureTopLevelsDeleted e;
|
||||
// Tests restoring a very simple layout, composed of just 1 docked widget
|
||||
auto m = createMainWindow(QSize(800, 500), MainWindowOption_None);
|
||||
//auto layout = m->multiSplitterLayout();
|
||||
auto layout = m->multiSplitterLayout();
|
||||
auto dock1 = createDockWidget("one", new QTextEdit());
|
||||
m->addDockWidget(dock1, Location_OnTop);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user