Merge branch 'master' into scons-4.1.0
This commit is contained in:
commit
8271bbde06
3 changed files with 29 additions and 27 deletions
|
@ -21,13 +21,12 @@
|
|||
|
||||
#include "layerlistmodel.hpp"
|
||||
#include <QIcon>
|
||||
|
||||
#include <iostream>
|
||||
#include <QBrush>
|
||||
#include <mapnik/layer.hpp>
|
||||
|
||||
using mapnik::Map;
|
||||
|
||||
LayerListModel::LayerListModel(std::shared_ptr<Map> map,QObject *parent)
|
||||
LayerListModel::LayerListModel(std::shared_ptr<Map> map, QObject *parent)
|
||||
: QAbstractListModel(parent),
|
||||
map_(map) {}
|
||||
|
||||
|
@ -37,7 +36,7 @@ int LayerListModel::rowCount(QModelIndex const&) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
QVariant LayerListModel::data(QModelIndex const& index,int role) const
|
||||
QVariant LayerListModel::data(QModelIndex const& index, int role) const
|
||||
{
|
||||
if (!index.isValid() || !map_)
|
||||
return QVariant();
|
||||
|
@ -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();
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,19 +27,19 @@
|
|||
|
||||
class LayerTab : public QListView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LayerTab(QWidget* parent=0);
|
||||
void paintEvent(QPaintEvent *e);
|
||||
signals:
|
||||
void update_mapwidget();
|
||||
void layerSelected(int) const;
|
||||
public slots:
|
||||
void layerInfo();
|
||||
void layerInfo2(QModelIndex const&);
|
||||
protected slots:
|
||||
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||
void selectionChanged(const QItemSelection & selected, const QItemSelection &);
|
||||
Q_OBJECT
|
||||
public:
|
||||
LayerTab(QWidget* parent=0);
|
||||
void paintEvent(QPaintEvent *e);
|
||||
signals:
|
||||
void update_mapwidget();
|
||||
void layerSelected(int) const;
|
||||
public slots:
|
||||
void layerInfo();
|
||||
void layerInfo2(QModelIndex const&);
|
||||
protected slots:
|
||||
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
|
||||
void selectionChanged(const QItemSelection & selected, const QItemSelection &);
|
||||
};
|
||||
|
||||
class StyleTab : public QTreeView
|
||||
|
@ -48,7 +48,7 @@ class StyleTab : public QTreeView
|
|||
public:
|
||||
StyleTab(QWidget* parent=0);
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent * event );
|
||||
void contextMenuEvent(QContextMenuEvent * event );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue