Results 1 to 3 of 3

Thread: Changing labeltext from a class?

  1. #1
    Join Date
    Feb 2010
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Changing labeltext from a class?

    Hello, I just started with QT, and trying to change labeltexts from a class.

    In the main function I have this;
    Qt Code:
    1. Linc lc; //window classthingy
    2. lc.show()
    3. Cly cl; //My classthingy
    4. cl.init()
    To copy to clipboard, switch view to plain text mode 
    in Cly::init() i have this;
    Qt Code:
    1. {
    2. Linc lin;
    3. lin.gui.label->setText("Blabla");
    4. }
    To copy to clipboard, switch view to plain text mode 
    Which dont work, but if I take this;
    Qt Code:
    1. lc.gui.label->setText("Blabla");
    To copy to clipboard, switch view to plain text mode 
    Into the main function,instead of Cly cl; cl.init() then it works!
    Anyone got any solutions to this matter?

    Im not sure if this is the right thread, it says 'Newbie' so I figured why not;p

  2. #2
    Join Date
    Feb 2010
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Changing labeltext from a class?

    {
    Linc lin;
    lin.gui.label->setText("Blabla");
    } //since lin is a local variable it is destroyed at this point. Maybe that has something to do with the problem your having.

  3. #3
    Join Date
    Feb 2010
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Changing labeltext from a class?

    Quote Originally Posted by qlarity_three View Post
    {
    Linc lin;
    lin.gui.label->setText("Blabla");
    } //since lin is a local variable it is destroyed at this point. Maybe that has something to do with the problem your having.
    ooh blarhg, thanks, figured it out now;>

Similar Threads

  1. Replies: 2
    Last Post: 10th August 2009, 09:45
  2. Replies: 3
    Last Post: 27th December 2008, 19:34
  3. changing values for one class and showing it ..!
    By salmanmanekia in forum General Programming
    Replies: 6
    Last Post: 14th August 2008, 13:13
  4. Replies: 3
    Last Post: 16th May 2007, 11:07
  5. Signal/slot looking in base class, not derived class
    By georgie in forum Qt Programming
    Replies: 2
    Last Post: 12th May 2006, 07:36

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.