February 3, 2012

DominicanTech DominicanTech
Lab Rat
16 posts

QtCreator using QLCDNumber

 

Hello,

I’m trying to create a Qt app to read in temperature values. I’m far from completing this as I’m new to Qt. I made a simple form which contains just a QLCDNumber widget on default settings.

so in main.cpp file I try to use this

lcdNumber->display(23); and I get a compiler error:
error: ‘lcdNumber’ was not declared in this scope

I’m not sure if I’m calling the object correctly or if I missed to add a header file or something else.

5 replies

February 3, 2012

Volker Volker
Robot Herder
5428 posts

UI elements are usually contained in an ui object, I’d try

  1. ui->lcdNumber->display(23);

February 6, 2012

DominicanTech DominicanTech
Lab Rat
16 posts

Koo, thanks.
So let me get this straight, bare with me, I’m new to Qt.
When I create the UI using form, Qt automatically creates the .ui qml for me and I have to use the ui-> to complete my task. Does this also apply to, or is it similar, to other widgets used? any reference to a tutorial or something might help me out.

Thanks

February 7, 2012

DominicanTech DominicanTech
Lab Rat
16 posts

That didn’t work out for me.
It says ui has not been declared

Volker wrote:
UI elements are usually contained in an ui object, I’d try

  1. ui->lcdNumber->display(23);

February 9, 2012

Volker Volker
Robot Herder
5428 posts

Sorry, I don’t know how you incorporate the ui file into your application. If you enlighten us here, we can help better.

February 9, 2012

Andre Andre
Area 51 Engineer
6031 posts

DominicanTech wrote:
When I create the UI using form, Qt automatically creates the .ui qml for me

You are confusing interface paradigms here. The things you create based on widgets will not result in QML at all. That will result in a c++ header file (after processing by the uic tools wich will be run by qmake), which is then included in your application.

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

 
  ‹‹ Drag rows from iTunes into Qt app      Problem with building console application ››

You must log in to post a reply. Not a member yet? Register here!