[Solved]Problem with QDateTimeEdit::setCurrentSection or setCurrentSectionIndex

  • I am using a QDateTimeEdit widget to scroll through a graph consisting of data plotted against time. When I start the software, I would like the QDateTimeEdit widget to have the minutes section as the current section, so that when the user clicks the up or down arrow, the minutes section will increment or decrement. However, the month section always comes up as the current section until the user clicks on another section. I have tried using setCurrentSection and setCurrentSectionIndex in the constructor, but they have no effect. Likewise, since I am using QtDesigner, I have tried to set the current section to minutes in the QtDesigner form, but that doesn't work either. If I change the current section in the form to "minutes" and save the file or the project, it always goes back to "month" the next time I open the project. I obviously don't understand the function of setCurrentSection or setCurrentSectionIndex. Is there in fact a way to force a newly-constructed QDateTimeEdit come up with a section other than months as current section ?

  • Here I am answering myself !

    This is apparently a bug in Qt which was reported in November 2013 as QTBUG-34759. The person who reported it also gave a simple work around, which I incorporated, and it worked perfectly:)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.