Results 1 to 6 of 6

Thread: setwindowtitle.

  1. #1
    Join Date
    Feb 2008
    Posts
    47
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post setwindowtitle.

    hi,
    I have a qtoolbutton's object which i have typecasted to QWidget.so that i can use it.
    I want the text in qtoolbutton to change when a particular condition becomes true.
    I tried doing this using Setwindowtext.Its not working.What is the problem in my code.

    Qt Code:
    1. QToolButton* toolbuttonmsg;
    2. QWidget* msg = toolbuttonmsg;
    3. msg->setWindowTitle("Hi");
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 7th March 2008 at 11:41. Reason: missing [code] tags

  2. #2
    Join Date
    Jul 2007
    Location
    Noida
    Posts
    46
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: setwindowtitle.

    Do it ..

    Qt Code:
    1. QToolButton* toolbuttonmsg = new QToolButton();
    2. QWidget* msg = toolbuttonmsg;
    3. msg->setWindowTitle("Hi");
    4. msg->show();
    To copy to clipboard, switch view to plain text mode 
    it will work .
    Last edited by jpn; 7th March 2008 at 11:40. Reason: missing [code] tags
    Ashish Kumar Saryar

  3. #3
    Join Date
    Feb 2008
    Posts
    47
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: setwindowtitle.

    hi,
    I tried that but it doesnt work.The text is not getting updated with the new one

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: setwindowtitle.

    Try this:
    Qt Code:
    1. msg->window()->setWindowTitle("xxx");
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Feb 2008
    Posts
    47
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post Re: setwindowtitle.

    i Tried that too but still no change in the label....sorry in the previous message i had specifiied QToolbutton.Its wrong.Its just a label.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: setwindowtitle.

    Label? You want to change the text of a label? Use QLabel::setText() then...

Similar Threads

  1. setWindowTitle
    By JeanC in forum Qt Programming
    Replies: 1
    Last Post: 19th January 2008, 10:01
  2. setWindowTitle and last compile date/time
    By jcr in forum Qt Programming
    Replies: 1
    Last Post: 8th April 2006, 23:59
  3. setWindowTitle() with nice font
    By Dwarf007 in forum Qt Programming
    Replies: 15
    Last Post: 19th March 2006, 15:31
  4. QtSingleApplication
    By mule in forum Qt Programming
    Replies: 8
    Last Post: 28th February 2006, 19:21

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.