Results 1 to 2 of 2

Thread: How to insert a picture in the merged cell(2 lines) of QTablewidget?

  1. #1
    Join Date
    Mar 2014
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows Android

    Question How to insert a picture in the merged cell(2 lines) of QTablewidget?

    I insert a picture in the merged cell(2 lines) of QTablewidget,but the pictures can only display height of one line and becomes very narrow.How to solve it? I write the code in QT with C#.
    my code:

    tableWidget1->setItem(3,3,newQTableWidgetItem(QIcon("image2/vm.png"),tr("Ab")));
    tableWidget1->resizeColumnToContents(3);
    tableWidget1->resizeRowToContents(3);

  2. #2
    Join Date
    Mar 2014
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: How to insert a picture in the merged cell(2 lines) of QTablewidget?

    I have made it without using delegate!
    the code:

    tableWidget1->setItem(3,3,new QTableWidgetItem(tr("")));

    QPixmap pix1("image2/vm1.png");
    QBrush brush1(pix1);
    tableWidget1->item(3,3)->setBackground(brush1);

    tableWidget1->resizeColumnToContents(3);
    tableWidget1->resizeRowToContents(3);

Similar Threads

  1. Replies: 3
    Last Post: 9th November 2012, 18:55
  2. How do I display a picture on a QTableView cell?
    By danielperaza in forum Qt Programming
    Replies: 16
    Last Post: 9th April 2010, 22:04
  3. How to insert an animated picture (GIF) in a QLabel
    By AngiSad in forum Qt Programming
    Replies: 1
    Last Post: 13th January 2010, 16:31
  4. Replies: 1
    Last Post: 7th December 2009, 18:56
  5. QTableWidget : insert multiple widgets in one cell..
    By halberdier83 in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2007, 16:15

Tags for this Thread

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.