annotate kdiff3/src-QT4/guiutils.h @ 113:7bca1f1340f6 tip

Build fixes for Xcode 10 / Qt 5.12
author Chris Cannam
date Mon, 17 Dec 2018 11:13:01 +0000
parents 6f42f5bd218e
children
rev   line source
joachim99@82 1 /***************************************************************************
joachim99@82 2 kdiff3.h - description
joachim99@82 3 -------------------
joachim99@82 4 begin : March 26 17:44 CEST 2002
joachim99@82 5 copyright : (c) 2008 by Valentin Rusu
joachim99@82 6 email : kde at rusu.info
joachim99@82 7 ***************************************************************************/
joachim99@82 8
joachim99@82 9 /***************************************************************************
joachim99@82 10 * *
joachim99@82 11 * This program is free software; you can redistribute it and/or modify *
joachim99@82 12 * it under the terms of the GNU General Public License as published by *
joachim99@82 13 * the Free Software Foundation; either version 3 of the License, or *
joachim99@82 14 * (at your option) any later version. *
joachim99@82 15 * *
joachim99@82 16 ***************************************************************************/
joachim99@82 17
joachim99@82 18 #include <qobject.h>
joachim99@82 19 #include <kactioncollection.h>
joachim99@82 20
joachim99@82 21 namespace KDiff3 {
joachim99@82 22
joachim99@82 23 template <class T>
joachim99@82 24 T* createAction(
joachim99@82 25 const QString& text,
joachim99@82 26 const QObject* receiver,
joachim99@82 27 const char* slot,
joachim99@82 28 KActionCollection* ac,
joachim99@82 29 const char* actionName);
joachim99@82 30
joachim99@82 31 template <>
joachim99@82 32 inline KAction* createAction<KAction>(
joachim99@82 33 const QString& text,
joachim99@82 34 const QObject* receiver,
joachim99@82 35 const char* slot,
joachim99@82 36 KActionCollection* ac,
joachim99@82 37 const char* actionName) {
joachim99@82 38 assert( ac != 0 );
joachim99@82 39 KAction* theAction = ac->addAction( actionName );
joachim99@82 40 theAction->setText( text );
joachim99@82 41 QObject::connect( theAction, SIGNAL( triggered() ), receiver, slot );
joachim99@82 42 return theAction;
joachim99@82 43 }
joachim99@82 44 template <>
joachim99@82 45 inline KToggleAction* createAction<KToggleAction>(
joachim99@82 46 const QString& text,
joachim99@82 47 const QObject* receiver,
joachim99@82 48 const char* slot,
joachim99@82 49 KActionCollection* ac,
joachim99@82 50 const char* actionName) {
joachim99@82 51 assert( ac != 0 );
joachim99@82 52 KToggleAction* theAction = new KToggleAction(ac);
joachim99@82 53 ac->addAction( actionName, theAction );
joachim99@82 54 theAction->setText( text );
joachim99@95 55 QObject::connect( theAction, SIGNAL( triggered(bool) ), receiver, slot );
joachim99@82 56 return theAction;
joachim99@82 57 }
joachim99@82 58
joachim99@82 59 template <class T>
joachim99@82 60 T* createAction(
joachim99@82 61 const QString& text,
joachim99@82 62 const KShortcut& shortcut,
joachim99@82 63 const QObject* receiver,
joachim99@82 64 const char* slot,
joachim99@82 65 KActionCollection* ac,
joachim99@82 66 const char* actionName)
joachim99@82 67 {
joachim99@82 68 T* theAction = createAction<T>( text, receiver, slot, ac, actionName );
joachim99@82 69 theAction->setShortcut( shortcut );
joachim99@82 70 return theAction;
joachim99@82 71 }
joachim99@82 72 template <class T>
joachim99@82 73 T* createAction(
joachim99@82 74 const QString& text,
joachim99@82 75 const QIcon& icon,
joachim99@82 76 const QObject* receiver,
joachim99@82 77 const char* slot,
joachim99@82 78 KActionCollection* ac,
joachim99@82 79 const char* actionName)
joachim99@82 80 {
joachim99@82 81 T* theAction = createAction<T>( text, receiver, slot, ac, actionName );
joachim99@82 82 theAction->setIcon( icon );
joachim99@82 83 return theAction;
joachim99@82 84 }
joachim99@82 85 template <class T>
joachim99@82 86 T* createAction(
joachim99@82 87 const QString& text,
joachim99@82 88 const QIcon& icon,
joachim99@82 89 const QString& iconText,
joachim99@82 90 const QObject* receiver,
joachim99@82 91 const char* slot,
joachim99@82 92 KActionCollection* ac,
joachim99@82 93 const char* actionName)
joachim99@82 94 {
joachim99@82 95 T* theAction = createAction<T>( text, receiver, slot, ac, actionName );
joachim99@82 96 theAction->setIcon( icon );
joachim99@82 97 theAction->setIconText( iconText );
joachim99@82 98 return theAction;
joachim99@82 99 }
joachim99@82 100 template <class T>
joachim99@82 101 T* createAction(
joachim99@82 102 const QString& text,
joachim99@82 103 const QIcon& icon,
joachim99@82 104 const KShortcut& shortcut,
joachim99@82 105 const QObject* receiver,
joachim99@82 106 const char* slot,
joachim99@82 107 KActionCollection* ac,
joachim99@82 108 const char* actionName)
joachim99@82 109 {
joachim99@82 110 T* theAction = createAction<T>( text, shortcut, receiver, slot, ac, actionName );
joachim99@82 111 theAction->setIcon( icon );
joachim99@82 112 return theAction;
joachim99@82 113 }
joachim99@82 114 template <class T>
joachim99@82 115 T* createAction(
joachim99@82 116 const QString& text,
joachim99@82 117 const QIcon& icon,
joachim99@82 118 const QString& iconText,
joachim99@82 119 const KShortcut& shortcut,
joachim99@82 120 const QObject* receiver,
joachim99@82 121 const char* slot,
joachim99@82 122 KActionCollection* ac,
joachim99@82 123 const char* actionName)
joachim99@82 124 {
joachim99@82 125 T* theAction = createAction<T>( text, shortcut, receiver, slot, ac, actionName );
joachim99@82 126 theAction->setIcon( icon );
joachim99@82 127 theAction->setIconText( iconText );
joachim99@82 128 return theAction;
joachim99@82 129 }
joachim99@82 130 }