Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator: Widgets are not added to h file
QtWS25 Last Chance

Qt Creator: Widgets are not added to h file

Scheduled Pinned Locked Moved Qt Creator and other tools
2 Posts 2 Posters 2.3k 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.
  • Z Offline
    Z Offline
    zvivered
    wrote on last edited by
    #1

    Hello,

    I created a "Qt Gui Application" project with Qt creator 2.3.1

    The project creates: main.cpp, mainwindow (cpp+h).

    I added a "List Widget" to mainwindow.ui.

    After saving and rebuild, the "List Widget" object is not added to mainwindow.h

    Same with "Push Button" or any other widget.

    I created a signal+slot that were not added to mainwindow.h.

    I had to add them manually.

    What is the reason for this ?

    Thanks,
    Zvika.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      the widgets are added to your ui class, you can access them via the ui pointer or member variable:

      @
      // pointer
      ui->pushButton->setText("bla");

      // member variable
      ui.listWidget->clear();
      @

      http://www.catb.org/~esr/faqs/smart-questions.html

      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