Class: Qt::GraphicsSvgItem

Inherits:
Object
  • Object
show all
Defined in:
lib/main-dlg-impl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#baseElementObject

Returns the value of attribute baseElement.



1165
1166
1167
# File 'lib/main-dlg-impl.rb', line 1165

def baseElement
  @baseElement
end

Instance Method Details

#contextMenuEvent(contextEvent) ⇒ Object



1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
# File 'lib/main-dlg-impl.rb', line 1167

def contextMenuEvent(contextEvent)
	dlg=contextEvent.widget.parent.parent
	entries=["Add Waypoint as last", "Add Waypoint at"]
	menu=Qt::Menu.new
	entries.each{|e|
		menu.addAction(e)
	}
	sel=menu.exec(contextEvent.screenPos)
	sel=sel.text if !sel.nil?

	ok = Qt::Boolean.new(true)

	case sel
		when entries[1]
			# don't put this into a thread, it will create nasty core-dumps
			resp = Qt::InputDialog.getInt(dlg, "Enter Waypoint Position.", "After which waypoint shall I insert this one?\nEnter 0 to insert at beginning.", 0, 0, 9999, 1, ok)
	end #case
	
	if ok.value then
		Thread.new {
			case sel
				when entries[0]
					dlg.writeFlightsim("set /autopilot/route-manager/input @INSERT-1:#{baseElement.shortName}")

				when entries[1]
					dlg.writeFlightsim("set /autopilot/route-manager/input @INSERT+#{resp}:#{baseElement.shortName}")
			end #case
		}
	end
end