Murch's answer is correct, but to save additional searches: please note that older bitcoin qt clients don't have a mempool.dat file. Please note also that bitcoin-qt - as i understand it is the old name for Bitcoin Core.
For example the latest bitcoin-qt client for gentoo even after a sync is v0.13.1.0, which is really old. I'm a bit apprehensive about compiling from non repository sources because the wallet has access to my private keys and there are several versions of bitcoin-qt source code on github, and i'm paranoid about running a compromised one. Gentoo maintainers: please update your bitcoin-qt client!!
It is possible to check whether the transaction is stuck in the memory pool by right clicking on the transaction and clicking on "Show transaction details". If it's showing the transaction as in the memory pool with no confirmations, then proceed. If you have any confirmations, then stop now because it's already been sent.
Initially, I restarted bitcoin-qt -zapwallettxes. This removed my transaction out of the memory pool, however it was just re-added to the mempool when the client was restarted. So that's not the correct solution to the problem for older clients.
To stop the transaction from re-entering the mempool, i restarted bitcoin-qt from CLI with the option:
What this option does, is it sets the transactions in the mempool to expire after 1 hour rather than the default 72 hours. Note that I had to keep bitcoin-qt running for over an hour to get the mempool to expire. If you restart the bitcoin-qt client within this time, it appears that the countdown resets and you have to wait another whole hour. Perhaps this explains why some people find that their transactions have been stuck in their mempool for weeks - they've for whatever reason restarted their bitcoin-qt client before the 72 hour countdown has finished. This certainly was the case for me.
After an hour, the transaction was still unconfirmed, but right clicking on the transaction then allowed me to abandon the transaction - this button was previously grayed out.
As soon as I clicked that my bitcoin balance was updated, a dustbin icon appeared next to the transaction and I've had no further issues.
Remember to set your -mempoolexpiry option back to the default 72 hours...
...or something more sane.