Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QtAndroidMenu Namespace Reference

Functions

void resetMenuBar ()
 
void openOptionsMenu ()
 
void showContextMenu (QAndroidPlatformMenu *menu, const QRect &anchorRect)
 
void hideContextMenu (QAndroidPlatformMenu *menu)
 
void syncMenu (QAndroidPlatformMenu *)
 
void androidPlatformMenuDestroyed (QAndroidPlatformMenu *menu)
 
void setMenuBar (QAndroidPlatformMenuBar *menuBar, QWindow *window)
 
void setActiveTopLevelWindow (QWindow *window)
 
void addMenuBar (QAndroidPlatformMenuBar *menuBar)
 
void removeMenuBar (QAndroidPlatformMenuBar *menuBar)
 
static QString removeAmpersandEscapes (QString s)
 
static void fillMenuItem (JNIEnv *env, jobject menuItem, bool checkable, bool checked, bool enabled, bool visible, const QIcon &icon=QIcon())
 
static int addAllMenuItemsToMenu (JNIEnv *env, jobject menu, QAndroidPlatformMenu *platformMenu)
 
static jboolean onPrepareOptionsMenu (JNIEnv *env, jobject thiz, jobject menu)
 
static jboolean onOptionsItemSelected (JNIEnv *env, jobject thiz, jint menuId, jboolean checked)
 
static void onOptionsMenuClosed (JNIEnv *env, jobject thiz, jobject menu)
 
static void onCreateContextMenu (JNIEnv *env, jobject thiz, jobject menu)
 
static void fillContextMenu (JNIEnv *env, jobject thiz, jobject menu)
 
static jboolean onContextItemSelected (JNIEnv *env, jobject thiz, jint menuId, jboolean checked)
 
static void onContextMenuClosed (JNIEnv *env, jobject thiz, jobject menu)
 
bool registerNatives (QJniEnvironment &env)
 

Variables

static QList< QAndroidPlatformMenu * > pendingContextMenus
 
static QAndroidPlatformMenuvisibleMenu = nullptr
 
static Q_CONSTINIT QRecursiveMutex visibleMenuMutex
 
static QSet< QAndroidPlatformMenuBar * > menuBars
 
static QAndroidPlatformMenuBarvisibleMenuBar = nullptr
 
static QWindowactiveTopLevelWindow = nullptr
 
static Q_CONSTINIT QRecursiveMutex menuBarMutex
 
static jmethodID clearMenuMethodID = 0
 
static jmethodID addMenuItemMethodID = 0
 
static int menuNoneValue = 0
 
static jmethodID setHeaderTitleContextMenuMethodID = 0
 
static jmethodID setCheckableMenuItemMethodID = 0
 
static jmethodID setCheckedMenuItemMethodID = 0
 
static jmethodID setEnabledMenuItemMethodID = 0
 
static jmethodID setIconMenuItemMethodID = 0
 
static jmethodID setVisibleMenuItemMethodID = 0
 
static JNINativeMethod methods []
 

Function Documentation

◆ addAllMenuItemsToMenu()

static int QtAndroidMenu::addAllMenuItemsToMenu ( JNIEnv * env,
jobject menu,
QAndroidPlatformMenu * platformMenu )
static

Definition at line 183 of file androidjnimenu.cpp.

References addMenuItemMethodID, QString::data(), fillMenuItem(), QGraphicsItem::isEnabled(), QGraphicsItem::isVisible(), item, items, QString::length(), lock, menu, menuNoneValue, platformMenu, and removeAmpersandEscapes().

Referenced by fillContextMenu(), onCreateContextMenu(), and onPrepareOptionsMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addMenuBar()

void QtAndroidMenu::addMenuBar ( QAndroidPlatformMenuBar * menuBar)

Definition at line 130 of file androidjnimenu.cpp.

References lock, menuBar, menuBarMutex, and menuBars.

Referenced by QAndroidPlatformMenuBar::QAndroidPlatformMenuBar().

+ Here is the caller graph for this function:

◆ androidPlatformMenuDestroyed()

void QtAndroidMenu::androidPlatformMenuDestroyed ( QAndroidPlatformMenu * menu)

Definition at line 89 of file androidjnimenu.cpp.

References lock, menu, visibleMenu, and visibleMenuMutex.

Referenced by QAndroidPlatformMenu::~QAndroidPlatformMenu().

+ Here is the caller graph for this function:

◆ fillContextMenu()

static void QtAndroidMenu::fillContextMenu ( JNIEnv * env,
jobject thiz,
jobject menu )
static

Definition at line 308 of file androidjnimenu.cpp.

References addAllMenuItemsToMenu(), clearMenuMethodID, lock, menu, Q_UNUSED, visibleMenu, and visibleMenuMutex.

+ Here is the call graph for this function:

◆ fillMenuItem()

static void QtAndroidMenu::fillMenuItem ( JNIEnv * env,
jobject menuItem,
bool checkable,
bool checked,
bool enabled,
bool visible,
const QIcon & icon = QIcon() )
static

Definition at line 160 of file androidjnimenu.cpp.

References QtAndroid::createBitmap(), QtAndroid::createBitmapDrawable(), QIcon::Disabled, icon, QIcon::isNull(), QIcon::Normal, QIcon::On, QIcon::pixmap(), qEnvironmentVariableIntValue(), qMax(), setCheckableMenuItemMethodID, setCheckedMenuItemMethodID, setEnabledMenuItemMethodID, setIconMenuItemMethodID, and setVisibleMenuItemMethodID.

Referenced by addAllMenuItemsToMenu(), and onPrepareOptionsMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hideContextMenu()

void QtAndroidMenu::hideContextMenu ( QAndroidPlatformMenu * menu)

Definition at line 67 of file androidjnimenu.cpp.

References lock, menu, pendingContextMenus, QtAndroid::qtActivityDelegate(), visibleMenu, and visibleMenuMutex.

+ Here is the call graph for this function:

◆ onContextItemSelected()

static jboolean QtAndroidMenu::onContextItemSelected ( JNIEnv * env,
jobject thiz,
jint menuId,
jboolean checked )
static

Definition at line 319 of file androidjnimenu.cpp.

References QMenu::aboutToHide(), QWidget::isVisible(), item, lock, menu, pendingContextMenus, Q_UNUSED, showContextMenu(), visibleMenu, and visibleMenuMutex.

+ Here is the call graph for this function:

◆ onContextMenuClosed()

static void QtAndroidMenu::onContextMenuClosed ( JNIEnv * env,
jobject thiz,
jobject menu )
static

Definition at line 345 of file androidjnimenu.cpp.

References lock, menu, pendingContextMenus, Q_UNUSED, showContextMenu(), visibleMenu, and visibleMenuMutex.

+ Here is the call graph for this function:

◆ onCreateContextMenu()

static void QtAndroidMenu::onCreateContextMenu ( JNIEnv * env,
jobject thiz,
jobject menu )
static

Definition at line 291 of file androidjnimenu.cpp.

References addAllMenuItemsToMenu(), clearMenuMethodID, lock, menu, Q_UNUSED, removeAmpersandEscapes(), setHeaderTitleContextMenuMethodID, visibleMenu, and visibleMenuMutex.

+ Here is the call graph for this function:

◆ onOptionsItemSelected()

static jboolean QtAndroidMenu::onOptionsItemSelected ( JNIEnv * env,
jobject thiz,
jint menuId,
jboolean checked )
static

Definition at line 254 of file androidjnimenu.cpp.

References QList< T >::front(), item, lock, menu, menuBarMutex, QAndroidPlatformMenu::menuItemForId(), Q_UNUSED, showContextMenu(), QList< T >::size(), and visibleMenuBar.

+ Here is the call graph for this function:

◆ onOptionsMenuClosed()

static void QtAndroidMenu::onOptionsMenuClosed ( JNIEnv * env,
jobject thiz,
jobject menu )
static

Definition at line 284 of file androidjnimenu.cpp.

References menu, and Q_UNUSED.

◆ onPrepareOptionsMenu()

static jboolean QtAndroidMenu::onPrepareOptionsMenu ( JNIEnv * env,
jobject thiz,
jobject menu )
static

Definition at line 214 of file androidjnimenu.cpp.

References addAllMenuItemsToMenu(), addMenuItemMethodID, clearMenuMethodID, QString::data(), fillMenuItem(), QList< T >::front(), QGraphicsItem::isEnabled(), QGraphicsItem::isVisible(), item, QString::length(), lock, menu, menuBarMutex, menuNoneValue, Q_UNUSED, removeAmpersandEscapes(), QList< T >::size(), and visibleMenuBar.

+ Here is the call graph for this function:

◆ openOptionsMenu()

void QtAndroidMenu::openOptionsMenu ( )

Definition at line 50 of file androidjnimenu.cpp.

References QtAndroid::qtActivityDelegate().

Referenced by QAndroidPlatformTheme::showPlatformMenuBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ registerNatives()

bool QtAndroidMenu::registerNatives ( QJniEnvironment & env)

Definition at line 399 of file androidjnimenu.cpp.

References addMenuItemMethodID, QtAndroid::applicationClass(), clearMenuMethodID, FIND_AND_CHECK_CLASS, GET_AND_CHECK_METHOD, GET_AND_CHECK_STATIC_FIELD, menuNoneValue, methods, setCheckableMenuItemMethodID, setCheckedMenuItemMethodID, setEnabledMenuItemMethodID, setHeaderTitleContextMenuMethodID, setIconMenuItemMethodID, and setVisibleMenuItemMethodID.

Referenced by JNI_OnLoad().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeAmpersandEscapes()

static QString QtAndroidMenu::removeAmpersandEscapes ( QString s)
static

Definition at line 146 of file androidjnimenu.cpp.

References i.

Referenced by addAllMenuItemsToMenu(), onCreateContextMenu(), and onPrepareOptionsMenu().

+ Here is the caller graph for this function:

◆ removeMenuBar()

void QtAndroidMenu::removeMenuBar ( QAndroidPlatformMenuBar * menuBar)

Definition at line 136 of file androidjnimenu.cpp.

References lock, menuBar, menuBarMutex, menuBars, resetMenuBar(), and visibleMenuBar.

Referenced by QAndroidPlatformMenuBar::~QAndroidPlatformMenuBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetMenuBar()

void QtAndroidMenu::resetMenuBar ( )

Definition at line 45 of file androidjnimenu.cpp.

References QtAndroid::qtActivityDelegate().

Referenced by removeMenuBar(), setActiveTopLevelWindow(), and setMenuBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setActiveTopLevelWindow()

void QtAndroidMenu::setActiveTopLevelWindow ( QWindow * window)

Definition at line 104 of file androidjnimenu.cpp.

References activeTopLevelWindow, Qt::Desktop, Qt::Dialog, lock, menuBar, menuBarMutex, menuBars, Qt::Popup, resetMenuBar(), Qt::Sheet, visibleMenuBar, Qt::Window, and window().

Referenced by QAndroidPlatformScreen::topVisibleWindowChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMenuBar()

void QtAndroidMenu::setMenuBar ( QAndroidPlatformMenuBar * menuBar,
QWindow * window )

Definition at line 96 of file androidjnimenu.cpp.

References activeTopLevelWindow, menuBar, resetMenuBar(), visibleMenuBar, and window().

Referenced by QAndroidPlatformMenuBar::handleReparent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showContextMenu()

void QtAndroidMenu::showContextMenu ( QAndroidPlatformMenu * menu,
const QRect & anchorRect )

Definition at line 55 of file androidjnimenu.cpp.

References QMenu::aboutToShow(), QRect::height(), lock, menu, pendingContextMenus, QtAndroid::qtActivityDelegate(), visibleMenu, visibleMenuMutex, QRect::width(), QRect::x(), and QRect::y().

Referenced by onContextItemSelected(), onContextMenuClosed(), onOptionsItemSelected(), and QAndroidPlatformMenu::showPopup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syncMenu()

void QtAndroidMenu::syncMenu ( QAndroidPlatformMenu * )

Definition at line 79 of file androidjnimenu.cpp.

Referenced by QAndroidPlatformMenuBar::syncMenu(), and QAndroidPlatformMenu::syncMenuItem().

+ Here is the caller graph for this function:

Variable Documentation

◆ activeTopLevelWindow

QWindow* QtAndroidMenu::activeTopLevelWindow = nullptr
static

Definition at line 31 of file androidjnimenu.cpp.

Referenced by setActiveTopLevelWindow(), and setMenuBar().

◆ addMenuItemMethodID

jmethodID QtAndroidMenu::addMenuItemMethodID = 0
static

Definition at line 35 of file androidjnimenu.cpp.

Referenced by addAllMenuItemsToMenu(), onPrepareOptionsMenu(), and registerNatives().

◆ clearMenuMethodID

jmethodID QtAndroidMenu::clearMenuMethodID = 0
static

◆ menuBarMutex

Q_CONSTINIT QRecursiveMutex QtAndroidMenu::menuBarMutex
static

◆ menuBars

QSet<QAndroidPlatformMenuBar *> QtAndroidMenu::menuBars
static

Definition at line 29 of file androidjnimenu.cpp.

Referenced by addMenuBar(), removeMenuBar(), and setActiveTopLevelWindow().

◆ menuNoneValue

int QtAndroidMenu::menuNoneValue = 0
static

Definition at line 36 of file androidjnimenu.cpp.

Referenced by addAllMenuItemsToMenu(), onPrepareOptionsMenu(), and registerNatives().

◆ methods

JNINativeMethod QtAndroidMenu::methods[]
static
Initial value:
= {
{"onPrepareOptionsMenu", "(Landroid/view/Menu;)Z", (void *)onPrepareOptionsMenu},
{"onOptionsItemSelected", "(IZ)Z", (void *)onOptionsItemSelected},
{"onOptionsMenuClosed", "(Landroid/view/Menu;)V", (void*)onOptionsMenuClosed},
{"onCreateContextMenu", "(Landroid/view/ContextMenu;)V", (void *)onCreateContextMenu},
{"fillContextMenu", "(Landroid/view/Menu;)V", (void *)fillContextMenu},
{"onContextItemSelected", "(IZ)Z", (void *)onContextItemSelected},
{"onContextMenuClosed", "(Landroid/view/Menu;)V", (void*)onContextMenuClosed},
}

Definition at line 361 of file androidjnimenu.cpp.

Referenced by registerNatives().

◆ pendingContextMenus

QList<QAndroidPlatformMenu *> QtAndroidMenu::pendingContextMenus
static

◆ setCheckableMenuItemMethodID

jmethodID QtAndroidMenu::setCheckableMenuItemMethodID = 0
static

Definition at line 39 of file androidjnimenu.cpp.

Referenced by fillMenuItem(), and registerNatives().

◆ setCheckedMenuItemMethodID

jmethodID QtAndroidMenu::setCheckedMenuItemMethodID = 0
static

Definition at line 40 of file androidjnimenu.cpp.

Referenced by fillMenuItem(), and registerNatives().

◆ setEnabledMenuItemMethodID

jmethodID QtAndroidMenu::setEnabledMenuItemMethodID = 0
static

Definition at line 41 of file androidjnimenu.cpp.

Referenced by fillMenuItem(), and registerNatives().

◆ setHeaderTitleContextMenuMethodID

jmethodID QtAndroidMenu::setHeaderTitleContextMenuMethodID = 0
static

Definition at line 37 of file androidjnimenu.cpp.

Referenced by onCreateContextMenu(), and registerNatives().

◆ setIconMenuItemMethodID

jmethodID QtAndroidMenu::setIconMenuItemMethodID = 0
static

Definition at line 42 of file androidjnimenu.cpp.

Referenced by fillMenuItem(), and registerNatives().

◆ setVisibleMenuItemMethodID

jmethodID QtAndroidMenu::setVisibleMenuItemMethodID = 0
static

Definition at line 43 of file androidjnimenu.cpp.

Referenced by fillMenuItem(), and registerNatives().

◆ visibleMenu

◆ visibleMenuBar

QAndroidPlatformMenuBar* QtAndroidMenu::visibleMenuBar = nullptr
static

◆ visibleMenuMutex