Results 1 to 8 of 8

Thread: how i can add image in my toolbar

  1. #1
    Join Date
    Nov 2006
    Location
    gurgaon
    Posts
    49
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X

    Question how i can add image in my toolbar

    hi all
    i have some icons in toolbar size of 48x48 each having some actions and now i want to add image on remaining space ....when i add image as icon in remaining space but it looks very small....i want to add proper image in toolbar on click of image it may open another URL....
    means when i click on image it open another dialog which have some information....

    i had add icons through designer...so is there any need of programming to add image or what...
    plz tell be about how to add image in toolbar (image navigation)...

    my form is attached below
    Attached Files Attached Files
    thanks & regards
    --------------------
    jyoti

  2. #2
    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: how i can add image in my toolbar

    Add a QLabel widget to the toolbar and place your image in it as a pixmap.

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

    jyoti (19th December 2006)

  4. #3
    Join Date
    Nov 2006
    Location
    gurgaon
    Posts
    49
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X

    Question Re: how i can add image in my toolbar

    thanks but i wanna add it as icon through designer
    i had add all icons through resource editor and made a .QRC file (in which all icons are defined and declared) so i wanna same for image through which i ll use the object name and put the url on object in resource editor....
    i tried to use QLabel but it is not in use like adding oject on another object
    becoz toolbar it self is an object and using another object i.eQLabel is not working

    plz do tell if there any solution through designer otherwise by Programming
    thanks in advance
    thanks & regards
    --------------------
    jyoti

  5. #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: how i can add image in my toolbar

    Quote Originally Posted by jyoti View Post
    thanks but i wanna add it as icon through designer
    Unfortunately we don't always get what we want. You'll have to do it manually.

    i had add all icons through resource editor and made a .QRC file (in which all icons are defined and declared) so i wanna same for image through which i ll use the object name and put the url on object in resource editor....
    That doesn't mean you can't use the resource from hand written code...

    i tried to use QLabel but it is not in use like adding oject on another object
    becoz toolbar it self is an object and using another object i.eQLabel is not working
    I don't know what you mean but this certainly works:
    Qt Code:
    1. QLabel *l = new QLabel(this);
    2. l->setPixmap(QPixmap(":/myresource.png"));
    3. toolBar->addWidget(l);
    To copy to clipboard, switch view to plain text mode 

  6. The following user says thank you to wysota for this useful post:

    jyoti (19th December 2006)

  7. #5
    Join Date
    Nov 2006
    Location
    gurgaon
    Posts
    49
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X

    Question Re: how i can add image in my toolbar

    thanks
    see i am using code like as u mensioned

    QLabel *l = new QLabel(toolBar);
    l->setPixmap(QPixmap(":/images/DPRstrip.png"));


    here images is my folder's name where DPRstrip.png is placed
    bt it still not showing any image
    but setText is showing message typed
    i am using MAC Os
    thanks & regards
    --------------------
    jyoti

  8. #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: how i can add image in my toolbar

    Is the image added to a resource file and is the resource file compiled into the app?

  9. The following user says thank you to wysota for this useful post:

    jyoti (20th December 2006)

  10. #7
    Join Date
    Nov 2006
    Location
    gurgaon
    Posts
    49
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X

    Question Re: how i can add image in my toolbar

    everything is included
    this code completly working on intel based PC
    but its ot working on Power PC
    thanks & regards
    --------------------
    jyoti

  11. #8
    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: how i can add image in my toolbar

    The paths are probably incorrect somewhere (are you using relative paths anywhere?)... are you sure you are using the resource system? MacOSX launches its apps with a different working directory than Windows or Linux which might be the thing causing problems when using relative paths.

Similar Threads

  1. "sensitising" an image
    By TheKedge in forum Qt Programming
    Replies: 2
    Last Post: 28th June 2006, 08:21
  2. Fast image drawing/scaling in Qt 3.3
    By eriwik in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2006, 11:45
  3. problem with the back ground image
    By Seema Rao in forum Qt Programming
    Replies: 1
    Last Post: 17th April 2006, 22:34
  4. How and when to repaint a widget ?
    By yellowmat in forum Newbie
    Replies: 7
    Last Post: 3rd April 2006, 17:36
  5. Question about updating an image on screen
    By SkripT in forum Qt Programming
    Replies: 1
    Last Post: 24th February 2006, 20:01

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.