Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error popping up message box after modifying table column
Qt 6.12 LTS is out! See what's new in the release blog

Error popping up message box after modifying table column

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 3 Posters 2.5k 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.
  • Christian EhrlicherC Christian Ehrlicher

    The message box spins a new eventloop and therefore the lineEdit is already gone or similar conditions.

    I Offline
    I Offline
    IknowQT
    wrote on last edited by
    #5

    @Christian-Ehrlicher

    	usrTableDelegate* pFrozen = static_cast<usrTableDelegate*>(this->ui.tableWidget->GetFrozenTable()->itemDelegate());
    	this->connect(pFrozen, &usrTableDelegate::UserDefine_EnableEditable, [=](usrSetupLineEdit* editor)
    		{
    			usrSetupLineEdit* lineEdit = static_cast<usrSetupLineEdit*>(editor);
    
    			this->connect(lineEdit, &usrSetupLineEdit::UserDefineReturnPress, [=]()
    				{
    					bool bRet = cGlobalParam::FloatingPointComparison(lineEdit->text().toDouble(), m_strPrevConc.toDouble());
    
    					if (ConcContain(lineEdit->text()))
    					{
    						
    					}					
    				});
    
    			QMessageBox msg;
    			msg.setText("asdasdasD");
    			msg.exec();
    		});
    

    I changed the location of Qmessagebox and ran it, and it works fine.

    1 Reply Last reply
    0
    • I IknowQT

      @jsulm

      Exception thrown (0x00007FF9B4FA63BC (Qt5Cored.dll), MainWidget.exe): 0xC0000005: 0xFFFFFFFFFFFFFFFFFF Access violation while reading location.

      How to remove const and change signature of signal slot?
      This method I did is an example I found by Googling.

      If I remove the const and use static_cast it throws an error.

      C2338 Signal and slot arguments are not compatible. MainWidget C:\Qt\5.15.2\msvc2019_64\include\QtCore\qobject.h 328
      C2955 'QtPrivate::AreArgumentsCompatible': use of class template requires template argument list. MainWidget C:\Qt\5.15.2\msvc2019_64\include\QtCore\qobject.h 333

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #6

      @IknowQT said in Error popping up message box after modifying table column:

      How to remove const and change signature of signal slot?

      Come on: you know how to edit source code/text?
      Why do you cast usrSetupLineEdit* to usrSetupLineEdit* ?! editor IS already a usrSetupLineEdit*! Please think about what you are doing.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      I 1 Reply Last reply
      0
      • jsulmJ jsulm

        @IknowQT said in Error popping up message box after modifying table column:

        How to remove const and change signature of signal slot?

        Come on: you know how to edit source code/text?
        Why do you cast usrSetupLineEdit* to usrSetupLineEdit* ?! editor IS already a usrSetupLineEdit*! Please think about what you are doing.

        I Offline
        I Offline
        IknowQT
        wrote on last edited by
        #7

        @jsulm

        It was my mistake. It has become a habit.
        What steps can I take next? The error is the same.

        jsulmJ 1 Reply Last reply
        0
        • I IknowQT

          @jsulm

          It was my mistake. It has become a habit.
          What steps can I take next? The error is the same.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #8

          @IknowQT said in Error popping up message box after modifying table column:

          What steps can I take next?

          1. Post current code
          2. Let us know from which line of your code the error originates from

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          I 1 Reply Last reply
          0
          • jsulmJ jsulm

            @IknowQT said in Error popping up message box after modifying table column:

            What steps can I take next?

            1. Post current code
            2. Let us know from which line of your code the error originates from
            I Offline
            I Offline
            IknowQT
            wrote on last edited by
            #9

            @jsulm

            usrTableDelegate* pFrozen = static_cast<usrTableDelegate*>(this->ui.tableWidget->GetFrozenTable()->itemDelegate());
            	this->connect(pFrozen, &usrTableDelegate::UserDefine_EnableEditable, [=](const usrSetupLineEdit* editor)
            		{
            			//usrSetupLineEdit* lineEdit = static_cast<usrSetupLineEdit*>(editor);
            
            			this->connect(editor, &usrSetupLineEdit::UserDefineReturnPress, [=]()
            				{
            					if (ConcContain(editor->text()))
            					{
            						QMessageBox msg;
            						msg.setText("asdasdasD"); 
            						msg.exec();
            						//Show();
            
            						int a = 0;
            						int b = 0;
            
            						//emit UserDefine_Msg();
            					}					
            				});
            
            			/*QMessageBox msg;
            			msg.setText("asdasdasD");
            			msg.exec();*/
            		});
            
            
            QWidget* usrTableDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
            {
            	usrSetupLineEdit* pEdit = new usrSetupLineEdit(parent);//qobject_cast<usrSetupLineEdit*>(lineEdit);
            	pEdit->SetOnlyNumber(true, true);
            	pEdit->SetRange(m_min, m_max);
            	pEdit->setAlignment(Qt::AlignCenter);
            
            	emit UserDefine_EnableEditable(pEdit);
            	return pEdit;
            }
            
            jsulmJ 1 Reply Last reply
            0
            • I IknowQT

              @jsulm

              usrTableDelegate* pFrozen = static_cast<usrTableDelegate*>(this->ui.tableWidget->GetFrozenTable()->itemDelegate());
              	this->connect(pFrozen, &usrTableDelegate::UserDefine_EnableEditable, [=](const usrSetupLineEdit* editor)
              		{
              			//usrSetupLineEdit* lineEdit = static_cast<usrSetupLineEdit*>(editor);
              
              			this->connect(editor, &usrSetupLineEdit::UserDefineReturnPress, [=]()
              				{
              					if (ConcContain(editor->text()))
              					{
              						QMessageBox msg;
              						msg.setText("asdasdasD"); 
              						msg.exec();
              						//Show();
              
              						int a = 0;
              						int b = 0;
              
              						//emit UserDefine_Msg();
              					}					
              				});
              
              			/*QMessageBox msg;
              			msg.setText("asdasdasD");
              			msg.exec();*/
              		});
              
              
              QWidget* usrTableDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
              {
              	usrSetupLineEdit* pEdit = new usrSetupLineEdit(parent);//qobject_cast<usrSetupLineEdit*>(lineEdit);
              	pEdit->SetOnlyNumber(true, true);
              	pEdit->SetRange(m_min, m_max);
              	pEdit->setAlignment(Qt::AlignCenter);
              
              	emit UserDefine_EnableEditable(pEdit);
              	return pEdit;
              }
              
              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #10

              @IknowQT Would be nice if you would also answer second question...

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              I 1 Reply Last reply
              0
              • jsulmJ jsulm

                @IknowQT Would be nice if you would also answer second question...

                I Offline
                I Offline
                IknowQT
                wrote on last edited by IknowQT
                #11

                @jsulm

                sorry.
                If you click OK in the message box after executing msg.exec(), it occurs in return a.exec() of the main widget class.
                The program terminates immediately without any intermediate process, and the call stack cannot be looked up.

                int main(int argc, char* argv[])
                {
                     MainWidget* wMain = new MainWidget();
                    ShowMainWidget(wMain);
                
                    return a.exec();    /// an error occurs here
                }
                
                jsulmJ 1 Reply Last reply
                0
                • I IknowQT

                  @jsulm

                  sorry.
                  If you click OK in the message box after executing msg.exec(), it occurs in return a.exec() of the main widget class.
                  The program terminates immediately without any intermediate process, and the call stack cannot be looked up.

                  int main(int argc, char* argv[])
                  {
                       MainWidget* wMain = new MainWidget();
                      ShowMainWidget(wMain);
                  
                      return a.exec();    /// an error occurs here
                  }
                  
                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by jsulm
                  #12

                  @IknowQT said in Error popping up message box after modifying table column:

                  and the call stack cannot be looked up

                  I don't believe that. Run your app built in debug mode until it crashes, then you will have the stack trace.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  I 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @IknowQT said in Error popping up message box after modifying table column:

                    and the call stack cannot be looked up

                    I don't believe that. Run your app built in debug mode until it crashes, then you will have the stack trace.

                    I Offline
                    I Offline
                    IknowQT
                    wrote on last edited by
                    #13

                    @jsulm

                    If you look at my first post, I've captured and posted about the call stack.
                    You may refer to the contents of the capture. This is not the call stack I have access to.

                    jsulmJ 1 Reply Last reply
                    0
                    • I IknowQT

                      @jsulm

                      If you look at my first post, I've captured and posted about the call stack.
                      You may refer to the contents of the capture. This is not the call stack I have access to.

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #14

                      @IknowQT said in Error popping up message box after modifying table column:

                      If you look at my first post, I've captured and posted about the call stack

                      You also changed the code in the meantime...

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      I 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @IknowQT said in Error popping up message box after modifying table column:

                        If you look at my first post, I've captured and posted about the call stack

                        You also changed the code in the meantime...

                        I Offline
                        I Offline
                        IknowQT
                        wrote on last edited by IknowQT
                        #15

                        @jsulm said in Error popping up message box after modifying table column:

                        You also changed the code in the meantime...

                        Even if the code is changed, the contents are similar and the contents of the error are the same. That doesn't seem to be the issue.

                        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
                        • Unsolved