diff --git a/Linphone/core/call-history/CallHistoryProxy.cpp b/Linphone/core/call-history/CallHistoryProxy.cpp index d1ef23296..4d839b8f7 100644 --- a/Linphone/core/call-history/CallHistoryProxy.cpp +++ b/Linphone/core/call-history/CallHistoryProxy.cpp @@ -61,7 +61,7 @@ bool CallHistoryProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QMo QRegularExpression search(QRegularExpression::escape(mFilterText), QRegularExpression::CaseInsensitiveOption | QRegularExpression::UseUnicodePropertiesOption); - auto callLog = qobject_cast(sourceModel())->getAt(sourceRow); + auto callLog = getItemAtSource(sourceRow); show = callLog->mIsConference ? callLog->mDisplayName.contains(search) : callLog->mRemoteAddress.contains(search); } diff --git a/Linphone/core/phone-number/PhoneNumber.cpp b/Linphone/core/phone-number/PhoneNumber.cpp index 57e5c572f..e1c6bb8e7 100644 --- a/Linphone/core/phone-number/PhoneNumber.cpp +++ b/Linphone/core/phone-number/PhoneNumber.cpp @@ -32,6 +32,7 @@ QSharedPointer PhoneNumber::create(const std::shared_ptr &dialPlan) : QObject(nullptr) { // Should be call from model Thread + App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership); mustBeInLinphoneThread(getClassName()); mFlag = Utils::coreStringToAppString(dialPlan->getFlag()); mNationalNumberLength = dialPlan->getNationalNumberLength(); diff --git a/Linphone/core/phone-number/PhoneNumberProxy.cpp b/Linphone/core/phone-number/PhoneNumberProxy.cpp index 74ede3f86..59d07b775 100644 --- a/Linphone/core/phone-number/PhoneNumberProxy.cpp +++ b/Linphone/core/phone-number/PhoneNumberProxy.cpp @@ -40,7 +40,8 @@ int PhoneNumberProxy::findIndexByCountryCallingCode(const QString &countryCallin auto it = std::find_if(list.begin(), list.end(), [countryCallingCode](const QSharedPointer &a) { return a.objectCast()->mCountryCallingCode == countryCallingCode; }); - auto proxyModelIndex = mapFromSource(model->index(it - list.begin())); + auto proxyModelIndex = + dynamic_cast(sourceModel())->mapFromSource(model->index(it - list.begin())); return proxyModelIndex.row(); } @@ -50,8 +51,7 @@ bool PhoneNumberProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QMo QRegularExpression search(QRegularExpression::escape(mFilterText), QRegularExpression::CaseInsensitiveOption | QRegularExpression::UseUnicodePropertiesOption); - auto phoneNumber = qobject_cast(sourceModel())->getAt(sourceRow); - + auto phoneNumber = getItemAtSource(sourceRow); show = phoneNumber->mCountry.contains(search) || phoneNumber->mCountryCallingCode.contains(search); } diff --git a/Linphone/view/Control/Button/Button.qml b/Linphone/view/Control/Button/Button.qml index dc47f7992..2f1f35613 100644 --- a/Linphone/view/Control/Button/Button.qml +++ b/Linphone/view/Control/Button/Button.qml @@ -46,14 +46,14 @@ Control.Button { id: buttonBackground anchors.fill: parent color: mainItem.enabled - ? inversedColors - ? mainItem.pressed || mainItem.shadowEnabled - ? DefaultStyle.grey_100 - : mainItem.borderColor - : mainItem.pressed || mainItem.shadowEnabled - ? mainItem.pressedColor - : mainItem.color - : mainItem.disabledColor + ? inversedColors + ? mainItem.pressed || mainItem.shadowEnabled + ? DefaultStyle.grey_100 + : mainItem.borderColor + : mainItem.pressed || mainItem.shadowEnabled + ? mainItem.pressedColor + : mainItem.color + : mainItem.disabledColor radius: mainItem.radius border.color: inversedColors ? mainItem.color : mainItem.borderColor @@ -80,11 +80,7 @@ Control.Button { component ButtonText: Text { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - width: mainItem.text != undefined ? implicitWidth : 0 - height: implicitHeight wrapMode: Text.WrapAnywhere - // Layout.fillWidth: true - // Layout.fillHeight: true text: mainItem.text maximumLineCount: 1 color: inversedColors ? mainItem.color : mainItem.textColor @@ -99,8 +95,6 @@ Control.Button { } component ButtonImage: EffectImage { - // Layout.fillWidth: true - // Layout.fillHeight: true imageSource: mainItem.icon.source imageWidth: mainItem.icon.width imageHeight: mainItem.icon.height @@ -111,9 +105,10 @@ Control.Button { contentItem: Control.StackView{ id: stacklayout width: mainItem.width + height: mainItem.height // TODO Qt bug : contentItem is never changed.... - implicitHeight: contentItem && contentItem.implicitHeight? contentItem.implicitHeight : 0 - implicitWidth: contentItem && contentItem.implicitWidth? contentItem.implicitWidth: 0 + implicitHeight: !!contentItem && contentItem.implicitHeight ? contentItem.implicitHeight : 0 + implicitWidth: !!contentItem && contentItem.implicitWidth ? contentItem.implicitWidth: 0 function updateComponent(){ var item var component = mainItem.text.length != 0 && mainItem.icon.source.toString().length != 0 @@ -127,9 +122,9 @@ Control.Button { item = stacklayout.push(component, Control.StackView.Immediate) else if( component != stacklayout.get(0)) item = stacklayout.replace(component, Control.StackView.Immediate) - if(item){// Workaround for Qt bug : set from the item and not from the contentItem - implicitHeight = item.implicitHeight - implicitWidth = item.implicitWidth + if(item){// Workaround for Qt bug : set from the item and not from the contentItem which seems to be lost + implicitHeight = Qt.binding(function() { return item.implicitHeight}) + implicitWidth = Qt.binding(function() { return item.implicitWidth}) } } @@ -146,27 +141,40 @@ Control.Button { Component{ id: imageTextComponent RowLayout { + width: stacklayout.width + height: stacklayout.height spacing: mainItem.spacing ButtonImage{ Layout.preferredWidth: mainItem.icon.width Layout.preferredHeight: mainItem.icon.height } - ButtonText{} + ButtonText{ + Layout.fillHeight: true + Layout.fillWidth: true + } } } Component{ id: textComponent - ButtonText {} + ButtonText { + width: stacklayout.width + height: stacklayout.height + // Hack for StackView binding loop + onImplicitHeightChanged: {implicitHeight} + } } Component{ id: imageComponent - ButtonImage{} + ButtonImage{ + width: stacklayout.width + height: stacklayout.height + } } Component{ id: emptyComponent Item { - Layout.fillWidth: true - Layout.fillHeight: true + width: stacklayout.width + height: stacklayout.height } } } diff --git a/Linphone/view/Control/Display/EffectImage.qml b/Linphone/view/Control/Display/EffectImage.qml index 639e9ce9e..02f3f8005 100644 --- a/Linphone/view/Control/Display/EffectImage.qml +++ b/Linphone/view/Control/Display/EffectImage.qml @@ -79,6 +79,7 @@ Loader { shadowColor: DefaultStyle.grey_1000 shadowBlur: 0 shadowOpacity: mainItem.shadowEnabled ? 0.7 : 0.0 + z: mainItem.z - 1 } } } diff --git a/Linphone/view/Page/Layout/Login/LoginLayout.qml b/Linphone/view/Page/Layout/Login/LoginLayout.qml index a6b4db7d4..84424f0fa 100644 --- a/Linphone/view/Page/Layout/Login/LoginLayout.qml +++ b/Linphone/view/Page/Layout/Login/LoginLayout.qml @@ -33,27 +33,16 @@ Rectangle { Button { id: aboutButton Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - background: Item{} - contentItem: RowLayout { - spacing: 8 * DefaultStyle.dp - Image { - fillMode: Image.PreserveAspectFit - source: AppIcons.info - Layout.preferredWidth: 24 * DefaultStyle.dp - Layout.preferredHeight: 24 * DefaultStyle.dp - } - Text { - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - text: qsTr("À propos") - font { - underline: aboutButton.underline - pixelSize: 14 * DefaultStyle.dp - weight: 400 * DefaultStyle.dp - } - color: DefaultStyle.main2_500main - } - } + icon.width: 24 * DefaultStyle.dp + icon.height: 24 * DefaultStyle.dp + icon.source: AppIcons.info + text: qsTr("À propos") + textSize: 14 * DefaultStyle.dp + textWeight: 400 * DefaultStyle.dp + textColor: DefaultStyle.main2_500main onClicked: console.debug("[LoginLayout]User: open about popup") + + background: Item{} } } diff --git a/Linphone/view/Page/Main/Meeting/MeetingPage.qml b/Linphone/view/Page/Main/Meeting/MeetingPage.qml index 3710bedaf..204e3525c 100644 --- a/Linphone/view/Page/Main/Meeting/MeetingPage.qml +++ b/Linphone/view/Page/Main/Meeting/MeetingPage.qml @@ -584,29 +584,20 @@ AbstractMainPage { KeyNavigation.down: shareNetworkButton popup.contentItem: Button { - color: deletePopup.popupBackgroundColor + color: DefaultStyle.danger_500main borderColor: deletePopup.popupBackgroundColor + textColor: DefaultStyle.danger_500main + contentImageColor: DefaultStyle.danger_500main inversedColors: true property var isMeObj: UtilsCpp.isMe(mainItem.selectedConference?.core.organizerAddress) - contentItem: RowLayout { - EffectImage { - imageSource: AppIcons.trashCan - width: 24 * DefaultStyle.dp - height: 24 * DefaultStyle.dp - Layout.preferredWidth: 24 * DefaultStyle.dp - Layout.preferredHeight: 24 * DefaultStyle.dp - fillMode: Image.PreserveAspectFit - colorizationColor: DefaultStyle.danger_500main - } - Text { - text: qsTr("Delete this meeting") - color: DefaultStyle.danger_500main - font { - pixelSize: 14 * DefaultStyle.dp - weight: 400 * DefaultStyle.dp - } - } - } + icon.source: AppIcons.trashCan + icon.width: 24 * DefaultStyle.dp + icon.height: 24 * DefaultStyle.dp + spacing: 10 * DefaultStyle.dp + textSize: 14 * DefaultStyle.dp + textWeight: 400 * DefaultStyle.dp + text: qsTr("Delete this meeting") + onClicked: { if (mainItem.selectedConference) { cancelAndDeleteConfDialog.cancel = isMeObj? isMeObj.value : false @@ -624,6 +615,7 @@ AbstractMainPage { mainItem.selectedConference.core.lDeleteConferenceInfo() } } + background: Item{} } } }