Solved Qml Menu outside client Area not show
-
When I import QtQuick.Controls 2.1
to open a menu, if the menu size(height) exceed the client height, the exceeded part are clipped. it seems that the menu not in float state, not like a custom menu.but if I import QtQuick.Controls 1.4
it seems the menu to be a custom style, and can be render outside client rect. How can I achieve this style in QtQuick.Controls 2, for there are much more flexible to use the new version. -
@fisher103
IIRC there was a change along with QQuickControls2 to avoid crashes on "single-window" platforms (EGLFS, ...). So in v2 there are no "real" popups anymore but instead they are item based and bound by the window.Also you may want to read about the differences between v1 and v2:
- Qt Quick Controls 1:
Menu is native on platforms where an implementation is available in the Qt Platform Abstraction Layer. Other platforms use a QML-based top-level menu popup window. Menu supports traditional desktop style cascading submenus, but does not work on Embedded Linux because EGLFS does not support multiple top-level windows. - Qt Quick Controls 2:
Menu is a non-native Item-based popup that is stacked above the application content. Due to this, menu popups are restricted within window boundaries. Menu is fully customizable using QML and Qt Quick, and allows adding any Items. Traditional desktop oriented features, such as cascading submenus and visualizing keyboard shortcuts are missing.
Do you need any features from QQuickControls2 menu that are not available in v1?!
If not simply import the v1 into a separate namespace and just instantiate the menu from v1.import QtQuick.Controls 2.0 import QtQuick.Controls 1.4 as Old Old.Menu { ... }
- Qt Quick Controls 1:
-
@raven-worx thanks, you fetch the key point. I finally changed to use both v1 & v2. for I cannot do all my things with v2 only.