fix(desktop_menu): update size request

pull/31/head
kate 5 years ago
parent 11697565e1
commit 2bcb04a0db

@ -53,8 +53,10 @@ Item {
anchors.fill: parent
color: "transparent"
radius: _background.radius
border.width: 1 / FishUI.Theme.devicePixelRatio
border.pixelAligned: FishUI.Theme.devicePixelRatio > 1 ? false : true
border.color: FishUI.Theme.darkMode ? Qt.rgba(255, 255, 255, 0.1) : Qt.rgba(0, 0, 0, 0.1)
visible: control.borderEnabled
antialiasing: true
}
}
}

@ -71,7 +71,7 @@ Window {
FishUI.WindowShadow {
view: control
radius: _background.radius
strength: control.active ? 1.5 : 0.5
strength: control.active ? 1.5 : 0.9
}
// Left bottom edge

@ -97,6 +97,9 @@ void MenuPopupWindow::setPopupContentItem(QQuickItem *contentItem)
contentItem->setParentItem(this->contentItem());
m_contentItem = contentItem;
connect(contentItem, &QQuickItem::implicitWidthChanged, this, &MenuPopupWindow::updateGeometry);
connect(contentItem, &QQuickItem::implicitHeightChanged, this, &MenuPopupWindow::updateGeometry);
}
void MenuPopupWindow::dismissPopup()
@ -106,6 +109,16 @@ void MenuPopupWindow::dismissPopup()
hide();
}
void MenuPopupWindow::updateGeometry()
{
int w = m_contentItem->implicitWidth();
int h = m_contentItem->implicitHeight() + 16;
int posx = geometry().x();
int posy = geometry().y();
setGeometry(posx, posy, w, h);
}
void MenuPopupWindow::mouseMoveEvent(QMouseEvent *e)
{
m_mouseMoved = true;

@ -43,6 +43,7 @@ public:
public slots:
Q_INVOKABLE void show();
Q_INVOKABLE void dismissPopup();
Q_INVOKABLE void updateGeometry();
signals:
void popupDismissed();

Loading…
Cancel
Save