That's very strange - I've checked rmatrixqr() on your problem, and it 
worked.
I was unable to completely reproduce your code, because there were external variables A/Q/R. So I've made a constant array from the matrix you've provided. My code looks as follows:
Code:
#include "ortfac.h"
#include "_data.h"
int main(int argc, char* argv[])
{
    int myRow = 5849;
    int myCol = 16;
    int m = myRow;
    int n = myCol;
    int i, j;
    ap::real_2d_array a;
    ap::real_1d_array tau;
    ap::real_2d_array q;
    ap::real_2d_array r;
    a.setcontent(0, myRow-1, 0, myCol-1, _data);
    rmatrixqr(a, m, n, tau);
    rmatrixqrunpackq(a, m, n, tau, m, q);
    
    // testing: print several elements of q past the 16th column
    for(i=0; i<5; i++)
    {
        for(j=16; j<20; j++)
            printf("q(%ld,%ld) = %7.4lf\n", (long)i, (long)j, (double)q(i,j));
    }
    printf("q(%ld,%ld) = %7.4lf\n", (long)(myRow-1), (long)(myRow-1), (double)q(myRow-1,myRow-1));
    getch();
    return 0;
}
As long as I can see, it is essentially the same code that you've executed. But it works OK.
I'd be glad to investigate it further, if you can answer several questions:
1. Could you execute my code (see attachment) and tell me its output?
2. How did you decide that Q were not "fully" unpacked? Using debugger to examine 
q (lower case)? Or through examining external variable 
Q (upper case)?
3. What compiler/OS/optimization settings you used for your project?
4. Did you modify ALGLIB files, or you running unmodified library? What version?