简体   繁体   中英

Connect Segmentation Fault in Qt

I am getting an error on my connect segmentation fault and program crashes. SIGSEGV

//notepad.cpp
connect(Properties->UI->okWordPushButton, SIGNAL(clicked()), this, SLOT(wordcount(int)));

void notepad::wordcount(int wcount)
{

        wcount = ui->textEdit->toPlainText().split(QRegExp("(\\s|\\n|\\r)+"), QString::SkipEmptyParts).count();
        Properties->UI->wordcountlabel->setText(QString::number(wcount))

}

What I am trying to accomplish is that when I press okWordPushButton in Properties it will read from notepad->textEdit and send an int to Properties->wordcountlabel

//notepad.h
public slots:
    void wordcount(int);

I have included all the files for properties but I get that error. Please help.

I had to use a different approach.

 connect(Properties, SIGNAL(wordComboChanged(int, QString)), this,SLOT(calculateWordCount(int, QString)));
connect(this, SIGNAL(wordCountUpdated(int)), Properties, SLOT(updateWordCount(int)));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM