Error: ‘class QLabel’ has no member named ‘dateTime’???



  • Terminal errors:
    test.cpp: In member function ‘void Press::Save()’:
    test.cpp:107:50: error: ‘class QLabel’ has no member named ‘dateTime’
    test.cpp:108:52: error: ‘class QLabel’ has no member named ‘dateTime’
    test.cpp:109:56: error: ‘class QLabel’ has no member named ‘currenttext’
    test.cpp:110:54: error: ‘class QLabel’ has no member named ‘toPlainText’
    test.cpp:113:24: error: ‘class QLabel’ has no member named ‘setCurrentIndex’
    test.cpp:114:21: error: ‘class QLabel’ has no member named ‘setDateTime’
    test.cpp:115:22: error: ‘class QLabel’ has no member named ‘setDateTime’
    test.cpp: At global scope:
    test.cpp:118:15: error: found ‘:’ in nested-name-specifier, expected ‘::’
    test.cpp: In member function ‘void Press::Discard()’:
    test.cpp:120:24: error: ‘class QLabel’ has no member named ‘setCurrentIndex’
    test.cpp:121:21: error: ‘class QLabel’ has no member named ‘setDateTime’
    test.cpp:122:22: error: ‘class QLabel’ has no member named ‘setDateTime’
    make: *** [test.o] Error 1

    test.cpp:

    @
    void Press::Save(){
    QString filename="test.txt";
    QFile file(filename);
    if (file.open(QIODevice::WriteOnly))
    {
    QTextStream stream(&file);
    QString startboxstring = startLabel->dateTime().toString("dd.MM.yyyy hh.mm");
    QString finishboxstring = finishLabel->dateTime().toString("dd.MM.yyyy hh.mm");
    QString locationboxstring = locationLabel->currenttext();
    QString summaryboxstring = summaryLabel->toPlainText();
    stream << startboxstring.toAscii()<<"/n"<< finishboxstring.toAscii()<<"/n"<<locationboxstring.toAscii()<<"/n"<<summaryboxstring.toAscii();
    }
    locationLabel->setCurrentIndex(0);
    startLabel->setDateTime(QDateTime::currentDateTime());
    finishLabel->setDateTime(QDateTime::currentDateTime().addSecs(3600));
    }

    void Press:Discard()
    {   
        locationLabel->setCurrentIndex(0);
        startLabel->setDateTime(QDateTime::currentDateTime());
        finishLabel->setDateTime(QDateTime::currentDateTime().addSecs(3600));
    
    }   
    

    @


  • Lifetime Qt Champion

    Hi,

    You are trying to call methods from various unrelated widgets on QLabel widgets.

    e.g. dateTime is a function from QDateTimeEdit.


Log in to reply
 

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