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. Temp data to lcd widget
QtWS25 Last Chance

Temp data to lcd widget

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.5k 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.
  • L Offline
    L Offline
    lihakimpale
    wrote on last edited by
    #1

    I am new to GUI development and don't have much experience in C++ either. I am trying to print my temperature data to the lcd widget when pressed pushbutton. Temperature data is coming from bluetooth server and stored in a struct.

    @#include "mainwindow.h"
    #include "ui_mainwindow.h"

    extern "C"{
    #include "defines.h"
    }

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    void MainWindow::on_Temp_Button_clicked()
    {
    struct Measurement_Data *m_Data;

    m_Data = L2CAP_server();
    

    }

    void MainWindow::on_Humi_Button_clicked()
    {

    }

    void MainWindow::on_lcdNumber_overflow()
    {

    }@

    If you could show me how I can get the temp data printet to lcd widget when pressed that pushbutton named Temp_Button.

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      Hi,
      Just to make life easy, why not use a QLineEdit as a readonly object to first store your value in. Then when that all works, check out how to show the data in the LCDWidget.
      The QLineEdit has a setText function. Convert the m_Data value (a member of that struct) to a QString and set the text.
      When we do not have the m_Data struct definition there is no way we are able to show any code.

      Greetz, Jeroen

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lihakimpale
        wrote on last edited by
        #3

        Oh sorry forgot that struct definition.

        @struct Measurement_Data {

        float temp;
        float humi;
        };@

        1 Reply Last reply
        0
        • JeroentjehomeJ Offline
          JeroentjehomeJ Offline
          Jeroentjehome
          wrote on last edited by
          #4

          Ah, that is a bit more easy to understand then ;-)
          Isn't it just:
          @
          ui->yourLcdWidget.display(m_Data.temp);
          @

          Greetz, Jeroen

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lihakimpale
            wrote on last edited by
            #5

            error: '((MainWindow*)this)->MainWindow:ui->Ui:MainWindow:<anonymous>.Ui_MainWindow:lcdNumber' cannot be used as a function

            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