[Marble-bugs] [marble] [Bug 317815] New: The maxumum number of items for the DataLayer can't be setted

Oleg Lyubimov lyubimov.o.e at gmail.com
Thu Apr 4 09:55:07 UTC 2013


https://bugs.kde.org/show_bug.cgi?id=317815

            Bug ID: 317815
           Summary: The maxumum number of items for the DataLayer can't be
                    setted
    Classification: Unclassified
           Product: marble
           Version: 1.4.0 (KDE 4.9.0)
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: marble-bugs at kde.org
          Reporter: lyubimov.o.e at gmail.com

When you set maximum number of items in DataLayer using void
AbstractDataPlugin::setNumberOfItems( quint32 number ) , at the map you can see
not more than 10 items. The number of items, whitch you see at the map is not
depends of the setted number of items. 

Reproducible: Always

Steps to Reproduce:
1.  Create an application witch use marbleDataLayer
2.  Set for the dataLayer numberOfItems(12) 
3.  Create ListModel for the DataLayer with 12 items 
4.  Run application and see only 10 items on the map 
I done it in QML:
1) Add Q_PROPERTY to Abstract data plugin:
Q_PROPERTY( int numberOfItems READ numberOfItems WRITE setNumberOfItems NOTIFY
numberOfItemsChanged )
2) Create simple QML Application
############# main. qml #######################
import QtQuick 1.1
import org.kde.edu.marble 0.11

MarbleWidget {
    id: widget
    width: 800;
    height: 600
    dataLayers: [
        DataLayer{
            id: la1
            //nameId: "Layer1"
            model: Model1{}
            numberOfItems: 12
            delegate: Rectangle {
                width: 30;
                height: 20;
                border.color: "darkgray"; border.width: 2
                radius: 4; smooth: true
                Column {
                    id: column; x: 4; y: 4; spacing: 4
                    Text {
                        id: label
                        // "name" is a property defined by items in the model
                        text: "D#1"
                        width: 92
                        wrapMode: Text.Wrap
                        font.bold: true
                    }
                }
            }
        }
    ]
}
############ Model1.qml ################
ListModel {
    ListElement{
        lon: 44.4275; lat: 32.5355
    }
    ListElement{
        lon: 28.227778; lat: 36.451111
    }
    ListElement{
          lon: 31.134358; lat: 29.979175
    }
ListElement{
          lon: 1.134358; lat: 9.979175
    }
ListElement{
          lon:2.134358; lat:5.979175
    }
ListElement{
          lon: 3.134358; lat: 2.979175
    }
ListElement{
          lon: 4.134358; lat: 3.979175
    }
ListElement{
          lon: 4; lat: 0
    }
ListElement{
          lon: 4; lat: 1
    }
ListElement{
          lon: 4; lat: 2
    }
ListElement{
          lon: 14; lat: 10
    }
ListElement{
          lon: 5; lat: 10
    }
}
Actual Results:  
You see not more than 10 items on the map

Expected Results:  
You should see not more than setted maximum number of items on the map (12 in
this example)

I have done some investigations of this bug and found a reason of it:

AbstractDataPluginPrivate::AbstractDataPluginPrivate()
{
    m_model = 0;
    m_numberOfItems = 10; // This is the reason of the bug
    m_delegate = 0;
    m_delegateParent = 0;
}
m_numberOfItems  releases to default value every time, that the constructor is
called. To fix the bug you need to create global variable
"global_numberOfItems" and chande the setter and getter:
quint32 AbstractDataPlugin::numberOfItems() const
{
    if(global_numberOfItems!=0){
        return global_numberOfItems;
    }
    else{
       return d->m_numberOfItems;
    }
} 
void AbstractDataPlugin::setNumberOfItems( quint32 number )
{
    bool changed = ( number != global_numberOfItems );
    global_numberOfItems = number;
    if (changed){
        emit numberOfItemsChanged( global_numberOfItems );
    }
}

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Marble-bugs mailing list