mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-22 22:28:08 +00:00
unstable
This commit is contained in:
parent
e25e77f419
commit
2fa7c843d4
5 changed files with 49 additions and 61 deletions
|
|
@ -57,7 +57,7 @@ Item {
|
|||
function _checkPosition (positionEvent) {
|
||||
// Propagate event.
|
||||
positionEvent.accepted = false
|
||||
console.log('click', positionEvent.x, positionEvent.y)
|
||||
|
||||
// Click is outside or not.
|
||||
if (!Utils.pointIsInItem(this, item, positionEvent)) {
|
||||
if (_timeout != null) {
|
||||
|
|
|
|||
|
|
@ -1,17 +1,16 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Window 2.2
|
||||
|
||||
import Utils 1.0
|
||||
// ===================================================================
|
||||
|
||||
Item {
|
||||
id: wrapper
|
||||
|
||||
// Not a private property. Can be used with an id.
|
||||
default property alias content: content.data
|
||||
|
||||
property alias popupX: popup.x
|
||||
property alias popupY: popup.y
|
||||
|
||||
default property alias _content: content.data
|
||||
|
||||
function show () {
|
||||
popup.show()
|
||||
}
|
||||
|
|
@ -20,18 +19,23 @@ Item {
|
|||
popup.hide()
|
||||
}
|
||||
|
||||
x: 0
|
||||
y: 0
|
||||
// DO NOT TOUCH THIS PROPERTIES.
|
||||
|
||||
// No visible.
|
||||
visible: false
|
||||
|
||||
// No size, no position.
|
||||
height: 0
|
||||
width: 0
|
||||
visible: false
|
||||
x: 0
|
||||
y: 0
|
||||
|
||||
Window {
|
||||
id: popup
|
||||
|
||||
flags: Qt.SplashScreen
|
||||
height: wrapper.content[0] != null ? wrapper.content[0].height : 0
|
||||
width: wrapper.content[0] != null ? wrapper.content[0].width : 0
|
||||
height: _content[0] != null ? _content[0].height : 0
|
||||
width: _content[0] != null ? _content[0].width : 0
|
||||
|
||||
Item {
|
||||
id: content
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import QtQuick 2.7
|
|||
import QtQuick.Controls 2.0
|
||||
|
||||
import Common.Styles 1.0
|
||||
import Utils 1.0
|
||||
|
||||
// ===================================================================
|
||||
// A reusable search input which display a entries model in a menu.
|
||||
// Each entry can be filtered with the search input.
|
||||
|
|
@ -30,6 +30,7 @@ Item {
|
|||
menu.hideMenu()
|
||||
shadow.visible = false
|
||||
searchField.focus = false
|
||||
desktopPopup.hide()
|
||||
|
||||
menuClosed()
|
||||
}
|
||||
|
|
@ -37,16 +38,11 @@ Item {
|
|||
function _showMenu () {
|
||||
menu.showMenu()
|
||||
shadow.visible = true
|
||||
desktopPopup.show()
|
||||
|
||||
menuOpened()
|
||||
}
|
||||
|
||||
function getMenuInstance () {
|
||||
console.log('instance parent', Utils.getTopParent(item))
|
||||
|
||||
return menu
|
||||
}
|
||||
|
||||
implicitHeight: searchField.height
|
||||
|
||||
Item {
|
||||
|
|
@ -73,22 +69,6 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
DropDownDynamicMenu {
|
||||
id: menu
|
||||
|
||||
//anchors.top: searchField.bottom
|
||||
launcher: searchField
|
||||
width: searchField.width
|
||||
|
||||
onMenuClosed: _hideMenu()
|
||||
|
||||
ScrollableListView {
|
||||
id: list
|
||||
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
PopupShadow {
|
||||
id: shadow
|
||||
|
||||
|
|
@ -96,5 +76,37 @@ Item {
|
|||
source: searchField
|
||||
visible: false
|
||||
}
|
||||
|
||||
DesktopPopup {
|
||||
id: desktopPopup
|
||||
|
||||
property point coords: {
|
||||
var point = searchBox.mapToItem(null, 0, searchBox.height)
|
||||
point.x += window.x
|
||||
point.y += window.y
|
||||
|
||||
return point
|
||||
}
|
||||
|
||||
popupX: coords.x
|
||||
popupY: coords.y
|
||||
|
||||
onVisibleChanged: !visible && searchBox._hideMenu()
|
||||
|
||||
DropDownDynamicMenu {
|
||||
id: menu
|
||||
|
||||
launcher: searchField
|
||||
width: searchField.width
|
||||
|
||||
onMenuClosed: _hideMenu()
|
||||
|
||||
ScrollableListView {
|
||||
id: list
|
||||
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,6 @@ function qmlTypeof (object, className) {
|
|||
function pointIsInItem (source, target, point) {
|
||||
point = source.mapToItem(target.parent, point.x, point.y)
|
||||
|
||||
console.log('mapped point', point.x, point.y, target.x, target.y)
|
||||
return (
|
||||
point.x >= target.x &&
|
||||
point.y >= target.y &&
|
||||
|
|
|
|||
|
|
@ -71,24 +71,6 @@ ApplicationWindow {
|
|||
onClicked: Utils.openWindow('NewCall', window)
|
||||
}
|
||||
|
||||
DesktopPopup {
|
||||
id: desktopPopup
|
||||
|
||||
property point coords: {
|
||||
var point = searchBox.mapToItem(null, 0, searchBox.height)
|
||||
point.x += window.x
|
||||
point.y += window.y
|
||||
|
||||
return point
|
||||
}
|
||||
|
||||
content: searchBox.getMenuInstance()
|
||||
popupX: coords.x
|
||||
popupY: coords.y
|
||||
|
||||
onVisibleChanged: !visible && searchBox._hideMenu()
|
||||
}
|
||||
|
||||
// Search.
|
||||
SearchBox {
|
||||
id: searchBox
|
||||
|
|
@ -98,15 +80,6 @@ ApplicationWindow {
|
|||
placeholderText: qsTr('mainSearchBarPlaceholder')
|
||||
entryHeight: 50
|
||||
|
||||
onMenuClosed: {
|
||||
console.log('close')
|
||||
desktopPopup.hide()
|
||||
}
|
||||
|
||||
onMenuOpened: {
|
||||
desktopPopup.show()
|
||||
}
|
||||
|
||||
model: model1
|
||||
|
||||
delegate: Contact {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue