Results 1 to 5 of 5

Thread: Problem with QPlainTextEdit as a child QWidget in MainWindow

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2010
    Posts
    86
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    11
    Thanked 7 Times in 4 Posts

    Default Re: Problem with QPlainTextEdit as a child QWidget in MainWindow

    well now I took a big turn and decided to go with adding the Text into a QGraphicsView scene.
    This works out better so that I can use hovering and such, but how the heck do you change the text color and background text color for a one character graphicsItem? I tried in the stylesheet in the QGraphicsView in the ui, and have goofed with QBrush, and QPen. but they don't seem to be supported in QGraphicsScene.??¿¿?? The QFont is not helpful at all either....

    here's what I have for the drawing of the text to the scene.... going to use a QList<QStringList> as QGraphicsItem item, and then item->setPos(x,y) to put everything where I want, but I need to be able to change the font color...

    I kinda don't want to use a tableWidget, just the GraphicsView/Scene

    Qt Code:
    1. ui->graphicsView_3->setSceneRect(0,0,691, 381);
    2. dataScene.setSceneRect(0,0,691,381);
    3.  
    4. //QPen pen(Qt::black, 1);
    5.  
    6. //need to change color of text here:
    7.  
    8.  
    9. /*
    10.   QFont console("Lucida Console", 10, QFont::Bold);
    11.   QGraphicsItem* item = dataScene.addText("A", console);
    12.   // "A" will be replaced with variable QString to
    13.   // draw out a table...
    14.   item->setPos(50,50);
    15. */
    16.  
    17. dataScene.addText("Hello World"); //temp test string
    18.  
    19. ui->graphicsView_3->setScene(& dataScene);
    20. ui->graphicsView_3->show();
    To copy to clipboard, switch view to plain text mode 
    Last edited by budda; 17th April 2010 at 02:54.

Similar Threads

  1. Replies: 2
    Last Post: 19th November 2008, 09:01
  2. Child Widgets In MainWindow
    By RY in forum Newbie
    Replies: 3
    Last Post: 4th October 2008, 08:39
  3. Closing all of the mainWindow's child dialogs
    By JPNaude in forum Qt Programming
    Replies: 4
    Last Post: 2nd October 2008, 13:18
  4. MainWindow in front of child modeless dialog
    By jiveaxe in forum Qt Programming
    Replies: 4
    Last Post: 10th August 2007, 16:18
  5. Replies: 10
    Last Post: 17th August 2006, 15: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
  •  
Qt is a trademark of The Qt Company.