Results 1 to 2 of 2

Thread: Predefined parameter in TextFile to control the Output Widget

  1. #1
    Join Date
    Oct 2016
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Predefined parameter in TextFile to control the Output Widget

    It is normal in GUI, where we will set an Input Widget (Scrollbar, slider, textedit, etc) and will be controlled/ displayed to the Output Widget (ProgressBar, LCD, Label)

    Can I control the Output widget instead of using the Input widget, but I'm using a predefined text inside a textfile (.txt) which will be loaded inside the QT?

    Example:

    I open the notepad, type in '60' , save as ".txt" file and execute my QT program. As it launches, the progress bar inside the window will move to "60", or the LCD will display "60".

    Can anyone teach me how to do that?

    Thanks

  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: Predefined parameter in TextFile to control the Output Widget

    These output widgets have a setValue() or setText() method (or similar), that can be used to set the value they are displaying.

    For reading the file you will need QFile.

    The value in a text file is a string, so if the widget needs an integer you will first have to convert that. See QByteArray::toInt().

    Cheers,
    _

Similar Threads

  1. Replies: 4
    Last Post: 16th August 2015, 09:42
  2. Custom Container with predefined child widgets
    By nibedit in forum Qt Programming
    Replies: 1
    Last Post: 30th April 2014, 09:50
  3. what predefined font styles are given?
    By szisziszilvi in forum Newbie
    Replies: 1
    Last Post: 3rd August 2011, 16:28
  4. QLabel to textfile
    By jantje78 in forum Newbie
    Replies: 2
    Last Post: 11th May 2011, 10:53
  5. Replies: 2
    Last Post: 4th December 2009, 10:38

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.