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. Connect a checkbox widget to a line edit to appear when toggled box
Forum Updated to NodeBB v4.3 + New Features

Connect a checkbox widget to a line edit to appear when toggled box

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 1.1k 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.
  • A Offline
    A Offline
    AXNT
    wrote on last edited by
    #1

    Using QT Creator
    I created a checkBox named advSearch and when it is toggled, I want a lineEdit box named rmaEdit to appear.
    However, when I try to do ui-> advSearch, it says that
    error: no member named 'advSearch' in 'Ui::MainWindow'
    However, the rmaEdit appears.
    0_1550630361197_Screen Shot 2019-02-19 at 8.32.02 PM.png

    RatzzR Pablo J. RoginaP 2 Replies Last reply
    0
    • A AXNT

      Using QT Creator
      I created a checkBox named advSearch and when it is toggled, I want a lineEdit box named rmaEdit to appear.
      However, when I try to do ui-> advSearch, it says that
      error: no member named 'advSearch' in 'Ui::MainWindow'
      However, the rmaEdit appears.
      0_1550630361197_Screen Shot 2019-02-19 at 8.32.02 PM.png

      RatzzR Offline
      RatzzR Offline
      Ratzz
      wrote on last edited by
      #2

      @AXNT

      Can you clean and rebuild solution ?
      When you type ui-> does be any suggestion for advsearch Checkbox?
      can you check if advsearch is missspelled?
      also can you show contents of mainwindow.ui?

      --Alles ist gut.

      1 Reply Last reply
      1
      • A AXNT

        Using QT Creator
        I created a checkBox named advSearch and when it is toggled, I want a lineEdit box named rmaEdit to appear.
        However, when I try to do ui-> advSearch, it says that
        error: no member named 'advSearch' in 'Ui::MainWindow'
        However, the rmaEdit appears.
        0_1550630361197_Screen Shot 2019-02-19 at 8.32.02 PM.png

        Pablo J. RoginaP Offline
        Pablo J. RoginaP Offline
        Pablo J. Rogina
        wrote on last edited by Pablo J. Rogina
        #3

        @AXNT and when you're back from solving "error: no member named ..." you may want to take a look at your method on_advSearch_toggled()

        1. ui->advSearch->setCheckable(true) for sure had happened before (hopefully in the auto-generated UI code because you checked "checkable" property for the QCheckBox widget when you placed it in the UI. No need to do that there.
        2. No need to connect(...) any signal from QCheckBox object to QLineEdit object.
          Just do (pseudo-code):
        ui->rmaEdit->setVisible(checked);
        

        this way when the on_advSearch_toggled() method is called because the user checked or unchecked the box, the QLineEdit widget will be visible (checked is true) or not visible (checked is false)

        PS: next time, please don't paste an image of your code, just surround it with the code tag (icon </>) to get something like this, that you'll fill out with your code snippet...

        ```
        //your code here
        ```
        

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        2

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved