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. QScriptEngine issue
Qt 6.11 is out! See what's new in the release blog

QScriptEngine issue

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.4k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    Mark06
    wrote on last edited by
    #1

    I have a a number of labels (named, label1, label2, .... label27).

    I tried to use QScriptEngine to evaluate a command save in a QString variable, Instead of repeating the same line for over 27 times. I am using the code shown below.

    @
    QScriptEngine engine;
    QString filename = QString("EDataBase.label%1->setPixmap(QPixmap::fromImage(qimage,0))").arg(Label);
    engine.evaluate(filename);
    @

    where EDataBase is the name of the mainwindow, Label is a count for all labels.

    The code compiles and runs correctly, but it does not show the image saved in qimage.

    Is there something wrong with the code? am I doing it right?

    Note that I checked qimage have the correct data.

    Thanks for your help in advance.

    [EDIT: code formatting, please wrap in @-tags, Volker]

    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