Results 1 to 16 of 16

Thread: Add a .jpg image as the background or main panel of my main window

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2007
    Posts
    30
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    14

    Question Re: Add a .jpg image as the background or main panel of my main window

    To wysota:
    Thanks for the code...if you notice, or maybe if I wrote more clearly, you will find on my previous posts that I was using the exact logic and codings as you did. It just didn't show up.

    Problem is that your main application has a show() function there, but I can't really in the uic class in anywhere tell the things I added to show. and I was thinking about adding a paintevent somewhere...but using that will only help me show the code I added, cuz there is no function like, show, or exec for that uic class. Even if there were, it was hard to integrate my code and the uic and to let them show together.

    Maybe:
    1. You are right, I don't have JPEG image plug in...what is that? I can I have it?

    2. High_flyer is right, every time I build the project, my changes are being overwritten.

    So to High_flyer:
    Could you tell me how to sub class that uic class?

    Do I do this in the substantial(which had an object of this uic class: ui) class?

    Qt Code:
    1. QWidget wgt;
    2. QPalette p = wgt.palette();
    3. QPixmap px("/usr/share/icons/crystalsvg/48x48/actions/kde.png");
    4. p.setBrush(QPalette::Window, QBrush(px));
    5. wgt.setPalette(p);
    6. [B][U] ui.addWedgit(wgt); [/U][/B]//But I don't know if ui has addWedgit though(I'll check).
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: Add a .jpg image as the background or main panel of my main window

    Quote Originally Posted by KaKa View Post
    To wysota:
    Thanks for the code...if you notice, or maybe if I wrote more clearly, you will find on my previous posts that I was using the exact logic and codings as you did.
    The point is my code is verified as working.

    Problem is that your main application has a show() function there, but I can't really in the uic class in anywhere tell the things I added to show.
    2. High_flyer is right, every time I build the project, my changes are being overwritten.

    So to High_flyer:
    Could you tell me how to sub class that uic class?

    Do I do this in the substantial(which had an object of this uic class: ui) class?
    Never touch the class generated by uic.

    The ui file is only a simple class containing positions and attributes of widgets, nothing more. You should then create a new class that inherits QWidget (or its subclass) and that has the ui class as its member or inherit the ui class and call the setupUi(this) method from the ui class. This will setup all the widgets. Then you can manipulate them from within the subclass. It's all in the manual:
    http://doc.trolltech.com/4.2/designe...component.html

    1. You are right, I don't have JPEG image plug in...what is that? I can I have it?
    How do you know you don't have it? Qt has it by default. Can you display any jpg image on a label?

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

    KaKa (23rd March 2007)

  4. #3
    Join Date
    Mar 2007
    Posts
    30
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    14

    Talking Re: Add a .jpg image as the background or main panel of my main window

    Actually your replies really help a lot! I think it should work fine now according to information you provided me. But I will try that out when I come back from work.

    Once again, thanks so much for replying so fast and so in detail!


Similar Threads

  1. move parent window to the front.
    By hvengel in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2007, 08:41
  2. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 10: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
  •  
Qt is a trademark of The Qt Company.