mirror of
				https://gitlab.com/Syping/luaengineapp.git
				synced 2025-10-31 02:20:20 +01:00 
			
		
		
		
	getWidgetText added
This commit is contained in:
		
							parent
							
								
									ad1505251d
								
							
						
					
					
						commit
						3e88d70c23
					
				
					 3 changed files with 27 additions and 0 deletions
				
			
		|  | @ -59,6 +59,7 @@ void LuaEngineGui::pushClass(lua_State *L_p) | |||
|     pushFunction(L_p, "closeWidget", closeWidget); | ||||
|     pushFunction(L_p, "executeWidget", executeWidget); | ||||
|     pushFunction(L_p, "showWidget", showWidget); | ||||
|     pushFunction(L_p, "getWidgetText", getWidgetText); | ||||
|     pushFunction(L_p, "setWidgetLayout", setWidgetLayout); | ||||
|     pushVariant(L_p, "ShowCurrent", 0); | ||||
|     pushVariant(L_p, "ShowNormal", 1); | ||||
|  | @ -596,6 +597,28 @@ int LuaEngineGui::getParent(lua_State *L_p) | |||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| int LuaEngineGui::getWidgetText(lua_State *L_p) | ||||
| { | ||||
|     if (getArgumentCount(L_p) >= 1) { | ||||
|         void *pointer = getPointer(L_p, 1); | ||||
|         if (pointer != NULL) { | ||||
|             if (((QObject*)pointer)->inherits("QLabel")) { | ||||
|                 pushVariant(L_p, ((QLabel*)pointer)->text()); | ||||
|                 return 1; | ||||
|             } | ||||
|             else if (((QObject*)pointer)->inherits("QLineEdit")) { | ||||
|                 pushVariant(L_p, ((QLineEdit*)pointer)->text()); | ||||
|                 return 1; | ||||
|             } | ||||
|             else if (((QObject*)pointer)->inherits("QWidget")) { | ||||
|                 pushVariant(L_p, ((QWidget*)pointer)->windowTitle()); | ||||
|                 return 1; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| QString LuaEngineGui::nameForPointer(void *pointer) | ||||
| { | ||||
|     QString nameStorage; | ||||
|  |  | |||
|  | @ -51,6 +51,7 @@ public: | |||
|     static int createPushButton(lua_State *L_p); | ||||
|     static int createSpacerItem(lua_State *L_p); | ||||
|     static int getParent(lua_State *L_p); | ||||
|     static int getWidgetText(lua_State *L_p); | ||||
| 
 | ||||
| private: | ||||
|     lua_State *L; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue