Results 1 to 4 of 4

Thread: Seeking suggestions for a grid-based ASCII character layout

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Seeking suggestions for a grid-based ASCII character layout

    Use QGraphicsView or QtQuick.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Jan 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Default Re: Seeking suggestions for a grid-based ASCII character layout

    Quote Originally Posted by wysota View Post
    Use QGraphicsView or QtQuick.
    Maybe the method of using the QGraphicsView to accomplish this just isn't apparent to me, but I don't see how that would produce the desired result. What I basically want is a grid of labels, the contents of which would each expand and shrink as the form is resized, maintaining the aspect ratio of the label contents. I think I've decided to go with a pixmap approach, rather than ASCII characters, but I still need to determine how to a) make the pics automatically resize to fit within the grid cells, and b) make them automatically resize to maintain their aspect ratio as the form is resized.

    Thanks.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Seeking suggestions for a grid-based ASCII character layout

    Quote Originally Posted by Quasimojo View Post
    Maybe the method of using the QGraphicsView to accomplish this just isn't apparent to me, but I don't see how that would produce the desired result.
    Qt Code:
    1. #include <QtGui>
    2.  
    3. class View : public QGraphicsView {
    4. public:
    5. View(QWidget *parent = 0) : QGraphicsView(parent) {}
    6. protected:
    7. void resizeEvent(QResizeEvent *e) {
    8. QGraphicsView::resizeEvent(e);
    9. fitInView(sceneRect(), Qt::KeepAspectRatio);
    10. }
    11. };
    12.  
    13. int main(int argc, char**argv) {
    14. QApplication app(argc, argv);
    15. View view;
    16. scene.setSceneRect(0,0,100,100);
    17. QFont f = view.font();
    18. f.setPointSize(3);
    19. for(int r = 0; r < 10; ++r) {
    20. for(int c = 0; c < 10; ++c) {
    21. QGraphicsSimpleTextItem *item = scene.addSimpleText(QString("%1-%2").arg(r).arg(c), f);
    22. item->setPos(c*10,r*10);
    23. }
    24. }
    25. view.setScene(&scene);
    26. view.resize(600,400);
    27. view.setRenderHints(QPainter::Antialiasing|QPainter::TextAntialiasing);
    28. view.show();
    29. return app.exec();
    30. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. The following user says thank you to wysota for this useful post:

    Quasimojo (3rd April 2012)

Similar Threads

  1. Replies: 14
    Last Post: 7th December 2011, 03:57
  2. Replies: 8
    Last Post: 14th April 2010, 05:54
  3. Suggestions for checkbox form layout
    By MrGarbage in forum Qt Tools
    Replies: 1
    Last Post: 25th July 2007, 23:07
  4. Suggestions Anyone:QTableView Grid
    By locus in forum Qt Programming
    Replies: 3
    Last Post: 23rd January 2007, 08:01
  5. Grid layout
    By nupul in forum Qt Programming
    Replies: 7
    Last Post: 21st April 2006, 21:15

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.