- Fix bug on search box

- Add QML debug capability
This commit is contained in:
Julien Wadel 2020-02-23 11:59:24 +01:00
parent 8ecf97306f
commit deb3cf183a
6 changed files with 30 additions and 4 deletions

View file

@ -30,6 +30,7 @@
- Play a sound when DTMF is sent.
- Do not use `:` separator when a file is saved on Windows.
- Avoid mark as read on selected chat room if window is not active.
- Search box in main page will not reset its text when clicking on it
### Removed

View file

@ -113,6 +113,7 @@ else()
# Build configuration
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -DQT_NO_DEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG")
if( WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WINSOCKAPI_")#remove error from windows headers order

View file

@ -20,10 +20,16 @@
#include "AppController.hpp"
#include <qloggingcategory.h>
#ifdef QT_QML_DEBUG
#include <QQmlDebuggingEnabler>
#endif
// =============================================================================
int main (int argc, char *argv[]) {
AppController controller(argc, argv);
#ifdef QT_QML_DEBUG
QQmlDebuggingEnabler enabler;
#endif
//QLoggingCategory::setFilterRules("*.debug=true;qml=false");
App *app = controller.getApp();
if (app->isSecondary())

View file

@ -1,4 +1,5 @@
import QtQuick 2.7
import QtQuick.Controls 2.2 as Controls
import Common 1.0
import Utils 1.0
@ -53,6 +54,7 @@ Item {
model.setFilter(text)
}
// ---------------------------------------------------------------------------
implicitHeight: searchField.height
@ -73,12 +75,13 @@ Item {
searchBox.enterPressed()
searchBox.closeMenu()
}
onActiveFocusChanged: {
if (activeFocus && !_isOpen) {
searchBox.menuRequested()
searchBox.openMenu()
}
}else if( !activeFocus)
searchBox.closeMenu()
}
onTextChanged: _filter(text)
@ -111,6 +114,19 @@ Item {
value: searchBox.view.header ? ListView.OverlayHeader : ListView.InlineFooter
}
}
MouseArea
{// Just take hover events and set popup to do its automatic close if mouse is not inside field/popup area
anchors.fill: parent
onContainsMouseChanged: menu.popup.closePolicy=(containsMouse?Controls.Popup.NoAutoClose:Controls.Popup.CloseOnEscape | Controls.Popup.CloseOnPressOutside)
hoverEnabled:true
preventStealing: true
propagateComposedEvents:true
onPressed: mouse.accepted=false
onReleased: mouse.accepted=false
onClicked: mouse.accepted=false
onDoubleClicked: mouse.accepted=false
onPressAndHold: mouse.accepted=false
}
// ---------------------------------------------------------------------------

View file

@ -19,6 +19,7 @@ Item {
property int maxMenuHeight
default property alias _content: menuContent.data
property alias popup : popup
// ---------------------------------------------------------------------------
@ -64,7 +65,7 @@ Item {
// ---------------------------------------------------------------------------
Popup {
id: popup
id: popup
onOpened: menu.opened()
onClosed: menu.closed()

View file

@ -15,6 +15,7 @@ Item {
property int relativeY: 0
default property alias _content: popup.contentItem
property alias closePolicy : popup.closePolicy
// ---------------------------------------------------------------------------
@ -83,7 +84,7 @@ Item {
}
}
padding: 0
padding: 0
Component.onCompleted: parent = Utils.getTopParent(this)