Results 1 to 4 of 4

Thread: Get current line edit text and return to some class

  1. #1
    Join Date
    Feb 2013
    Posts
    71
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Get current line edit text and return to some class

    Hi, I want to get the current text from line edit and return its containing text to another class without using a signal/slot button. This process needs to happen only once. I can't think of anyway to do it right now.

    Thanks in advance.

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Get current line edit text and return to some class

    Hi, I want to get the current text from line edit and return its containing text to another class without using a signal/slot button. This process needs to happen only once. I can't think of anyway to do it right now.
    Qt Code:
    1. void
    2. get_the_current_text_from_lineedit_and_return_containing_text_to_another_class_without_using_a_signal_or_slot(QLineEdit* lineedit, AnotherClass* otherClass)
    3. {
    4. QString text = lineedit->text();
    5. otherClass->DoSomething(text);
    6. }
    To copy to clipboard, switch view to plain text mode 

    Thanks in advance.
    You're welcome.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Feb 2013
    Posts
    71
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Get current line edit text and return to some class

    Quote Originally Posted by amleto View Post
    Qt Code:
    1. void
    2. get_the_current_text_from_lineedit_and_return_containing_text_to_another_class_without_using_a_signal_or_slot(QLineEdit* lineedit, AnotherClass* otherClass)
    3. {
    4. QString text = lineedit->text();
    5. otherClass->DoSomething(text);
    6. }
    To copy to clipboard, switch view to plain text mode 


    You're welcome.
    From the above it looks like you are getting the text and applying changes in one method. I need to use the line edit text in the other classes method.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Get current line edit text and return to some class

    Quote Originally Posted by Cyrebo View Post
    From the above it looks like you are getting the text and applying changes in one method. I need to use the line edit text in the other classes method.
    Qt Code:
    1. void get_the_current_text_from_lineedit_and_use_it_in_the_other_classes_method(QLineEdit *lineedit, AnotherClass *otherClass) {
    2. QString text = lineedit->text();
    3. otherClass->setTextThatCanBeUsedElsewhere(text);
    4. }
    5.  
    6. void AnotherClass::setTextThatCanBeUsedElsewhere(const QString &txt) { m_textThatCanBeUsedElsewhere = txt; }
    7.  
    8. void AnotherClass::doSomethingWithTextSetWithSetTextThatCanBeUsedElsewhere() {
    9. doSomethingWith(m_textThatCanBeUsedElsewhere);
    10. }
    To copy to clipboard, switch view to plain text mode 

    You're welcome.

    By the way, how is this problem related to Qt?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QTableView line edit clears the text on edit
    By PlasticJesus in forum Qt Programming
    Replies: 5
    Last Post: 14th March 2015, 20:06
  2. Text/line edit in QWebView
    By Esperto in forum Qt Programming
    Replies: 1
    Last Post: 15th December 2011, 10:41
  3. Replies: 3
    Last Post: 26th August 2010, 09:57
  4. Qt class showing text area/text edit
    By maverick_pol in forum Qt Programming
    Replies: 4
    Last Post: 21st August 2008, 13:15
  5. Replies: 8
    Last Post: 15th May 2007, 10:21

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.