0

I was doing some testing with QTimer, within a bigger project, using Qt. I wanted to increment a value every 10 milliseconds and show that on the GUI.

void MainWindow::on_timeout(){
    tmpValue++;
    ui->testValue->display(tmpValue);
}

I copypasted a ui for a old project and added some of my own stuff.

I made the QLCDNumber testValue with a tag behind it saying the same. I expected to see the "testValue" int increase quickly but it did nothing. the weird part is when I replace the

ui->testValue->display(tmpValue);

with

ui->lcdThreshold1->display(tmpValue);

It worked as intended, but of course not with the QLCDNumber I wanted

this works for all QLCDNumbers that I have created in the past, just whenever I add a new one it does not work.

Some things worth noting are that it builds and runs without a problem. Also the "lcdThreshold1" from earlier is red the Qt editor, just like the "ui" bit. Whenever I put the new QLCDNumber there, like "testValue", it stays black and is not a option on the autocomplete.

Thanks in advance for your time!

pastebin of the xml file

  • How did you copy the old ui? – p-a-o-l-o Feb 23 '18 at 14:02
  • opening the old one, selecting it all and just ctrl c & ctrl v it. Have found a temporary fix. If I copy and paste another QLCDNumber and rename it it works as expected – Otto de Visser Feb 23 '18 at 15:16
  • Can you post the non-working ui xml? – p-a-o-l-o Feb 23 '18 at 15:20
  • added the xml file, https://pastebin.com/hF9x85rZ – Otto de Visser Feb 24 '18 at 13:04
  • There is nothing named `testValue` in the *ui*, and probably there has never been. It looks like you mismatched its name and went on running the latest build. – p-a-o-l-o Feb 24 '18 at 14:14
  • hmm, thanks, I have noticed that when i change the name in the graphical editor the rest of the program seems to lag behind on noticing this change, maybe it had to do with that, because force saving and making it externally for the command line worked. i feel like i broke my Qt install or something, when building and running it seems to build fine and then running it runs a outdated build. i think i might just reinstall ubuntu and Qt. thanks for your time tho – Otto de Visser Feb 28 '18 at 13:25
  • It could be a creator issue. Are you using *Clang Code Model*? (http://doc.qt.io/qtcreator/creator-clang-codemodel.html) – p-a-o-l-o Feb 28 '18 at 15:22

0 Answers0