mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Removed obsolete Code ( gaslist on text click )
This commit removes obsolete code, there was a gaslist selection when user clicked on the buttons, but this shouldn't be anymore, since the next commit will add a menu to select the gas for that particular point. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									c7941f66b4
								
							
						
					
					
						commit
						f5be24609a
					
				
					 2 changed files with 3 additions and 56 deletions
				
			
		|  | @ -174,14 +174,6 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent) | |||
| 	ADD_ACTION(Qt::Key_Right, keyRightAction()); | ||||
| #undef ADD_ACTION | ||||
| 
 | ||||
| 	// Prepare the stuff for the gas-choices.
 | ||||
| 	gasListView = new QListView(); | ||||
| 	gasListView->setWindowFlags(Qt::Popup); | ||||
| 	gasListView->setModel(GasSelectionModel::instance()); | ||||
| 	gasListView->hide(); | ||||
| 	gasListView->installEventFilter(this); | ||||
| 
 | ||||
| 	connect(gasListView, SIGNAL(activated(QModelIndex)), this, SLOT(selectGas(QModelIndex))); | ||||
| 	connect(plannerModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(drawProfile())); | ||||
| 
 | ||||
| 	connect(plannerModel, SIGNAL(rowsInserted(const QModelIndex&,int,int)), | ||||
|  | @ -191,34 +183,16 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent) | |||
| 	setRenderHint(QPainter::Antialiasing); | ||||
| } | ||||
| 
 | ||||
| bool DivePlannerGraphics::eventFilter(QObject *object, QEvent* event) | ||||
| { | ||||
| 	if (object != gasListView) | ||||
| 		return false; | ||||
| 	if (event->type() == QEvent::KeyPress) { | ||||
| 		QKeyEvent *ke =  static_cast<QKeyEvent *>(event); | ||||
| 		if (ke->key() == Qt::Key_Escape) | ||||
| 			gasListView->hide(); | ||||
| 	} | ||||
| 	if (event->type() == QEvent::MouseButtonPress){ | ||||
| 		QMouseEvent *me = static_cast<QMouseEvent *>(event); | ||||
| 		if (!gasListView->geometry().contains(me->pos())) | ||||
| 			gasListView->hide(); | ||||
| 	} | ||||
| 	return false; | ||||
| } | ||||
| 
 | ||||
| void DivePlannerGraphics::pointInserted(const QModelIndex& parent, int start , int end) | ||||
| { | ||||
| 	DiveHandler *item = new DiveHandler (); | ||||
| 	scene()->addItem(item); | ||||
| 	handles << item; | ||||
| 
 | ||||
| 	Button *gasChooseBtn = new Button(); | ||||
| 	QGraphicsSimpleTextItem *gasChooseBtn = new QGraphicsSimpleTextItem(); | ||||
| 	scene()->addItem(gasChooseBtn); | ||||
| 	gasChooseBtn->setZValue(10); | ||||
| 	connect(gasChooseBtn, SIGNAL(clicked()), this, SLOT(prepareSelectGas())); | ||||
| 
 | ||||
| 	gasChooseBtn->setFlag(QGraphicsItem::ItemIgnoresTransformations); | ||||
| 	gases << gasChooseBtn; | ||||
| 	drawProfile(); | ||||
| } | ||||
|  | @ -490,22 +464,6 @@ QStringList& DivePlannerPointsModel::getGasList() | |||
| 	return list; | ||||
| } | ||||
| 
 | ||||
| void DivePlannerGraphics::prepareSelectGas() | ||||
| { | ||||
| 	currentGasChoice = static_cast<Button*>(sender()); | ||||
| 	QPoint c = QCursor::pos(); | ||||
| 	gasListView->setGeometry(c.x(), c.y(), 150, 100); | ||||
| 	gasListView->show(); | ||||
| } | ||||
| 
 | ||||
| void DivePlannerGraphics::selectGas(const QModelIndex& index) | ||||
| { | ||||
| 	QString gasSelected = gasListView->model()->data(index, Qt::DisplayRole).toString(); | ||||
| 	int idx = gases.indexOf(currentGasChoice); | ||||
| 	plannerModel->setData(plannerModel->index(idx, DivePlannerPointsModel::GAS), gasSelected); | ||||
| 	gasListView->hide(); | ||||
| } | ||||
| 
 | ||||
| void DivePlannerGraphics::drawProfile() | ||||
| { | ||||
| 	qDeleteAll(lines); | ||||
|  |  | |||
|  | @ -175,11 +175,8 @@ private slots: | |||
| 	void decreaseTime(); | ||||
| 	void decreaseDepth();; | ||||
| 	void drawProfile(); | ||||
| 	void prepareSelectGas(); | ||||
| 	void selectGas(const QModelIndex& index); | ||||
| 	void pointInserted(const QModelIndex&, int start, int end); | ||||
| 	void pointsRemoved(const QModelIndex&, int start, int end); | ||||
| 	bool eventFilter(QObject *object, QEvent* event); | ||||
| private: | ||||
| 	void moveActiveHandler(const QPointF& MappedPos, const int pos); | ||||
| 
 | ||||
|  | @ -188,15 +185,7 @@ private: | |||
| 
 | ||||
| 	/* This is the user-entered handles. */ | ||||
| 	QList<DiveHandler *> handles; | ||||
| 
 | ||||
| 	/* this is the user-entered gases.
 | ||||
| 		This must be a button, so the | ||||
| 		user cna click to choose a new gas. | ||||
| 	 */ | ||||
| 	QList<Button*> gases; | ||||
| 	QListView *gasListView; | ||||
| 	QStringListModel *gasChoices; | ||||
| 	Button *currentGasChoice; | ||||
| 	QList<QGraphicsSimpleTextItem*> gases; | ||||
| 
 | ||||
| 	/* those are the lines that follows the mouse. */ | ||||
| 	QGraphicsLineItem *verticalLine; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue