For the historical record, I finally got it working. My code:
`
QRect screenGeometry = QGuiApplication::primaryScreen( )->geometry( );
int x13;
int x23;
int y13;
int y23;
if( screenGeometry.width( ) < width( ))
{ x13 = m_image->getScrollX( ) + screenGeometry.width( ) / 3.0;
x23 = m_image->getScrollX( ) + 2 * screenGeometry.width( ) / 3.0;
}
else
{ x13 = m_image->getScrollX( ) + width( ) / 3.0;
x23 = m_image->getScrollX( ) + 2 * width( ) / 3.0;
}
if( screenGeometry.height( ) < height( ))
{ y13 = m_image->getScrollY( ) + screenGeometry.height( ) / 3.0;
y23 = m_image->getScrollY( ) + 2 * screenGeometry.height( ) / 3.0;
}
else
{ y13 = m_image->getScrollY( ) + height( ) / 3.0;
y23 = m_image->getScrollY( ) + 2 * height( ) / 3.0;
}
QPainter painter( this );
painter.setPen( QPen( Qt::red, 4, Qt::SolidLine, Qt::FlatCap ));
painter.drawLine( 0, y13, width( ), y13 );
painter.drawLine( 0, y23, width( ), y23 );
painter.drawLine( x13, 0, x13, height( ));
painter.drawLine( x23, 0, x23, height( ));
}
`