Results 1 to 2 of 2

Thread: Font size in QGraphicsTextItem

  1. #1
    Join Date
    Apr 2008
    Posts
    26
    Thanks
    1

    Default Font size in QGraphicsTextItem

    I add QGraphicsTextItem to graphics scene and then change its font family and font size. It works ok, but when I click and/or move my item font size changes to the 12 size. Actually its changed in QGraphicsTextItem::mouseReleaseEvent().
    What is needed to force QGraphicsTextItem keep font size? Thanks in advance.
    Last edited by rippa; 7th December 2008 at 12:00.

  2. #2
    Join Date
    Apr 2008
    Posts
    26
    Thanks
    1

    Default Re: Font size in QGraphicsTextItem

    I found where fonts size changes but still cant understand why

    Qt Code:
    1. void MyPlainTextItem::mouseReleaseEvent ( QGraphicsSceneMouseEvent * mouseEvent )
    2. {
    3. MyTW::self()->fillTable(props); //Filling property table for this item when clicked. If I delete this line all works fine.
    4. cout << this << " is selected!" << endl;
    5. QGraphicsTextItem::mouseReleaseEvent(mouseEvent);
    6. }
    To copy to clipboard, switch view to plain text mode 

    This is fillTable function, it has nothing to do with QGrpahicsTextItem but still somehow it changes font size.

    Qt Code:
    1. void MyTW::fillTable(QMap<QString,QString> map)
    2. {
    3. clear();
    4. setRowCount(map.size());
    5. twi->setText(QString::fromLocal8Bit("оБЪЧБОЙЕ"));
    6. setHorizontalHeaderItem(0,twi);
    7. twi_1->setText(QString::fromLocal8Bit("ъОБЮЕОЙЕ"));
    8. setHorizontalHeaderItem(1,twi_1);
    9. QMapIterator<QString,QString> i(map);
    10. int j =0;
    11. while (i.hasNext())
    12. {
    13. i.next();
    14. item->setText(i.key());
    15. setItem(j,0,item);
    16. item_1->setText(i.value());
    17. setItem(j,1,item_1);
    18. j++;
    19. }
    20. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 1
    Last Post: 2nd August 2008, 15:46
  2. Font size of a spinbox
    By SailinShoes in forum Qt Programming
    Replies: 6
    Last Post: 5th May 2008, 14:29
  3. Font size calculation when painting in a QImage
    By Ishark in forum Qt Programming
    Replies: 3
    Last Post: 15th July 2007, 22:22
  4. QGraphicsTextItem size
    By Angelo Moriconi in forum Qt Programming
    Replies: 1
    Last Post: 26th January 2007, 08:34
  5. QTreeView font size not being set
    By forrestfsu in forum Qt Tools
    Replies: 2
    Last Post: 12th October 2006, 13:53

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.