Results 1 to 5 of 5

Thread: Use Push Button to change a variable

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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: Use Push Button to change a variable

    Quote Originally Posted by Qem1st View Post
    but how do I take the text from 'enterFile' (a QLineEdit), and store that into a QString
    Already very thorougly answered but just to emphasis that the most reduced answer to your question is
    Qt Code:
    1. QString fileName = enterFile->text();
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  2. #2
    Join Date
    Jan 2013
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Use Push Button to change a variable

    I've got everything fixed up, and have everything set up to get the file name and to open the file, but when I try to use this line of code,

    QString line = Stream.readAll();

    or this,

    QString line = Stream.readLine(0);

    'line' is empty. I've verified that it opened the file up without a problem, but somehow it thinks it's empty. The file is a text file with some random crap that I generated in notepad.

    Why can't I get anything?

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Use Push Button to change a variable

    Why can't I get anything?
    How can we possibly know? How have you opened the file? Have you already read anything form it? Is it the file you think you have opened or another? What is the relationship between the file you have opened and "Stream"?

Similar Threads

  1. [QT]Push button-no action
    By nqn in forum Newbie
    Replies: 4
    Last Post: 30th May 2010, 19:08
  2. Hareware Push Button
    By mickeyk191 in forum Newbie
    Replies: 2
    Last Post: 26th January 2010, 12:41
  3. How to change text color of push button?
    By augusbas in forum Qt Programming
    Replies: 2
    Last Post: 3rd July 2009, 10:32
  4. shape of push button
    By Seema Rao in forum Qt Programming
    Replies: 23
    Last Post: 2nd April 2008, 01:05
  5. Push Button problem!!
    By Seema Rao in forum Qt Programming
    Replies: 1
    Last Post: 22nd April 2006, 16:31

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
  •  
Qt is a trademark of The Qt Company.