Results 1 to 3 of 3

Thread: accessing .ui file from another C file

  1. #1
    Join Date
    Jul 2011
    Posts
    16
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default accessing .ui file from another C file

    Hello Folks,

    I have a question:

    I have created a project in Qt, and created a gui.

    so now i have the following:
    headers:
    mainwindow.h
    myfunction.h

    sources:
    mainwindow.cpp
    myfunction.cpp

    forms:
    mainwindow.ui


    In my mainwindow.cpp, i call the function myfunction.cpp. And everything is fine and does what is suppose to do.

    My question is:
    I want to control and update some Qlabels in mainwindow.h, how can i do that ? I know i can control the GUI through mainwindow.cpp but can i do some updates through myfunction.cpp ?


    Please kindly advice,

  2. #2
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: accessing .ui file from another C file

    Use signal/slot mechanism or getter/setter approach.
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

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

    nackasha (29th July 2011)

  4. #3
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: accessing .ui file from another C file

    Agreed. The GUI management should be restricted to a single class whenever possible. If you want another class to be able to update/read the GUI then send the appropriate data to/from the GUI management class using appropriate member functions.

  5. The following user says thank you to squidge for this useful post:

    nackasha (29th July 2011)

Similar Threads

  1. Accessing elements of a svg file
    By Hogwarts in forum Qt Programming
    Replies: 2
    Last Post: 22nd February 2011, 14:00
  2. Replies: 1
    Last Post: 22nd December 2009, 09:43
  3. Multiple File Data accessing
    By hasnatzaidi in forum Newbie
    Replies: 1
    Last Post: 28th October 2009, 16:34
  4. Accessing DTD in an XML file via QtXml module?
    By jorma in forum Qt Programming
    Replies: 1
    Last Post: 6th May 2006, 18:09
  5. Accessing the entire file..
    By Kapil in forum Newbie
    Replies: 1
    Last Post: 28th April 2006, 07:41

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.