Results 1 to 6 of 6

Thread: basic question: getting value from qwidget and use it in mainapplication

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2006
    Location
    Coimbatore,India
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: basic question: getting value from qwidget and use it in mainapplication

    hi,

    Do you want get data from QLineEdit box ?

    the follwing function should return what ever lineedit box contains

    QString displayText() and QString text();

    more details ,refer Qt Assistant

  2. #2
    Join Date
    Jan 2006
    Location
    India
    Posts
    54
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 7 Times in 6 Posts

    Default Re: basic question: getting value from qwidget and use it in mainapplication

    If u want to get the value of text box from a QWidget to MainWindow,

    declare an instance of QWidget say MyQWidget in ur MainWindow then u can get the value by MyQWidget->MyTextBox->text();

    Or if u r doing all the things in designer(i.e. u r not creating any implementation header or source file) then the place where u r actually getting the text string, store this in an extern variable and access this extern variable in ur MainWindow.
    But I would not recommend this approach, its better that u should create the implementation files for both ur QWidget and MainWindow, then implement the functionality there.

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.