Results 1 to 6 of 6

Thread: signal problem

  1. #1
    Join Date
    Sep 2010
    Posts
    7
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question signal problem

    I want to send a signal in a slot.The code like:
    void MainQtWidget::GetTextMsg(){
    *val = MainTextEdit->toPlainText();//get QLineEdit text
    emit this->FromQtToCoreSignal(&val);
    }
    GetTextMsg() is a slot,about this code:
    MainTextEdit = new QTextEdit("Waiting for enter!");
    connect(MainSureButton, SIGNAL(clicked()), this, SLOT(GetTextMsg()));

    It runs' problem:
    The program has unexpectedly finished.

    debug problem:
    The inferior stopped because it received a signal from the Operating System.

    Signal name :
    SIGSEGV
    Signal meaning :
    Segmentation fault



    How can I do? Could you tell me what mistake I have make?
    Thanks very much!

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: signal problem

    Quote Originally Posted by brantyou View Post
    I want to send a signal in a slot.The code like:
    Qt Code:
    1. *val = MainTextEdit->toPlainText();//get QLineEdit text
    To copy to clipboard, switch view to plain text mode 
    What is this?

  3. #3
    Join Date
    Sep 2010
    Posts
    7
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: signal problem

    to get the QLineEdit text and save in val which defined like QString *val;

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: signal problem

    Does this even compile?

    Anyway, QLineEdit doesn't have any toPlainText() function since it can only contain plain text.

    Why don't you simply do something like this?
    Qt Code:
    1. void MyClass::mySlot()
    2. {
    3. emit mySignal(myLineEdit->text());
    4. }
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Sep 2010
    Posts
    7
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: signal problem

    Can it send the text that I just had enterd? I try it at once.Thanks for you help!My English is not good,so much time can't make others known my mind!

  6. #6
    Join Date
    Sep 2010
    Posts
    7
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: signal problem

    I try it . It didn't work. Because I can't find the text() in myLineEdit.
    myLineEdit->text() the text() is invalid.

Similar Threads

  1. QThread + signal problem
    By BIllNo123 in forum Newbie
    Replies: 6
    Last Post: 25th August 2010, 10:20
  2. problem with emiting a signal
    By msmihai in forum Newbie
    Replies: 2
    Last Post: 3rd January 2009, 14:32
  3. QWizard signal problem
    By oguzy in forum Qt Programming
    Replies: 4
    Last Post: 10th September 2008, 10:43
  4. QListWidget signal problem
    By rishid in forum Qt Programming
    Replies: 6
    Last Post: 18th January 2008, 20:43
  5. problem with signal/slot
    By ihoss in forum Newbie
    Replies: 2
    Last Post: 24th August 2007, 22:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.