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

Copy color under cursor with Ctrl+C (standard Copy shortcut)

Before this Ctrl+C was a shortcut for choosing color, but I think that setting color and font will go to 
a configuration dialog in near future, because those are options, which will not be changed very often, 
so they have not to stay in the context menu.

BUGS: 77701

svn path=/trunk/KDE/kdegraphics/kruler/; revision=908771
parent c0b7f904
......@@ -19,6 +19,7 @@
#include <QBitmap>
#include <QBrush>
#include <QClipboard>
#include <QInputDialog>
#include <QPainter>
#include <QMouseEvent>
......@@ -189,13 +190,16 @@ KLineal::KLineal( QWidget *parent )
/*mMenu->addAction( KStandardAction::preferences( this, SLOT( slotPreferences() ), this ) );*/
mMenu->addAction( KIcon( "preferences-desktop-color" ),
i18n( "&Choose Color..." ), this, SLOT( chooseColor() ),
Qt::CTRL + Qt::Key_C );
i18n( "&Choose Color..." ), this, SLOT( chooseColor() ) );
mMenu->addAction( KIcon( "preferences-desktop-font" ),
i18n( "Choose &Font..." ), this, SLOT( chooseFont() ),
Qt::Key_F );
new QShortcut(Qt::CTRL + Qt::Key_C, this, SLOT(chooseColor() ) );
new QShortcut(Qt::Key_F, this, SLOT( chooseFont() ) );
new QShortcut( Qt::Key_F, this, SLOT( chooseFont() ) );
mMenu->addSeparator();
KAction *copyColorAction = KStandardAction::copy( this, SLOT( copyColor() ), this );
copyColorAction->setText( i18n( "Copy Color" ) );
mMenu->addAction( copyColorAction );
new QShortcut( copyColorAction->shortcut().primary(), this, SLOT( copyColor() ) );
mMenu->addSeparator();
mMenu->addMenu( ( new KHelpMenu( this, KGlobal::mainComponent().aboutData(), true ) )->menu() );
mMenu->addSeparator();
......@@ -597,6 +601,12 @@ void KLineal::restoreColor()
{
setColor( mStoredColor );
}
void KLineal::copyColor()
{
QApplication::clipboard()->setText( mColorLabel->text() );
}
/**
* lets the context menu appear at current cursor position
*/
......
......@@ -112,6 +112,7 @@ public slots:
void chooseColor();
void chooseFont();
void restoreColor();
void copyColor();
void saveSettings();
void slotQuit();
};
......
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