Fix updateData
signal signature so it actually works + cleanups
This commit is contained in:
parent
c3eda40e01
commit
8f126a1000
3 changed files with 29 additions and 27 deletions
|
@ -21,8 +21,7 @@
|
|||
|
||||
#include "layerlistmodel.hpp"
|
||||
#include <QIcon>
|
||||
|
||||
#include <iostream>
|
||||
#include <QBrush>
|
||||
#include <mapnik/layer.hpp>
|
||||
|
||||
using mapnik::Map;
|
||||
|
@ -64,6 +63,13 @@ QVariant LayerListModel::data(QModelIndex const& index,int role) const
|
|||
else
|
||||
return QVariant(Qt::Unchecked);
|
||||
}
|
||||
else if (role == Qt::ForegroundRole)
|
||||
{
|
||||
if (map_->layers().at(index.row()).active())
|
||||
return QBrush(QColor("black"));
|
||||
else
|
||||
return QBrush(QColor("lightgrey"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return QVariant();
|
||||
|
@ -101,7 +107,6 @@ bool LayerListModel::setData(const QModelIndex &index,
|
|||
Qt::ItemFlags LayerListModel::flags(QModelIndex const& index) const
|
||||
{
|
||||
Qt::ItemFlags flags = QAbstractItemModel::flags(index);
|
||||
|
||||
if (index.isValid())
|
||||
flags |= Qt::ItemIsUserCheckable;
|
||||
return flags;
|
||||
|
|
|
@ -29,12 +29,9 @@
|
|||
#include <qscrollbar.h>
|
||||
#include <qrubberband.h>
|
||||
#include <qdebug.h>
|
||||
#include <iostream>
|
||||
#include "layerlistmodel.hpp"
|
||||
#include "layer_info_dialog.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
LayerTab::LayerTab(QWidget* parent)
|
||||
: QListView(parent) {}
|
||||
|
||||
|
@ -45,11 +42,11 @@ void LayerTab::paintEvent(QPaintEvent *e)
|
|||
}
|
||||
|
||||
void LayerTab::dataChanged(const QModelIndex &topLeft,
|
||||
const QModelIndex &bottomRight)
|
||||
const QModelIndex &bottomRight,
|
||||
const QVector<int> &roles)
|
||||
{
|
||||
QListView::dataChanged(topLeft, bottomRight);
|
||||
qDebug("FIXME : update map view!");
|
||||
emit update_mapwidget();
|
||||
QListView::dataChanged(topLeft, bottomRight, roles);
|
||||
}
|
||||
|
||||
void LayerTab::selectionChanged(const QItemSelection & selected, const QItemSelection &)
|
||||
|
@ -57,7 +54,7 @@ void LayerTab::selectionChanged(const QItemSelection & selected, const QItemSele
|
|||
QModelIndexList list = selected.indexes();
|
||||
if (list.size() != 0)
|
||||
{
|
||||
std::cout << "SELECTED LAYER ->" << list[0].row() << "\n";
|
||||
qDebug("SELECTED LAYER -> %d",list[0].row());
|
||||
emit layerSelected(list[0].row());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class LayerTab : public QListView
|
|||
void layerInfo();
|
||||
void layerInfo2(QModelIndex const&);
|
||||
protected slots:
|
||||
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
|
||||
void selectionChanged(const QItemSelection & selected, const QItemSelection &);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue