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. QDateEdit: emitted signal dateChanged(const QDate&) freezes the desktop
Forum Updated to NodeBB v4.3 + New Features

QDateEdit: emitted signal dateChanged(const QDate&) freezes the desktop

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 4 Posters 2.1k Views 2 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.
  • RalfSchaeferR Offline
    RalfSchaeferR Offline
    RalfSchaefer
    wrote on last edited by
    #1

    Hello together,

    i hope, anybody can help me here. I've got a strange problem, that I've observed never before. I'm running Qt 5.11.1 on an OpenSuse Leap 15 system.

    I want to connect the signal dateChanged(const QDate&) from a dynamically created QDateEdit to a slot in my own class:

            toDateEditName = QString("ToDateEdit_%1").arg(i,2,10,QLatin1Char('0')); 
            ...
            QDateEdit *toDateEdit = new QDateEdit(end);
            toDateEdit->setDisplayFormat(tr("yyyy-MM-dd"));
            toDateEdit->setObjectName(toDateEditName);
            toDateEdit->setCalendarPopup(false);
            ...
            connect(toDateEdit, &QDateEdit::dateChanged, this, &MdiChild::vacationEndDateChanged);
    

    The objectname of the dateEdit is set to toDateEdit_xx where xx is an integer with 2 fields. Additionally, I save the pointer to the toDateEdit in QList. The Slot connected to looks like that:

    void MdiChild::vacationEndDateChanged(const QDate &date)
    {
        qDebug() << "ENTER: void MdiChild::vacationEndDateChanged(const QDate &date)";
        QDateEdit *senderObj = qobject_cast<QDateEdit *>( sender());
    
        if (senderObj != nullptr)
        {
            QString senderName = senderObj->objectName();
            bool ok;
            int senderNum = senderName.right(2).toInt(&ok);
            if (ok)
            {
                QDate endBegin = date;
                hcalc.changeVacationEndDate(senderNum,endBegin);
            }
            else
            {
                // TODO: Errorhandling
                qDebug() << "the sender number " << senderNum << " of " << senderName << " is NOT valid";
            }
        }
        setDocumentModified(true);
        updateCurriculumInformation();
        updateCurriculumLayout();
        qDebug() << "LEAVE: void MdiChild::vacationEndDateChanged(const QDate &date)";
    }
    

    when I edit the date, my program jumps into the slot-function and freezes not only the program but my entire desktop occasionally. The mouse is still working, but there is no reaction on mouse- or keyboardevents anymore. If QtCreator and a debugger is connected, QTCreator freezes to. So, it's quite difficult for me, the analyze this problem. To solve this, I've to switch to a text console and kill the programm manually. The desktop is responsive again afterwards.

    During my tests, I've made some observation, that my help to isolate the problem:

    • when setting calenderPopup to true, the program and the desktop freeze a lot more often.
    • the freezing happens also, when my slot-function is completely empty.
    • the freezing happens nearly everytime, when I change the year part of the date.
    • as long, as the program is not freezed, I can monitor the system calls with strace, when the program is not responsive any more, I get the message, that the process runs in x32 mode. I can't see any syscalls anymore then:
    ralf@chaos:~> strace -p 2218
    strace: Process 2218 attached
    strace: [ Process PID=2218 runs in x32 mode. ]
    

    I'd be really happy, if someone knows this kind of problem and could help me with that.

    Greetings,
    Ralf

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you observe the same behaviour if you use your distribution provided Qt ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • RalfSchaeferR Offline
        RalfSchaeferR Offline
        RalfSchaefer
        wrote on last edited by
        #3

        currently, the only version installed, is the one I downloaded from www.qt.io. So I can't tell that. I've had this prob never before though.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then can you try with the previous version of Qt ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • RalfSchaeferR Offline
            RalfSchaeferR Offline
            RalfSchaefer
            wrote on last edited by
            #5

            I'll do that tomorrow. Which version of Qt would you recommend?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Start by 5.11.0, if it's still happening then continue back.

              But first you should test the version of OpenSuse to eliminate that's not your system that's doing something funky somehow.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • RalfSchaeferR Offline
                RalfSchaeferR Offline
                RalfSchaefer
                wrote on last edited by
                #7

                To exclude that my Linux is responsible, I have also translated the program under Windows with minGW. The same problem occurs there. You can change the date a couple of times, but eventually, the program freezes. One difference between Linux and Windows: Under Linux, additionally the whole desktop freezes, when calenderPopup ist true.

                I've also tried, to compile the program with some older versions, 5.11.0, 5.10.0 and 5.8.0.
                Always the same problem.

                When running the program with the debugger, I can see, that the program enters the connected slot (see above) and freezes BEFORE executing any entered command. When that happens, QTCreator and the debugger freeze too.

                J.HilkJ 1 Reply Last reply
                0
                • RalfSchaeferR RalfSchaefer

                  To exclude that my Linux is responsible, I have also translated the program under Windows with minGW. The same problem occurs there. You can change the date a couple of times, but eventually, the program freezes. One difference between Linux and Windows: Under Linux, additionally the whole desktop freezes, when calenderPopup ist true.

                  I've also tried, to compile the program with some older versions, 5.11.0, 5.10.0 and 5.8.0.
                  Always the same problem.

                  When running the program with the debugger, I can see, that the program enters the connected slot (see above) and freezes BEFORE executing any entered command. When that happens, QTCreator and the debugger freeze too.

                  J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by aha_1980
                  #8

                  @RalfSchaefer
                  2 ideas you could test as well

                  specify the 5th connect parameter as Qt::DirectConnection, maybe the autoconnect makes a blockingconnection which would deadlock your program, unlikly, burt worth a shot.

                  connect to lambda in the connect instead of a slot

                  maybe this gives you/us more information


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  RalfSchaeferR 1 Reply Last reply
                  1
                  • M Offline
                    M Offline
                    MrShawn
                    wrote on last edited by
                    #9
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • J.HilkJ J.Hilk

                      @RalfSchaefer
                      2 ideas you could test as well

                      specify the 5th connect parameter as Qt::DirectConnection, maybe the autoconnect makes a blockingconnection which would deadlock your program, unlikly, burt worth a shot.

                      connect to lambda in the connect instead of a slot

                      maybe this gives you/us more information

                      RalfSchaeferR Offline
                      RalfSchaeferR Offline
                      RalfSchaefer
                      wrote on last edited by
                      #10

                      @J.Hilk : Thanks for the advice. I'll try that. But it will take till next sunday, before I can do that. I'll keep you up to date then.

                      1 Reply Last reply
                      0
                      • RalfSchaeferR Offline
                        RalfSchaeferR Offline
                        RalfSchaefer
                        wrote on last edited by
                        #11

                        I was able to solve the problem in the meantime. It was some sort of a signal loop.

                        I've got a couple of QDateEdits in my program. When I change the date in one of my QDateEdits, it sets the mimimumDate or the maximumDate of another QDateEdit. This could change the date in the second QDateEdit who sent another signal around, which again sets mimimumDate or the maximumDate. The program somehow looped.

                        A little bit strange is, that I could not see this in the debugger.

                        Thanks a lot for all the help.

                        Ralf

                        1 Reply Last reply
                        1

                        • Login

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