You can try subclassing QStyle and reimplementing QStyle :: drawControl () to align the text to the right. Check the qt / src / gui / styles / qcommonstyle.cpp file to find out how. (Sorry, I'm using C ++, not Python)
case CE_ToolButtonLabel: if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) { QRect rect = toolbutton->rect; int shiftX = 0; int shiftY = 0; if (toolbutton->state & (State_Sunken | State_On)) { shiftX = proxy()->pixelMetric(PM_ButtonShiftHorizontal, toolbutton, widget); shiftY = proxy()->pixelMetric(PM_ButtonShiftVertical, toolbutton, widget); }
source share