Commit 2fe15b55 authored by Mathias Soeken's avatar Mathias Soeken

Set length by numerical input

svn path=/trunk/KDE/kdegraphics/kruler/; revision=909301
parent 4db41be3
......@@ -171,6 +171,8 @@ KLineal::KLineal( QWidget *parent )
new QShortcut( Qt::CTRL + Qt::Key_M, this, SLOT( setMediumLength() ) );
new QShortcut( Qt::CTRL + Qt::Key_T, this, SLOT( setTallLength() ) );
new QShortcut( Qt::CTRL + Qt::Key_F, this, SLOT( setFullLength() ) );
mLenMenu->addSeparator();
mLenMenu->addAction( i18n( "Length..." ), this, SLOT( slotLength() ) );
mMenu->addMenu( mLenMenu );
KMenu* scaleMenu = new KMenu( i18n( "&Scale" ), this );
......@@ -485,6 +487,20 @@ void KLineal::slotOffset()
}
}
void KLineal::slotLength()
{
bool ok;
QRect r = KGlobalSettings::desktopGeometry( this );
int width = ( ( mOrientation == North ) || ( mOrientation == South ) ) ? r.width() : r.height();
int newLength = QInputDialog::getInteger( this, i18n( "Ruler Length" ),
i18n( "Length:" ), mLongEdgeLen,
0, width, 1, &ok );
if ( ok ) {
reLength( ( newLength * 100.f ) / width );
}
}
void KLineal::slotPreferences()
{
KConfigDialog *dialog = new KConfigDialog( this, "settings", RulerSettings::self() );
......
......@@ -100,6 +100,7 @@ public slots:
void switchDirection();
void centerOrigin();
void slotOffset();
void slotLength();
void slotPreferences();
void switchRelativeScale( bool checked );
void copyColor();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment