Results 1 to 2 of 2

Thread: Is lineEdit from dialog connectable to textEdit from mainwindow?

  1. #1
    Join Date
    Jan 2014
    Posts
    1
    Thanks
    1

    Default Is lineEdit from dialog connectable to textEdit from mainwindow?

    It's my third day in Qt and the second day I'm trying to find any reasonable solution to insert a text from my dialog to the textEdit widget on the mainwindow. I know it's a C++ question and I suspect it's about inheritance, but please be kind to me. I am not a programmer and I will never be, I am a linguist. Please don't give me any advices about further readings, just help me with the problem. The code is attached: foo.zip.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Is lineEdit from dialog connectable to textEdit from mainwindow?

    The easiest way for you is to add a getter to the dialog that returns teh text
    Qt Code:
    1. QString Dialog::text() const
    2. {
    3. return ui->lineEdit->text();
    4. }
    To copy to clipboard, switch view to plain text mode 
    and then call that in MainWindow
    Qt Code:
    1. Dialog dlg;
    2. dlg.exec();
    3.  
    4. ui->textEdit->append(dlg.text());
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    knutson (16th January 2014)

Similar Threads

  1. Connecting from a dialog to mainWindow
    By harvey_slash in forum Newbie
    Replies: 9
    Last Post: 11th October 2013, 18:18
  2. Replies: 3
    Last Post: 23rd June 2013, 16:01
  3. Replies: 3
    Last Post: 25th August 2012, 11:18
  4. How to input Chinese characters in LineEdit or TextEdit ?
    By behlkush in forum Qt Programming
    Replies: 2
    Last Post: 23rd May 2011, 12:26
  5. lineedit fill in new dialog window.
    By mkarakaplan in forum Newbie
    Replies: 1
    Last Post: 7th October 2007, 07:00

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.