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. Not responding dialog
Qt 6.11 is out! See what's new in the release blog

Not responding dialog

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 4.6k 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.
  • R Offline
    R Offline
    rh
    wrote on last edited by
    #1

    hi all
    i'm writing a program that there are two dialogs in it.by pushing a button in first dialog ,data that is written in a line edit should be recieved and second dialog should be open.the problem is that when i run this program,sometimes it works properly.but sometimes it becomes not responding!I check the code in( pushing button function),but i didn't find anything wrong.what's the problem ?what should i do?
    thanks.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      loladiro
      wrote on last edited by
      #2

      Hard to tell without seeing the code.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rh
        wrote on last edited by
        #3

        this is the code about pushing button function:
        @void SearchContent::on_cmdOk_clicked()
        {
        Content content;
        Contents contents;
        TagRelations tagRelations;
        Tags tags;
        vector<Tag> tag;
        QString title=ui->Title->text();
        std::string t=title.toLocal8Bit().constData();
        content =contents.getByTitle(t);
        if(contents.Found==true)
        {
        AddContent *myAddContent=new AddContent;
        myAddContent->show();
        this->close();
        }
        else
        {
        QMessageBox::information(this,"Error",QString("content with this title not found."));
        }

        }@

        Content,Contents,Tags and TagRealtions are classes that i define them.and Found is a boolean memeber from Contents class that is false by default.but when (getByTitle() ) function from this classis is called ,
        if this function can find the content ,Found will become true.

        1 Reply Last reply
        0
        • R Offline
          R Offline
          rh
          wrote on last edited by
          #4

          and this is the content class and boolean member Found:
          @class Contents : public BaseEntity
          {

          public:
          bool Found;
          Contents()
          {
          file="content.dat";
          fp=0;
          openFile(file);
          this->Found=false;

          }

          Content getByTitle(string Title)
          {
          this->Found=false;
          int MaxID;
          fseek(fp,0,SEEK_SET);
          myfread(MaxID);
          while (!feof(fp))
          {
          int recordSize, isDeleted;
          myfread(recordSize);
          if (feof(fp)) break;
          myfread(isDeleted);
          if (isDeleted)
          {
          char buffer=new char[recordSize];
          fread(buffer,recordSize-metaSize
          1,1,fp);
          delete []buffer;
          }
          else
          {
          Content c;
          myfread(c.ID);
          myfread(c.OwnerID);
          myfread(c.Timestamp);
          readWithSize(c.Title);
          readWithSize(c.Body);
          if (c.Title==Title)
          {
          this->Found=true;
          return c;
          }
          }
          }
          return Content();
          }@

          i think the problem is about Found member .because when i remove( if & else) part which is realted to Found memeber,program runs properly.but i don't know what's the problem?

          1 Reply Last reply
          0
          • R Offline
            R Offline
            rh
            wrote on last edited by
            #5

            nobody knows the answer?

            1 Reply Last reply
            0
            • C Offline
              C Offline
              changsheng230
              wrote on last edited by
              #6

              Your style of coding is really kind of C programing, and the dialog unresponding should have nothing relationship with Qt UI, QDialog, related to your while loop and logic.

              Chang Sheng
              常升

              1 Reply Last reply
              0
              • R Offline
                R Offline
                rh
                wrote on last edited by
                #7

                you mean the problem is in while loop?

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  cincirin
                  wrote on last edited by
                  #8

                  [quote author="r@h@" date="1310724528"]
                  @
                  AddContent *myAddContent=new AddContent;
                  myAddContent->show();
                  this->close();
                  @
                  [/quote]

                  You have some problems here. Where you delete the memory allocated for myAddContent ? And ... are you sure you want to close first dialog ? If you just want to hide call QWidget::hide() or QDialog::setVisible(false)

                  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