File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -321,9 +321,7 @@ int UBApplication::exec(const QString& pFileToImport)
321321
322322 mainWindow->setAttribute (Qt::WA_NativeWindow, true );
323323
324- mainWindow->actionCopy ->setShortcuts (QKeySequence::Copy);
325- mainWindow->actionPaste ->setShortcuts (QKeySequence::Paste);
326- mainWindow->actionCut ->setShortcuts (QKeySequence::Cut);
324+ enableEditingShortcuts (true );
327325
328326 UBThumbnailUI::_private::initCatalog ();
329327
@@ -745,6 +743,22 @@ void UBApplication::cleanup()
745743 documentController = NULL ;
746744}
747745
746+ void UBApplication::enableEditingShortcuts (bool enable)
747+ {
748+ if (enable)
749+ {
750+ mainWindow->actionCopy ->setShortcuts (QKeySequence::Copy);
751+ mainWindow->actionPaste ->setShortcuts (QKeySequence::Paste);
752+ mainWindow->actionCut ->setShortcuts (QKeySequence::Cut);
753+ }
754+ else
755+ {
756+ mainWindow->actionCopy ->setShortcuts ({});
757+ mainWindow->actionPaste ->setShortcuts ({});
758+ mainWindow->actionCut ->setShortcuts ({});
759+ }
760+ }
761+
748762QString UBApplication::urlFromHtml (QString html)
749763{
750764 QString _html;
Original file line number Diff line number Diff line change @@ -68,6 +68,8 @@ class UBApplication : public SingleApplication
6868
6969 void cleanup ();
7070
71+ void enableEditingShortcuts (bool enable);
72+
7173 static QPointer<QUndoStack> undoStack;
7274
7375 static UBDisplayManager* displayManager;
Original file line number Diff line number Diff line change 3030#include < QtGui>
3131#include < QtSvg>
3232
33- #include " core/UBApplication.h"
34- #include " UBGraphicsGroupContainerItem.h"
3533#include " UBGraphicsTextItemDelegate.h"
3634#include " UBGraphicsScene.h"
37- #include " gui/UBResources.h"
3835
39- #include " domain/UBGraphicsTextItem.h"
40- #include " domain/UBGraphicsDelegateFrame.h"
36+ #include " core/UBApplication.h"
4137#include " core/UBSettings.h"
4238
4339#include " board/UBBoardController.h"
4440#include " board/UBBoardView.h"
4541
42+ #include " domain/UBGraphicsTextItem.h"
43+ #include " domain/UBGraphicsDelegateFrame.h"
44+
45+ #include " gui/UBResources.h"
46+
4647#include " core/memcheck.h"
4748
4849const int UBGraphicsTextItemDelegate::sMinPixelSize = 8 ;
@@ -849,6 +850,10 @@ QVariant UBGraphicsTextItemDelegate::itemChange(QGraphicsItem::GraphicsItemChang
849850 saveTextCursorFormats ();
850851 }
851852 }
853+
854+ // disable global editing shortcuts while text item is selected
855+ // so that they are passed to the item
856+ UBApplication::app ()->enableEditingShortcuts (!value.toBool ());
852857 }
853858
854859 return UBGraphicsItemDelegate::itemChange (change, value);
You can’t perform that action at this time.
0 commit comments