Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Qt Creator: accessing an object not defined in the source files

    General and Desktop
    2
    2
    716
    Loading More Posts
    • 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.
    • R
      ritchan last edited by

      I have a .ui file that looks like this:
      http://img521.imageshack.us/img521/9753/nol.png
      Upon one of the QCheckBoxes being ticked, I want Generated Command Line Preview to update itself. Here's the particular code I'm trying to work with:
      @
      void Dialog::on_inputformatCombo_currentIndexChanged(const QString &arg1)
      {
      commandline.insert(commandline.length(),arg1);
      CLIPreview.setText(commandline);
      }
      @
      However, the dialog.cpp and dialog.h files are bare and don't make any mention of the objects I created in the .ui file. How am I supposed to access CLIPreview then?

      1 Reply Last reply Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        This wildly depends on how you are including your UI header (upon compilation, uic generates ui_yourdialog.h file).

        If your dialog was generated automatically by Qt Creator, then most probably you need to use:
        @
        ui->CLIPreview->setText("blah");
        @

        (Z(:^

        1 Reply Last reply Reply Quote 0
        • First post
          Last post