mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Make planned points deletion works on the Table too.
Now the planner deletes points by clicking on the trash icon on the table. The dive planner is almost finished. <3 next: add a point from the table. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
d37213a413
commit
72807017ae
2 changed files with 17 additions and 6 deletions
|
@ -284,12 +284,6 @@ void DivePlannerGraphics::keyDeleteAction()
|
|||
{
|
||||
int selCount = scene()->selectedItems().count();
|
||||
if(selCount){
|
||||
|
||||
while(selCount--){
|
||||
Button *btn = gases.takeLast();
|
||||
delete btn;
|
||||
}
|
||||
|
||||
QVector<int> selectedIndexes;
|
||||
Q_FOREACH(QGraphicsItem *i, scene()->selectedItems()){
|
||||
if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler*>(i)){
|
||||
|
@ -307,8 +301,11 @@ void DivePlannerGraphics::pointsRemoved(const QModelIndex& , int start, int end)
|
|||
for(int i = num; i != 0; i--){
|
||||
delete handles.back();
|
||||
handles.pop_back();
|
||||
delete gases.back();
|
||||
gases.pop_back();
|
||||
}
|
||||
scene()->clearSelection();
|
||||
createDecoStops();
|
||||
}
|
||||
|
||||
bool intLessThan(int a, int b){
|
||||
|
@ -853,6 +850,8 @@ DivePlannerWidget::DivePlannerWidget(QWidget* parent, Qt::WindowFlags f): QWidge
|
|||
ui->setupUi(this);
|
||||
ui->tablePoints->setModel(DivePlannerPointsModel::instance());
|
||||
ui->tablePoints->setItemDelegateForColumn(DivePlannerPointsModel::GAS, new AirTypesDelegate(this));
|
||||
|
||||
connect(ui->tablePoints, SIGNAL(clicked(QModelIndex)), plannerModel, SLOT(removePoint(const QModelIndex)));
|
||||
connect(ui->startTime, SIGNAL(timeChanged(QTime)), this, SLOT(startTimeChanged(QTime)));
|
||||
connect(ui->ATMPressure, SIGNAL(textChanged(QString)), this, SLOT(atmPressureChanged(QString)));
|
||||
connect(ui->bottomSAC, SIGNAL(textChanged(QString)), this, SLOT(bottomSacChanged(QString)));
|
||||
|
@ -1095,3 +1094,13 @@ divedatapoint DivePlannerPointsModel::at(int row)
|
|||
{
|
||||
return divepoints.at(row);
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::removePoint(const QModelIndex& index)
|
||||
{
|
||||
if (index.column() != REMOVE)
|
||||
return;
|
||||
|
||||
beginRemoveRows(QModelIndex(), index.row(), index.row());
|
||||
divepoints.remove(index.row());
|
||||
endRemoveRows();
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
|
||||
virtual Qt::ItemFlags flags(const QModelIndex& index) const;
|
||||
void removeSelectedPoints(const QVector<int>& rows);
|
||||
|
||||
/**
|
||||
* @return the row number.
|
||||
*/
|
||||
|
@ -47,6 +48,7 @@ public slots:
|
|||
void setStartTime(const QTime& t);
|
||||
void setLastStop6m(bool value);
|
||||
void createPlan();
|
||||
void removePoint(const QModelIndex& index);
|
||||
|
||||
private:
|
||||
explicit DivePlannerPointsModel(QObject* parent = 0);
|
||||
|
|
Loading…
Reference in a new issue