[Edit: A bug in the original proof has been fixed, thanks to a comment by Francois Dorais.]
The answer is no. This kind of thing can be proved by what I call a "gas tank" argument. First enumerate all Turing machines in some manner $N_1, N_2, N_3, \ldots$ Then construct a sequence of Turing machines $M_1, M_2, M_3, \ldots$ as follows. On an input of length $n$, $M_i$ simulates $N_i$ (on empty input) for up to $n$ steps. If $N_i$ does not halt within that time, then $M_i$ halts immediately after the $n$th step. However, if $N_i$ halts within the first $n$ steps, then $M_i$ "runs out of gas" and starts behaving erratically, which in this context means (say) that it continues running for $n^e$ steps before halting where $e$ is the number of steps that $N_i$ took to halt.
Now if we had a program $P$ that could compute a polynomial upper bound on any polytime machine, then we could determine whether $N_i$ halts by calling $P$ on $M_i$, reading off the exponent $e$, and simulating $N_i$ for (at most) $e$ steps. If $N_i$ doesn't halt by then, then we know it will never halt.
Of course this proof technique is very general; for example, $M_i$ can be made to simulate any fixed $M$ as long as it has gas but then do something else when it runs out of gas, proving that it will be undecidable whether an arbitrary given machine behaves like $M$.
David is right about one thing. Scott had a discussion about this on his blog and I was also involved.
On the one hand, many complexity theorists simply also assume that BQP does not contain NP, just as they assume that P does not contain NP. The evidence for the former is not as dramatic as that for the latter, but there is at least an oracle separation. I.e., there is an oracle A such that BQPA does not contain NPA. Now, there are some famous cases where two complexity classes are equal or there is an inclusion, even though there is also a credible oracle separation. But the oracle separations for BQP vs NP seem realistic. Besides, apart from tangible evidence, I for one consider BQP to be surprisingly powerful but not incredibly powerful. It's my intuition partly because I expect BQP to be realistic and I don't expect the universe to be perverse. I think of BQP as an extension of randomized computation based on quantum probability.
On the other hand, P vs PSPACE is already an unfathomable open problem. The two main barrier results for P vs NP, Baker-Gill-Solovay and Razborov-Rudich, apply to P vs PSPACE equally well. Since PSPACE contains both NP and BQP, if you were to show that either one does not equal P, then in particular you would show that PSPACE does not equal P. Actually, I don't know a good reason to try to prove that P ≠ NP rather than to first prove that P ≠ PSPACE, since the latter is at least formally easier.
Best Answer
For what it’s worth, Fortnow and Rogers constructed an oracle relative to which P = BQP, but the polynomial hierarchy does not collapse (hence in particular P ≠ NP).