Since everything is working properly in Windows but not in Mame, I'd just delete all of the mame config files (including game-specific config files) and start from scratch. I had 2 gpwiz-49 encoders and mame recognized them just fine.
Yeah, that's the quickest way to fix it. You'll lose all remaps you've done already, though: you might want to back 'em up first just in case. The sticks should work with mame's defaults if they work in windows (assuming they're joystick #1 & #2 to windows/directX). Also, check if you're using a ctrlr file.
Yes, more detail would be great. I thought I did not need to do anything special for qbert as there is a diagonal only DRS mode that is available to the 49-way joysticks (and is set correctly as I checked it) by set49way which is called by Mala prior to executing Mame. So, are you saying that I need to do something in mame to disable a built in mame controller map that is fouling up the set49way process?
You asked for it.

Alright, first quick time line: qbert, mame, ggg qpwiz49, mame's -joystick_map.
When Qbert came out in arcades, it used a standard 4-way joystick, but it was rotated 45 degrees so what the joystick sent on pacman's up was activated by the player moving the stick up-right. The stick was still sending up it "thought" was up.
So mame came around and emulated qbert. To mame, there were two (four, but I'm ignoring the two 2-ways) X-way types of input: 8-way and 4-way. 4-way sticks only send one cardinal direction (up, down, left, right) at a time. 8-way can send the cardinal directions and the diagonals (up&left, up&right, down&left, down&right). Diagonals happen when two cardinal switches are closed at the same time. Since qbert used 4-way sticks that had only one switch closed at a time, mame used the 4-way type. Mame, just before sending the data to the game, would check if two directions were pressed at the same time (aka "diagonals") and removed one of the directions. (Exactly how which one to be removed was desided changed a couple times.) Gamepad and keyboard encoders
were treated the same.
Then GpWiz49 came along, and with it the diagonals only mode. If you enabled this and remaped mame so qbert's up was mapped to the stick's upright, etc, things were great.
Then mame changed how it converted analog joysticks to digital inputs. This improved things in most cases, but caused problems in some. It also treated gamepad/joystick inputs differently that keyboard inputs, since windows treats all joystick inputs as analog. Mame converts the analog data into a 9x9 grid, modeled much like 49-way's 7x7 grid, and converts it to digital much like GGG DRS modes, but in software. Three a2d maps were added, 4-way, 8-way, and rotated 4-way. Qbert was given the rotated 4-way map initially. The initial changes actually worked perfect with the above diagonal only as you didn't need to remap mame as like above and worked great with any analog stick, but "broke" rotated 4-way sticks hooked to PC through a joystick encoder (but not keyboard encoders). Some people complained, so qbert was switched to use the 4-way a2d map, which fixed the problems of the complainers. But it totally "broke" the DRS diagonal only, and partialy "broke" analog sticks as they acted like unrotated 4-way sticks.
I quote broke because the user could override the default a2d map in all cases, and fix the problem in all cases.
Or Randy could come out with a rotated 4-way mode; IIRC he'd have to sacrfice another mode, though, which was why it wasn't added before. And since diagonal only works fine to okay on older mames.... Well, no R4W ATM.
Rehash: Mame is currently applying an analog 2 digital map that doesn't work with DRS diagonal only mode for qbert. You need to match mame's a2d map to work with whatever the mode you have the gpwiz in, which gives many opinions.
analog mode + either mame a2d map:
888856666....5.444452222 (the same I gave above)
4444s8888..444458888.444555888.ss5.222555666.222256666.2222s6666.2222s6666 (mame's old default for qbert)
DRS diag only mode +
either of the above
any map that has the corners as follows:
8xxxxxxx6
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
xxxx5xxxx
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
4xxxxxxx2(Only bold matters, since that's all DRS diag only mode sends)
The easiest of these:
855555556.5.......4555552analog or DRS diag only mode, and simple mame source edit (add "PORT_ROTATED" to 8 lines) and recompile