ue4 C++ 生成并弹出一个菜单


FGlobalSettingModule & GSettingMod = FModuleManager :: LoadModuleChecked < FGlobalSettingModule >( TEXT ( "GlobalSetting" ));
               FString userIdStr = FString :: FromInt (GSettingMod. GetUserInfo (). userId );
               FString modelUrl = _ItemModel -> _ItemInfo . modelUrl ;
               if ( modelUrl . Find (userIdStr) == INDEX_NONE )
              {
                      return FReply :: Unhandled ();
              }
               FMenuBuilder MenuBuilder ( true , nullptr );
               MenuBuilder . BeginSection ( "PathFolderMoveCopy" , FText :: FromString ( TEXT ( "硬装操作" )));
              {
                      MenuBuilder . AddMenuEntry (
                            FText :: FromString ( TEXT ( "删除" )),
                            FText :: FromString ( TEXT ( "删除该选项" )),
                            FSlateIcon (),
                            FUIAction ( FExecuteAction :: CreateLambda ([ this ]() { DeleteThisData (); }))
                     );
              }
               MenuBuilder . EndSection ();
              
               TSharedPtr < SWindow > Parent = FSlateApplication :: Get (). GetActiveTopLevelWindow ();
               if ( Parent . IsValid ())
              {
                      FSlateApplication :: Get (). PushMenu (
                            Parent . ToSharedRef (),
                            FWidgetPath (),
                            MenuBuilder . MakeWidget (),
                            FSlateApplication :: Get (). GetCursorPos (),
                             FPopupTransitionEffect ( FPopupTransitionEffect :: ContextMenu )
                     );
              }


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM