Results 1 to 4 of 4

Thread: TypeCasting issue.

  1. #1
    Join Date
    Jun 2010
    Posts
    137
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default TypeCasting issue.

    Hi,

    I have few buttons added to my UI file. Now I want to read those buttons into an array. is it possible to do this. I tried something, but getting errors.

    Qt Code:
    1. QObject buttons[10];
    2. buttons[1] = (QObject) ui->pushbutton1;
    To copy to clipboard, switch view to plain text mode 

    I have written this code because I remembered of doing something like this in other languages (.NET, Java). Thanks in advance.

    Baluk

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

    Default Re: TypeCasting issue.

    Did you try:

    Qt Code:
    1. QButton *buttons[10];
    2. buttons[0] = ui->pushButton1;
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: TypeCasting issue.

    It would be helpful to know what errors you are getting.

  4. #4
    Join Date
    Jun 2010
    Posts
    137
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: TypeCasting issue.

    Thanks squidge. It is working now. I used QPushButton directly insted of Q3Button.

Similar Threads

  1. MS C++ issue
    By sepehr in forum Installation and Deployment
    Replies: 4
    Last Post: 29th December 2008, 23:45
  2. XML issue
    By jbpvr in forum Qt Programming
    Replies: 1
    Last Post: 25th August 2008, 13:01
  3. UI issue.
    By kaushal_gaurav in forum Qt Programming
    Replies: 2
    Last Post: 13th August 2008, 11:41
  4. ui_....h issue
    By stevey in forum Qt Programming
    Replies: 5
    Last Post: 27th November 2007, 04:54
  5. qt3 to qt4 - uic issue
    By hvengel in forum Qt Programming
    Replies: 10
    Last Post: 4th March 2007, 02:59

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
  •  
Qt is a trademark of The Qt Company.