Results 1 to 3 of 3

Thread: dynamic text?

  1. #1
    Join Date
    Apr 2007
    Location
    Rakovnik, Czech Republic
    Posts
    175
    Thanks
    43
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default dynamic text?

    I have the following code in my constructor:

    Qt Code:
    1. xRotLabel = new QLabel(this); // "QLabel *xRotLabel;" is in .h file
    2. xRotLabel->setText("Initial Text");
    3. connect(mb0pButton, SIGNAL(buttonClicked()), this, SLOT(changeText()));
    To copy to clipboard, switch view to plain text mode 
    here's the changeText() function:
    Qt Code:
    1. void Window::changeText()
    2. {
    3. xRotLabel->setText("Changed Text");
    4. }
    To copy to clipboard, switch view to plain text mode 

    I want to click the "mb0pButton" to make the text in the QLabel change, but it's not working. What am I missing?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: dynamic text?

    Quote Originally Posted by vonCZ View Post
    Qt Code:
    1. connect(mb0pButton, SIGNAL(buttonClicked()), this, SLOT(changeText()));
    To copy to clipboard, switch view to plain text mode 
    Check the signal. Should it be QAbstractButton::clicked()? "buttonClicked" is a signal of QButtonGroup (which isn't parameterless either, btw).
    J-P Nurmi

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

    vonCZ (20th June 2007)

  4. #3
    Join Date
    Apr 2007
    Location
    Rakovnik, Czech Republic
    Posts
    175
    Thanks
    43
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: dynamic text?

    right you are. Thanks.

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Problem pasting text into a QTextEdit
    By Spockmeat in forum Qt Programming
    Replies: 8
    Last Post: 14th March 2009, 14:36
  3. Editable text in QGraphicsView
    By wysota in forum Qt Programming
    Replies: 8
    Last Post: 24th February 2007, 15:30
  4. get Text from Popupmenu action
    By raphaelf in forum Newbie
    Replies: 6
    Last Post: 11th October 2006, 15:24
  5. visible text of textedit
    By regix in forum Qt Programming
    Replies: 3
    Last Post: 26th June 2006, 09:02

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.