int KPrGeneralProperty::getGeneralPropertyChange() const { int flags = 0; if ( !m_generalValue.m_name.isNull() && m_generalValue.m_name != m_ui->nameInput->text() ) flags |= Name; if ( m_ui->protect->state() != QButton::NoChange ) { if ( ( m_ui->protect->isOn() ? STATE_ON : STATE_OFF ) != m_generalValue.m_protect ) flags |= Protect; if ( !m_ui->protect->isOn() ) { KoRect rect = getRect(); if ( m_generalValue.m_rect.left() != rect.left() ) flags |= Left; if ( m_generalValue.m_rect.top() != rect.top() ) flags |= Top; // this has to be done as the rect cahnges width/hight if left or top is changed if ( QABS( m_generalValue.m_rect.width() - rect.width() ) > 1e-6 ) flags |= Width; if ( QABS( m_generalValue.m_rect.height() - rect.height() ) > 1e-6 ) flags |= Height; } } if ( m_ui->keepRatio->state() != QButton::NoChange && ( m_ui->keepRatio->isOn() ? STATE_ON : STATE_OFF ) != m_generalValue.m_keepRatio ) { flags |= KeepRatio; } return flags; }
void KPrGeneralProperty::setRect( KoRect &rect ) { m_ui->xInput->changeValue( QMAX( 0.00, rect.left() ) ); m_ui->yInput->changeValue( QMAX( 0.00, rect.top() ) ); m_ui->widthInput->changeValue( QMAX( 0.00, rect.width() ) ); m_ui->heightInput->changeValue( QMAX( 0.00, rect.height() ) ); }