QPlainTextEdit subclass function to indent lines in selection
Some of these comments can be removed:

Too obvious:

// Do nothing if we don't have a selection.


Noisy:

// Done!

These initialized variables:

int spos = curs.anchor(), epos = curs.position();


should be on separate lines for better maintenance:

int spos = curs.anchor();
int epos = curs.position();

No need to do a manual swap:

if(spos &gt; epos)
{
    int hold = spos;
    spos = epos;
    epos = hold;
}


Just use std::swap to keep it idiomatic:

if (spos &gt; epos)
{
    std::swap(spos, epos);
}

No need calculate the difference each time:

for(int i = 0; i &lt;= (eblock - sblock); ++i)


Define a constant before the loop and use it instead:

const int blockDifference = eblock - sblock;

for (int i = 0; i &lt;= blockDifference; ++i)