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. Ctd when accessing Ui::MainWindow from another class
Qt 6.11 is out! See what's new in the release blog

Ctd when accessing Ui::MainWindow from another class

Scheduled Pinned Locked Moved General and Desktop
15 Posts 5 Posters 5.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.
  • dheerendraD Offline
    dheerendraD Offline
    dheerendra
    Qt Champions 2022
    wrote on last edited by
    #2

    @Uninstall *uninstallObj;
    if (ui->radioButton_Uninstall->isChecked()) {

        uninstallObj->hide();@
    

    Your uninstallObj is not initialised. So it will crash. Also what is ctd ?

    Dheerendra
    @Community Service
    Certified Qt Specialist
    http://www.pthinks.com

    1 Reply Last reply
    0
    • A Offline
      A Offline
      ankursaxena
      wrote on last edited by
      #3

      I think, Here uninstallObj->show(); is missing. then uninstallObj->hide(); should not work.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pditty8811
        wrote on last edited by
        #4

        [quote author="Dheerendra" date="1403675821"]
        @Uninstall *uninstallObj;
        if (ui->radioButton_Uninstall->isChecked()) {

            uninstallObj->hide();@
        

        Your uninstallObj is not initialised. So it will crash. Also what is ctd ? [/quote]
        ctd stand for crash to desktop.
        That didn't fix issue.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pditty8811
          wrote on last edited by
          #5

          [quote author="ankursaxena" date="1403681027"]I think, Here uninstallObj->show(); is missing. then uninstallObj->hide(); should not work.
          [/quote]

          That can't be right because hide() is a method I created in class Uninstall, its not a property.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            ankursaxena
            wrote on last edited by
            #6

            Oh. I haven't noticed that

            1 Reply Last reply
            0
            • A Offline
              A Offline
              ankursaxena
              wrote on last edited by
              #7

              but you should avoid such kind of nomination . It creates confusion and can be error-prone.

              1 Reply Last reply
              0
              • IamSumitI Offline
                IamSumitI Offline
                IamSumit
                wrote on last edited by
                #8

                the best way to identify the ctd is to use qDebug() statemnts ,
                Try it. then you can find the place where is crash starting.

                Be Cute

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  pditty8811
                  wrote on last edited by
                  #9

                  [quote author="IamSumit" date="1403686743"]the best way to identify the ctd is to use qDebug() statemnts ,
                  Try it. then you can find the place where is crash starting.[/quote]

                  I'm able to get information from Ui::MainWindow, like text from labels, but I am not able to adjust properties of Ui::MainWindow in class Uninstall.

                  What's the deal?

                  1 Reply Last reply
                  0
                  • p3c0P Offline
                    p3c0P Offline
                    p3c0
                    Moderators
                    wrote on last edited by
                    #10

                    Hi,

                    You should create a new Uninstall object.
                    *uninstallObj is a pointer and it points to nothing in your case and hence the seg fault.
                    Do this,
                    @
                    Uninstall *uninstallObj = new Uninstall;
                    @

                    157

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      pditty8811
                      wrote on last edited by
                      #11

                      [quote author="p3c0" date="1403690252"]Hi,

                      You should create a new Uninstall object.
                      *uninstallObj is a pointer and it points to nothing in your case and hence the seg fault.
                      Do this,
                      @
                      Uninstall *uninstallObj = new Uninstall;
                      @[/quote]

                      That's not it. I can get to the Uninstall class successfully. I test uing qDebug.

                      I just can't change properties of Ui::MainWindow from within Uninstall. weird. However I can print
                      qDebug << Ui::MainWindow->QLabel->text();
                      From within Uninstall class

                      1 Reply Last reply
                      0
                      • p3c0P Offline
                        p3c0P Offline
                        p3c0
                        Moderators
                        wrote on last edited by
                        #12

                        So is the crashing issue solved ?
                        For changing properties from one class to other i would suggest you to use "Signals and Slots mechanism":http://qt-project.org/doc/qt-4.8/signalsandslots.html.

                        157

                        1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          pditty8811
                          wrote on last edited by
                          #13

                          [quote author="p3c0" date="1403692659"]So is the crashing issue solved ?
                          For changing properties from one class to other i would suggest you to use "Signals and Slots mechanism":http://qt-project.org/doc/qt-4.8/signalsandslots.html.[/quote]

                          No its not solved.

                          1 Reply Last reply
                          0
                          • P Offline
                            P Offline
                            pditty8811
                            wrote on last edited by
                            #14

                            I'm still having trouble with this. Could someone show me a simple example of transfering *ui to another class using signals and slots?

                            1 Reply Last reply
                            0
                            • IamSumitI Offline
                              IamSumitI Offline
                              IamSumit
                              wrote on last edited by
                              #15

                              Hi
                              If your problem is still there
                              take a look on the following link
                              http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
                              hope it helps :)

                              Be Cute

                              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