Results 1 to 6 of 6

Thread: problem with QGraphicsProxyWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2008
    Posts
    102
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Re: problem with QGraphicsProxyWidget

    looking for the code, he adds the table using html language!!!!!!

    Qt Code:
    1. void Layoutpainter::CreateanewTable()
    2. {
    3.  
    4. QString subtext, collx, rowx,largo;
    5. bool ok;
    6. int colonne = QInputDialog::getInteger(0, tr("New Table cool"),tr("Cool:"), 3, 1, 10, 1, &ok);
    7. int righe = QInputDialog::getInteger(0, tr("New Table row"),tr("Row:"), 3, 1, 100, 1, &ok);
    8. largo = "100%";
    9. if (colonne > 0 && righe > 0) {
    10. QStringList tables;
    11. tables.clear();
    12. tables.append(QString("<table border=\"1\" align=\"left\" width=\"%1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#ffffff\">").arg(largo));
    13. for (int i=0;i<righe;i++){
    14. tables.append(QString("<tr>"));
    15. for (int o=0;o<colonne;o++){
    16. tables.append(QString("<td><p></p></td>"));
    17. }
    18. tables.append(QString("</tr>"));
    19. }
    20. tables.append(QString("</table>"));
    21.  
    22. subtext = tables.join("\n");
    23. QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(subtext);
    24. textCursor().insertFragment(fragment);
    25. }
    26. }
    To copy to clipboard, switch view to plain text mode 

    I think it isn't a great solution for me!! I'd like an image table(i don't have to fill it with any text), but i'd just like to set the number of columns and rows and their width.................

  2. #2
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: problem with QGraphicsProxyWidget

    another way is
    from QStandardItemModel > QTextDocument

    http://fop-miniscribus.googlecode.co....0/ModelSwap.h
    http://fop-miniscribus.googlecode.co.../ModelSwap.cpp

    and from QTextDocument to image.... QTextDocument->drawContents(device,qrect);

Similar Threads

  1. problem with paint and erase in frame
    By M.A.M in forum Qt Programming
    Replies: 9
    Last Post: 4th May 2008, 20:17
  2. problem with opengl, zooming, drawpixels, and origin
    By ntp in forum General Programming
    Replies: 0
    Last Post: 22nd February 2008, 21:48
  3. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  4. Graphics view display problem.
    By kiranraj in forum Qt Programming
    Replies: 3
    Last Post: 20th July 2007, 07:08
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.