The people that Nikon does not have good image quality are those trying to find faults with the Nikon brand itself. These are usually hardline Canon users who think their brand is the best of the best. They more specifically argue about the CCD sensor used by Nikon and many others. This sensor is not as good as the CMOS for keeping down noise, but by know means is the image quality bad. This is simply a statement made by ignorant wanna-be photographers. In truth, anyone that knows how to use a camera can get astonishing images from a Nikon or Canon. All this arguing is an ongoing battle in the Brand Wars.
Nikon is a great camera company. Their lenses can be used on the bodies made since the late 70s and even the 50s. Unlike Canon, who switched their system back in the 90s. The only thing with Nikon cameras is that they will AF on all the camera bodies, except for the D40/D40x. The reason being was to keep down price, and because it is designed for people who want want to buy any other lenses besides the 18-55mm kit or the 55-200mm zoom/VR. This is the real reason. So, you're older Nikon lenses wont AF on that model For AF, get a D80, which is a great stepup anyway.
Nikon is a company built on quality. Even the cheapest DSLR is very sturdy and feels great to hold, unlike Canon's lineup, which basically says you can have great images, but you have to use a camera that feels like a child's toy. The more expensive Canon cameras are great, though.
This is a true story: I was going to buy a Canon a Digital Rebel XT or XTi. When I got to the store, I held the XT. I was sickened by the layout and quality of the camera body. The kit lens was crap as well. I held the XTi, and it was about the same. They are both cheap cameras, but to get them cheap, Canon skipped on quality. Then, I held a Nikon D50. I was amazed at the difference. I held the D40, D70s, D80, and it was all the same; great build and great images. So, I chose a Nikon D50.
As for the D40x and D80 debate, I would recommend the D80. I would recommend it, if you are going to get more in depth with photography, and if you plan to buy other lenses. The D80, like all Nikons feels great in the hands. The shutter is quiet, and the image quality is great. The selection of lenses is massive.
If you are planning to buy the D40x, I would suggest buying the D40 instead. The D40x is the same exact camera as the D40, only they give it 10 mega pixels and a slightly higher frames per second. But, they lower the flash sync speed, something that is more important than mega pixels. Really, mega pixels is just a selling point that sellers will mention, saying that it gives better image quality. This is not true. More mega pixels only allows you to crop more, and have more details. The file size also eat away at the memory card. So, I would recommend the D40. Same camera, less expensive.
The D200 that you mention is an even better camera, but unless you plan to become a photojounalist in the near future, dont get it.
For Canon's lineup, I would not suggest buying anything from the Rebel lineup. The 40D is a great camera, but to me, it does not feel as sturdy and well built as the Nikon D80 and D200. It has great images, though. Really, the only cameras that I would recommend is the EOS 5d, or the 1d series. But, all these cameras cost anywhere from $3,000-$5,000. And, unless you plan to become a photojournalist in the near future, dont get them.
One problem that I always came across with Canon cameras was their poor quality with lenses. The kit lenses, most of the cheaper lenses, which dont fall in the L series, and even the 50mm f1.8 lens are not good. Some are not even comparable to Nikon's versions. The 50mm f1.8 lens for example is a lens every photographer should have. But, the Canon version is no where near Nikon's quality, or another like the Pentax 50mm f1.4.
So, for qulity build, great lenses, and great images, get something from the Nikon lineup, like the D80. That's what I recommend.
For great images and expensive lenes, get something from the Canon lineup. I would suggest the 40D. But, expect to buy an expensive lens from the start. Otherwise, your images will not be crisp and clean.
Hope this helped.