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. Ui can only be referenced in mainwindow.c

Ui can only be referenced in mainwindow.c

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 554 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.
  • H Offline
    H Offline
    houmingc
    wrote on last edited by
    #1

    Currently, ui can be referenced in mainwindow.c but not in other files.
    How to eliminate this shortcoming.

    @ mainwindow.c
    ui->m_label->setText("Good Morning");

    ticker.cpp
    ui->m_label_>setText("Good Morning"); //not possible.

    @

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #2

      ui is a privet pointer in a MainWindow class.
      If you want to update a content of ui from another class then you
      need to add a signal to a ticker class and emit that signal each time when you need to update a content of MainWindow::ui or you need to pass ui to that class. In the later case you will have to maintain ui from two classes which is not very good idea.

      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