Commit 613dc0a4 authored by Mathias Soeken's avatar Mathias Soeken

kruler is now configurable to be (semi-)transparent. There is a new menu...

kruler is now configurable to be (semi-)transparent. There is a new menu "Opacity" in the context menu 
with a slider to set windowOpacity. This value is stored and restored in the settings file.

BUGS: 116318


svn path=/trunk/KDE/kdegraphics/kruler/; revision=913428
parent 2c1742ce
......@@ -23,6 +23,8 @@
#include <QPainter>
#include <QMouseEvent>
#include <QShortcut>
#include <QSlider>
#include <QWidgetAction>
#include <KAction>
#include <KColorDialog>
......@@ -189,6 +191,20 @@ KLineal::KLineal( QWidget *parent )
new QShortcut( Qt::Key_O, this, SLOT( slotOffset() ) );
mMenu->addMenu( scaleMenu );
setWindowOpacity( RulerSettings::self()->opacity() / 100.0 );
KMenu* opacityMenu = new KMenu( i18n( "O&pacity" ), this );
QWidgetAction *opacityAction = new QWidgetAction( this );
QSlider *slider = new QSlider( this );
slider->setMinimum( 10 );
slider->setMaximum( 100 );
slider->setSingleStep( 1 );
slider->setOrientation( Qt::Horizontal );
slider->setValue( int( windowOpacity() * 100 ) );
connect( slider, SIGNAL( valueChanged( int ) ), this, SLOT( slotOpacity( int ) ) );
opacityAction->setDefaultWidget( slider );
opacityMenu->addAction( opacityAction );
mMenu->addMenu( opacityMenu );
mMenu->addAction( KStandardAction::preferences( this, SLOT( slotPreferences() ), this ) );
mMenu->addSeparator();
KAction *copyColorAction = KStandardAction::copy( this, SLOT( copyColor() ), this );
......@@ -514,6 +530,13 @@ void KLineal::slotLength()
}
}
void KLineal::slotOpacity( int value )
{
setWindowOpacity( value / 100.0 );
RulerSettings::self()->setOpacity( value );
RulerSettings::self()->writeConfig();
}
void KLineal::slotPreferences()
{
KConfigDialog *dialog = new KConfigDialog( this, "settings", RulerSettings::self() );
......
......@@ -101,6 +101,7 @@ public slots:
void centerOrigin();
void slotOffset();
void slotLength();
void slotOpacity( int value );
void slotPreferences();
void switchRelativeScale( bool checked );
void copyColor();
......
......@@ -37,5 +37,9 @@
<label>Is a tray icon used</label>
<default>false</default>
</entry>
<entry name="Opacity" type="Int">
<label>Opacity of the window</label>
<default>100</default>
</entry>
</group>
</kcfg>
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