Results 1 to 8 of 8

Thread: Showing Icon in vertical header of a table

  1. #1
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Showing Icon in vertical header of a table

    Hi All,

    I m using qt 4.2.2 on my mac intel.
    I have created a tablewidget and using this code to show Icon in a vertical header to its original size

    QSize size1(48,48);
    QIcon a(":/images/nikon_logo.png");
    a.actualSize(size1,QIcon::Active,QIcon::Off);

    QTableWidgetItem *item=new QTableWidgetItem(a,"1",0);//set Icon a and string 1

    tableWidget->setVerticalHeaderItem(0,item);
    tableWidget->verticalHeaderItem(0)->setSizeHint(QSize(70,tableWidget->verticalHeaderItem(0)->sizeHint().height()));


    but actually this is showing very small icon.

    If anybode know how I can show largeIcon in VerticalHeader then plz tell me.

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Showing Icon in vertical header of a table

    Did you try this ?

    tableWidget->verticalHeader()->setIconSize( QSize(48, 48) );

  3. #3
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Showing Icon in vertical header of a table

    There is no change in icon size.
    Its not working.

  4. #4
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Showing Icon in vertical header of a table

    Yes, I tried to play a little with itemviews methods, without success..

    You should try those 2 ideas :

    - Use a costum item delegate for the headerview, with your own settings.
    - Subclass QHeaderView and provide your own header ;-)

    Guilugi.

  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: Showing Icon in vertical header of a table

    Quote Originally Posted by guilugi View Post
    - Use a costum item delegate for the headerview, with your own settings.
    QHeaderView is not a full-featured item view. It doesn't actually use item delegates for anything at all. One idea less to test..
    J-P Nurmi

  6. #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: Showing Icon in vertical header of a table

    Here is another one to test - use QPixmap instead of QIcon.

  7. #7
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Re: Showing Icon in vertical header of a table

    Quote Originally Posted by wysota View Post
    Here is another one to test - use QPixmap instead of QIcon.
    Thanks.
    But still no change in Icon size.

    I m taking image in pixmap and then adding it to icon but no change in icon size.

  8. #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: Showing Icon in vertical header of a table

    Quote Originally Posted by vishal.chauhan View Post
    But still no change in Icon size.
    In that case you have to reimplement the header and do the drawing yourself. Try searching this forum, there has recently been a simmilar issue brought up.

Similar Threads

  1. Editable table header
    By cmaxb in forum Qt Programming
    Replies: 1
    Last Post: 9th December 2006, 12:12

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.