Results 1 to 5 of 5

Thread: Image on Splitter

  1. #1

    Default Image on Splitter

    hi,

    QVBoxLayout *v=new QVBoxLayout(this);
    QSplitter *splitter=new QSplitter(this);
    splitter->setOrientation(Qt::Vertical);
    QPixmap pixmap("Album.png");
    splitter->setHandleWidth(pixmap.width());
    QLabel* label = new QLabel(splitter->handle(2));
    label->setPixmap(pixmap);
    QLineEdit *l1=new QLineEdit();
    QLineEdit *l2=new QLineEdit();
    QLineEdit *l3=new QLineEdit();

    bool p=pixmap.isNull();
    splitter->addWidget(l1);
    splitter->addWidget(l2);
    splitter->addWidget(l3);
    v->addWidget(splitter);

    splitter handle width is equal to the image width,,,,....

    But unable to get the image on to the splitter handle...

    help plz..

    thx

  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: Image on Splitter

    First, don't start new threads on the same topic. Secondly, use code-tags around your code postings to make it more readable, please.

    Just for testing purposes, try adding that label with the pixmap to the splitter as a widget, instead of constructing it as a child of the handle. Can you then see the image?

    A side note: For a vertical orientation you might want to use pixmap's height as handle width.

  3. #3

    Default Re: Image on Splitter

    Hi,

    Yes if i add label with pixmap as a widget then i am able to see the image....Fine...But i want that image to be in the splitter handle...


    Thx

  4. #4
    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: Image on Splitter

    Ok. Maybe the index of the handle is wrong or the child-parent relationship between the label and the handle is messed.

    Try adding labels with the image on every handle:
    Qt Code:
    1. int i = 0;
    2. while (splitter->handle(i))
    3. {
    4. QLabel* label = new QLabel(splitter->handle(i));
    5. label->setPixmap(pixmap);
    6. ++i;
    7. }
    To copy to clipboard, switch view to plain text mode 

    Btw, I tested setting a pixmap in the splitter handle in win and linux environments and both worked for me (Qt 4.1.1)..
    (Except that handle width didn't change on linux but I still was able to see the pixmap though..)

  5. #5
    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: Image on Splitter

    Isn't this more or less what you are looking for?
    Attached Images Attached Images
    Attached Files Attached Files

Similar Threads

  1. can Qlabel display a series of image one by one ?
    By jirach_gag in forum Qt Tools
    Replies: 3
    Last Post: 11th August 2008, 15:36
  2. Finding marks on scanned image for alignment
    By caduel in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2007, 02:10
  3. Explanation to Image Formats
    By sincnarf in forum Qt Programming
    Replies: 13
    Last Post: 6th July 2007, 17:02
  4. Help needed handling image data
    By toratora in forum General Programming
    Replies: 2
    Last Post: 11th May 2007, 09:24
  5. How and when to repaint a widget ?
    By yellowmat in forum Newbie
    Replies: 7
    Last Post: 3rd April 2006, 16:36

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.