Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to get access widgets placed on MainWindow's from QtScript

How to get access widgets placed on MainWindow's from QtScript

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 251 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ZholamanZ Offline
    ZholamanZ Offline
    Zholaman
    wrote on last edited by
    #1

    Hi All,

    I have created standard project from the template "Aplication->Qt Widgets Application" by Qt Creator.

    Now I need to get access to widgest placed on mainwindow.ui , so how I can did that ? My main goal change properties of object like QLable that is placed on mainwindow.ui through QtScript

    For example, code below shows how we can change properties directly while I need to change the properties of the elements are placed on the main form - mainwindow.ui

    QApplication a(argc, argv);
    QLabel lbl;
    
    QScriptEngine scriptEngine;
    QScriptValue scriptLbl = scriptEngine.newQObject(&lbl);
    scriptEngine.globalObject().setProperty("lbl",scriptLbl);
    scriptEngine.evaluate("lbl.text = 'Help me!'");
    scriptEngine.evaluate("lbl.show()");
    

    Thanks!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved