mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-27 06:03:51 +03:00
provide fastLayoutManager.joinLayoutsToMainLayout
This commit is contained in:
parent
c3e6f3c04f
commit
2d812552b1
@ -831,33 +831,15 @@ Item {
|
||||
|
||||
function moveAppletsBasedOnJustifyAlignment() {
|
||||
layouter.appletsInParentChange = true;
|
||||
console.log("LAYOUTS: Moving applets from MAIN to THREE Layouts mode...");
|
||||
fastLayoutManager.moveAppletsInJustifyAlignment();
|
||||
layouter.appletsInParentChange = false;
|
||||
}
|
||||
|
||||
function joinLayoutsToMainLayout() {
|
||||
layouter.appletsInParentChange = true;
|
||||
|
||||
console.log("LAYOUTS: Moving applets from THREE to MAIN Layout mode...");
|
||||
var totalChildren1 = layoutsContainer.mainLayout.children.length;
|
||||
for (var i=totalChildren1-1; i>=0; --i) {
|
||||
var item1 = layoutsContainer.mainLayout.children[0];
|
||||
item1.parent = layoutsContainer.startLayout;
|
||||
}
|
||||
|
||||
var totalChildren2 = layoutsContainer.endLayout.children.length;
|
||||
|
||||
for (var i=totalChildren2-1; i>=0; --i) {
|
||||
var item2 = layoutsContainer.endLayout.children[0];
|
||||
item2.parent = layoutsContainer.startLayout;
|
||||
}
|
||||
|
||||
var totalChildrenL = layoutsContainer.startLayout.children.length;
|
||||
for (var i=totalChildrenL-1; i>=0; --i) {
|
||||
var itemL = layoutsContainer.startLayout.children[0];
|
||||
itemL.parent = layoutsContainer.mainLayout;
|
||||
}
|
||||
|
||||
fastLayoutManager.joinLayoutsToMainLayout();
|
||||
layouter.appletsInParentChange = false;
|
||||
}
|
||||
|
||||
|
@ -261,6 +261,42 @@ void LayoutManager::insertAtCoordinates(QQuickItem *item, const int &x, const in
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutManager::joinLayoutsToMainLayout()
|
||||
{
|
||||
if (!m_startLayout || !m_mainLayout || !m_endLayout) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_startLayout->childItems().count() > 0) {
|
||||
int size = m_startLayout->childItems().count();
|
||||
for (int i=size-1; i>=0; --i) {
|
||||
QQuickItem *lastStartLayoutItem = m_startLayout->childItems()[i];
|
||||
QQuickItem *firstMainLayoutItem = m_mainLayout->childItems().count() > 0 ? m_mainLayout->childItems()[0] : nullptr;
|
||||
|
||||
lastStartLayoutItem->setParentItem(m_mainLayout);
|
||||
|
||||
if (firstMainLayoutItem) {
|
||||
lastStartLayoutItem->stackBefore(firstMainLayoutItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_endLayout->childItems().count() > 0) {
|
||||
int size = m_endLayout->childItems().count();
|
||||
for (int i=0; i<size; ++i) {
|
||||
QQuickItem *firstEndLayoutItem = m_endLayout->childItems()[0];
|
||||
QQuickItem *lastMainLayoutItem = m_mainLayout->childItems().count() > 0 ? m_mainLayout->childItems()[m_mainLayout->childItems().count()-1] : nullptr;
|
||||
|
||||
firstEndLayoutItem->setParentItem(m_mainLayout);
|
||||
|
||||
if (lastMainLayoutItem) {
|
||||
firstEndLayoutItem->stackAfter(lastMainLayoutItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void LayoutManager::moveAppletsInJustifyAlignment()
|
||||
{
|
||||
if (!m_startLayout || !m_mainLayout || !m_endLayout) {
|
||||
|
@ -64,6 +64,7 @@ public:
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE void moveAppletsInJustifyAlignment();
|
||||
Q_INVOKABLE void joinLayoutsToMainLayout();
|
||||
Q_INVOKABLE void insertBefore(QQuickItem *hoveredItem, QQuickItem *item);
|
||||
Q_INVOKABLE void insertAfter(QQuickItem *hoveredItem, QQuickItem *item);
|
||||
Q_INVOKABLE void insertAtCoordinates(QQuickItem *item, const int &x, const int &y);
|
||||
|
Loading…
x
Reference in New Issue
Block a user