To qualify for a patent, your invention has to be novel and it has to have an inventive step.
Your invention is novel if it is new when compared with anything that has ever been done or published anywhere in the world before the date on which you file your patent application.
If you tell anyone else about your invention in a non-confidential demonstration or publication before you file your patent, your invention may no longer be novel at the time your patent application is filed, so you may miss out on a patent.
In Australia and the US there is a one year grace period so that any disclosure you make within one year before your complete patent application will not count against you, but in many other countries there is no grace period.
Your invention has an inventive step if it is not obvious to someone who is skilled in the relevant technology in the light of common general knowledge when compared with any publication or act which has occurred anywhere in the world before the date of your patent application.
Most inventions are only minor improvements on what has been done before, so the size of the inventive step can be quite small.
Your invention may have an inventive step if it satisfies a long-felt need, if others have tried and failed to solve the problem which your invention solves, if your invention has required complex work, if your competitors have been copying your invention in preference to other solutions, and if your invention has been commercially successful.