Fix phone numbers combobox (resetModel events and binding loop on y)
This commit is contained in:
parent
30c36757c0
commit
8bf2472060
3 changed files with 3 additions and 4 deletions
|
|
@ -23,6 +23,7 @@
|
||||||
LimitProxy::LimitProxy(QObject *parent) : QSortFilterProxyModel(parent) {
|
LimitProxy::LimitProxy(QObject *parent) : QSortFilterProxyModel(parent) {
|
||||||
connect(this, &LimitProxy::rowsInserted, this, &LimitProxy::countChanged);
|
connect(this, &LimitProxy::rowsInserted, this, &LimitProxy::countChanged);
|
||||||
connect(this, &LimitProxy::rowsRemoved, this, &LimitProxy::countChanged);
|
connect(this, &LimitProxy::rowsRemoved, this, &LimitProxy::countChanged);
|
||||||
|
connect(this, &LimitProxy::modelReset, this, &LimitProxy::countChanged);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
LimitProxy::LimitProxy(QAbstractItemModel *sortFilterProxy, QObject *parent) : QSortFilterProxyModel(parent) {
|
LimitProxy::LimitProxy(QAbstractItemModel *sortFilterProxy, QObject *parent) : QSortFilterProxyModel(parent) {
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
Proxy::Proxy(QObject *parent) : QAbstractListModel(parent) {
|
Proxy::Proxy(QObject *parent) : QAbstractListModel(parent) {
|
||||||
connect(this, &Proxy::rowsInserted, this, &Proxy::countChanged);
|
connect(this, &Proxy::rowsInserted, this, &Proxy::countChanged);
|
||||||
connect(this, &Proxy::rowsRemoved, this, &Proxy::countChanged);
|
connect(this, &Proxy::rowsRemoved, this, &Proxy::countChanged);
|
||||||
|
connect(this, &Proxy::modelReset, this, &Proxy::countChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Proxy::getCount() const {
|
int Proxy::getCount() const {
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,9 @@ ColumnLayout {
|
||||||
|
|
||||||
Control.ComboBox {
|
Control.ComboBox {
|
||||||
id: combobox
|
id: combobox
|
||||||
|
currentIndex: phoneNumberModel.count > 0 ? Math.max(0, phoneNumberModel.findIndexByCountryCallingCode(defaultCallingCode)) : -1
|
||||||
model: PhoneNumberProxy {
|
model: PhoneNumberProxy {
|
||||||
id: phoneNumberModel
|
id: phoneNumberModel
|
||||||
onCountChanged: {
|
|
||||||
combobox.currentIndex = Math.max(0, findIndexByCountryCallingCode(defaultCallingCode))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
implicitWidth: mainItem.implicitWidth
|
implicitWidth: mainItem.implicitWidth
|
||||||
|
|
@ -120,7 +118,6 @@ ColumnLayout {
|
||||||
height: listView.height
|
height: listView.height
|
||||||
color: DefaultStyle.main2_300
|
color: DefaultStyle.main2_300
|
||||||
// radius: 15 * DefaultStyle.dp
|
// radius: 15 * DefaultStyle.dp
|
||||||
y: listView.currentItem? listView.currentItem.y : 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue