r19120 by craig - First part of allowing the shortut widget to allow or reject certain keys or modifiers
scribus-commit
scribus-commit at lists.scribus.net
Tue May 13 20:09:34 UTC 2014
Author: craig
Date: Tue May 13 20:09:33 2014
New Revision: 19120
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19120
Log:
First part of allowing the shortut widget to allow or reject certain keys or modifiers
Modified:
trunk/Scribus/scribus/ui/shortcutwidget.cpp
trunk/Scribus/scribus/ui/shortcutwidget.h
trunk/Scribus/scribus/ui/stylemanager.cpp
Modified: trunk/Scribus/scribus/ui/shortcutwidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19120&path=/trunk/Scribus/scribus/ui/shortcutwidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/shortcutwidget.cpp (original)
+++ trunk/Scribus/scribus/ui/shortcutwidget.cpp Tue May 13 20:09:33 2014
@@ -5,6 +5,7 @@
for which a new license (GPL+exception) is in place.
*/
+#include <QDebug>
#include <QEvent>
#include <QToolTip>
#include <QKeyEvent>
@@ -23,11 +24,19 @@
Part3 = "";
keyCode = 0;
setKeyButton->setCheckable(true);
+ requiredModifiers=0;
+ allowedModifiers=0;
languageChange();
connect(noKey, SIGNAL(clicked()), this, SLOT(setNoKey()));
connect(setKeyButton, SIGNAL(clicked()), this, SLOT(setKeyText()));
+}
+
+void ShortcutWidget::setAllowedModifiers(int allowed, int required)
+{
+ allowedModifiers=allowed;
+ requiredModifiers=required;
}
void ShortcutWidget::changeEvent(QEvent *e)
@@ -74,20 +83,32 @@
switch (k->key())
{
case Qt::Key_Meta:
- Part0 = tr("Meta+");
- keyCode |= Qt::META;
+ if ((allowedModifiers&Qt::META)==Qt::META)
+ {
+ Part0 = tr("Meta+");
+ keyCode |= Qt::META;
+ }
break;
case Qt::Key_Shift:
- Part3 = tr("Shift+");
- keyCode |= Qt::SHIFT;
+ if ((allowedModifiers&Qt::SHIFT)==Qt::SHIFT)
+ {
+ Part3 = tr("Shift+");
+ keyCode |= Qt::SHIFT;
+ }
break;
case Qt::Key_Alt:
- Part2 = tr("Alt+");
- keyCode |= Qt::ALT;
+ if ((allowedModifiers&Qt::ALT)==Qt::ALT)
+ {
+ Part2 = tr("Alt+");
+ keyCode |= Qt::ALT;
+ }
break;
case Qt::Key_Control:
- Part1 = tr("Ctrl+");
- keyCode |= Qt::CTRL;
+ if ((allowedModifiers&Qt::CTRL)==Qt::CTRL)
+ {
+ Part1 = tr("Ctrl+");
+ keyCode |= Qt::CTRL;
+ }
break;
default:
keyCode |= k->key();
Modified: trunk/Scribus/scribus/ui/shortcutwidget.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19120&path=/trunk/Scribus/scribus/ui/shortcutwidget.h
==============================================================================
--- trunk/Scribus/scribus/ui/shortcutwidget.h (original)
+++ trunk/Scribus/scribus/ui/shortcutwidget.h Tue May 13 20:09:33 2014
@@ -33,6 +33,7 @@
void keyPressEvent(QKeyEvent *k);
void keyReleaseEvent(QKeyEvent *k);
void setShortcut(const QString &shortcut);
+ void setAllowedModifiers(int allowed, int required);
static QString getKeyText(int KeyC);
void languageChange();
@@ -55,6 +56,8 @@
QString Part2;
QString Part3;
QString Part4;
+ int requiredModifiers;
+ int allowedModifiers;
};
#endif
Modified: trunk/Scribus/scribus/ui/stylemanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19120&path=/trunk/Scribus/scribus/ui/stylemanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/stylemanager.cpp (original)
+++ trunk/Scribus/scribus/ui/stylemanager.cpp Tue May 13 20:09:33 2014
@@ -983,6 +983,7 @@
if (!m_shortcutWidget)
{
m_shortcutWidget = new ShortcutWidget(0);
+ m_shortcutWidget->setAllowedModifiers(Qt::META|Qt::CTRL|Qt::SHIFT|Qt::ALT,0);
connect(m_shortcutWidget, SIGNAL(newKey(const QString&)),
this, SLOT(slotShortcutChanged(const QString&)));
}
More information about the scribus-commit
mailing list