mirror of
https://github.com/overte-org/overte.git
synced 2025-06-22 13:41:49 +02:00
Fix for menu shortcuts; just include widget library rather than using awkward
workaround.
This commit is contained in:
parent
9786d1b21d
commit
f10dccb1b8
5 changed files with 15 additions and 17 deletions
|
@ -9,11 +9,12 @@ set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/")
|
||||||
|
|
||||||
find_package(Qt5Network REQUIRED)
|
find_package(Qt5Network REQUIRED)
|
||||||
|
find_package(Qt5Widgets REQUIRED)
|
||||||
|
|
||||||
include(${MACRO_DIR}/SetupHifiProject.cmake)
|
include(${MACRO_DIR}/SetupHifiProject.cmake)
|
||||||
setup_hifi_project(${TARGET_NAME} TRUE)
|
setup_hifi_project(${TARGET_NAME} TRUE)
|
||||||
|
|
||||||
qt5_use_modules(${TARGET_NAME} Network)
|
qt5_use_modules(${TARGET_NAME} Network Widgets)
|
||||||
|
|
||||||
# include glm
|
# include glm
|
||||||
include(${MACRO_DIR}/IncludeGLM.cmake)
|
include(${MACRO_DIR}/IncludeGLM.cmake)
|
||||||
|
|
|
@ -690,10 +690,10 @@ void Menu::addDisabledActionAndSeparator(QMenu* destinationMenu, const QString&
|
||||||
|
|
||||||
QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
||||||
const QString actionName,
|
const QString actionName,
|
||||||
const QKEYSEQUENCE& shortcut,
|
const QKeySequence& shortcut,
|
||||||
const QObject* receiver,
|
const QObject* receiver,
|
||||||
const char* member,
|
const char* member,
|
||||||
QACTION_MENUROLE role) {
|
QAction::MenuRole role) {
|
||||||
QAction* action;
|
QAction* action;
|
||||||
|
|
||||||
if (receiver && member) {
|
if (receiver && member) {
|
||||||
|
@ -702,7 +702,7 @@ QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
||||||
action = destinationMenu->addAction(actionName);
|
action = destinationMenu->addAction(actionName);
|
||||||
action->setShortcut(shortcut);
|
action->setShortcut(shortcut);
|
||||||
}
|
}
|
||||||
action->setMenuRole((QAction::MenuRole)role);
|
action->setMenuRole(role);
|
||||||
|
|
||||||
_actionHash.insert(actionName, action);
|
_actionHash.insert(actionName, action);
|
||||||
|
|
||||||
|
@ -715,7 +715,7 @@ QAction* Menu::addCheckableActionToQMenuAndActionHash(QMenu* destinationMenu,
|
||||||
const bool checked,
|
const bool checked,
|
||||||
const QObject* receiver,
|
const QObject* receiver,
|
||||||
const char* member) {
|
const char* member) {
|
||||||
QAction* action = addActionToQMenuAndActionHash(destinationMenu, actionName, (QKEYSEQUENCE&)shortcut, receiver, member);
|
QAction* action = addActionToQMenuAndActionHash(destinationMenu, actionName, shortcut, receiver, member);
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
action->setChecked(checked);
|
action->setChecked(checked);
|
||||||
|
|
||||||
|
|
|
@ -76,10 +76,10 @@ public:
|
||||||
virtual QMenu* getActiveScriptsMenu() { return _activeScriptsMenu;}
|
virtual QMenu* getActiveScriptsMenu() { return _activeScriptsMenu;}
|
||||||
virtual QAction* addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
virtual QAction* addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
||||||
const QString actionName,
|
const QString actionName,
|
||||||
const QKEYSEQUENCE& shortcut = 0,
|
const QKeySequence& shortcut = 0,
|
||||||
const QObject* receiver = NULL,
|
const QObject* receiver = NULL,
|
||||||
const char* member = NULL,
|
const char* member = NULL,
|
||||||
QACTION_MENUROLE role = NO_ROLE);
|
QAction::MenuRole role = QAction::NoRole);
|
||||||
virtual void removeAction(QMenu* menu, const QString& actionName);
|
virtual void removeAction(QMenu* menu, const QString& actionName);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -7,11 +7,12 @@ set(TARGET_NAME shared)
|
||||||
project(${TARGET_NAME})
|
project(${TARGET_NAME})
|
||||||
|
|
||||||
find_package(Qt5Network REQUIRED)
|
find_package(Qt5Network REQUIRED)
|
||||||
|
find_package(Qt5Widgets REQUIRED)
|
||||||
|
|
||||||
include(${MACRO_DIR}/SetupHifiLibrary.cmake)
|
include(${MACRO_DIR}/SetupHifiLibrary.cmake)
|
||||||
setup_hifi_library(${TARGET_NAME})
|
setup_hifi_library(${TARGET_NAME})
|
||||||
|
|
||||||
qt5_use_modules(${TARGET_NAME} Network)
|
qt5_use_modules(${TARGET_NAME} Network Widgets)
|
||||||
|
|
||||||
# include GLM
|
# include GLM
|
||||||
include(${MACRO_DIR}/IncludeGLM.cmake)
|
include(${MACRO_DIR}/IncludeGLM.cmake)
|
||||||
|
|
|
@ -10,26 +10,22 @@
|
||||||
#ifndef __hifi__AbstractMenuInterface__
|
#ifndef __hifi__AbstractMenuInterface__
|
||||||
#define __hifi__AbstractMenuInterface__
|
#define __hifi__AbstractMenuInterface__
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class QString;
|
class QString;
|
||||||
class QObject;
|
class QObject;
|
||||||
class QKeySequence;
|
class QKeySequence;
|
||||||
class QAction;
|
|
||||||
|
|
||||||
// these are actually class scoped enums, but we don't want to depend on the class for this abstract interface
|
|
||||||
const int NO_ROLE = 0;
|
|
||||||
typedef int QACTION_MENUROLE;
|
|
||||||
typedef int QKEYSEQUENCE;
|
|
||||||
|
|
||||||
class AbstractMenuInterface {
|
class AbstractMenuInterface {
|
||||||
public:
|
public:
|
||||||
virtual QMenu* getActiveScriptsMenu() = 0;
|
virtual QMenu* getActiveScriptsMenu() = 0;
|
||||||
virtual QAction* addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
virtual QAction* addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
||||||
const QString actionName,
|
const QString actionName,
|
||||||
const QKEYSEQUENCE& shortcut = 0,
|
const QKeySequence& shortcut = 0,
|
||||||
const QObject* receiver = NULL,
|
const QObject* receiver = NULL,
|
||||||
const char* member = NULL,
|
const char* member = NULL,
|
||||||
QACTION_MENUROLE role = NO_ROLE) = 0;
|
QAction::MenuRole role = QAction::NoRole) = 0;
|
||||||
virtual void removeAction(QMenu* menu, const QString& actionName) = 0;
|
virtual void removeAction(QMenu* menu, const QString& actionName) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue