Results 1 to 11 of 11

Thread: To put Image on QSplitter

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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: To put Image on QSplitter

    What is it exactly you're trying to do?
    Are you trying to show an image as one of the widgets handled by a splitter, or customizing the look of the "splitter divider"?

    Edit: ..and which version of Qt are you using, by the way?
    Last edited by jpn; 3rd March 2006 at 11:00.

  2. #2

    Default Re: To put Image on QSplitter

    Hi,
    Yes....I want to customize the look of the "splitter divider in image...

  3. #3
    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: To put Image on QSplitter

    Well, this kind of trick works in Qt 4.

    Qt Code:
    1. QPixmap pixmap("test.png");
    2. splitter->setHandleWidth(pixmap.width());
    3. QLabel* label = new QLabel(splitter->handle(1));
    4. label->setPixmap(pixmap);
    To copy to clipboard, switch view to plain text mode 

    Note the index of the handle. The pixmap appears in the top area of the handle, to customize to positioning you can use layouts, of course..

  4. #4

    Default Re: To put Image on QSplitter

    I am using Qt 4.1

  5. #5

    Default Re: To put Image on QSplitter

    hi,

    But I am unable to get the Pixmap on to the splitter handle.....

  6. #6
    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: To put Image on QSplitter

    1) Are you sure you are loading the pixmap correctly? Check what pixmap.isNull() returns.
    2) Are you sure you are using the correct handle index?

  7. #7

    Default Re: To put Image on QSplitter

    hi,

    QVBoxLayout *v=new QVBoxLayout(this);
    QLineEdit *l1=new QLineEdit(this);
    QLineEdit *l2=new QLineEdit(this);
    QPixmap pixmap("Album.png");

    QSplitter *splitter=new QSplitter();
    splitter->setHandleWidth(pixmap.width());
    QLabel* label = new QLabel(splitter->handle(1));
    label->setPixmap(pixmap);
    splitter->addWidget(l1);
    splitter->addWidget(l2);
    v->addWidget(splitter);

    1.Yes,pixmap is loaded successfully....
    The code is shown above...
    I want the pixmap to be on the splitter....

    Thanks

  8. #8
    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: To put Image on QSplitter

    I'm quite sure it's about the pixmap. Is it in the same dir than the executable is? Did you check what pixmap.isNull() returns? At least for me, the code I posted earlier, works fine.

  9. #9

    Default Re: To put Image on QSplitter

    hi,

    The handlewidth is same as that of the image but unable to get the image picture...


    Also pixmap.isNull() is returning false....

    Thanks...

Similar Threads

  1. How to put image on QSplitter? (Qt3)
    By Opilki_Inside in forum Qt Programming
    Replies: 2
    Last Post: 7th December 2008, 18:31
  2. 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
  3. Finding marks on scanned image for alignment
    By caduel in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2007, 02:10
  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
  •  
Qt is a trademark of The Qt Company.