Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-3273

QTextEdit as QGraphicsProxyWidget does not apply color text

    XMLWordPrintable

Details

    Description

      Using a QTextEdit as a QGraphicsProxyWidget and setColor() to red.
      Without any previous text,the entered text stays black.

      Example Code:

      #include <QApplication>

      #include <QVBoxLayout>
      #include <QGraphicsScene>
      #include <QGraphicsView>
      #include <QGraphicsProxyWidget>
      #include <QTextEdit>

      int main( int argc, char ** argv )
      {

      QApplication a( argc, argv );
      QWidget window;
      window.resize(400, 250);
      //normal QTextEdit
      QVBoxLayout *layout = new QVBoxLayout;
      QTextEdit *textWidget1 = new QTextEdit;
      layout->addWidget(textWidget1);
      textWidget1->setTextColor(QColor(Qt::red));
      // ** input some text it'll be red
      //QtextEdit with WoC
      QTextEdit *textWidget2 = new QTextEdit;
      QGraphicsView *view = new QGraphicsView;
      QGraphicsScene *scene = new QGraphicsScene;
      view->setScene(scene);
      QGraphicsProxyWidget *proxy = scene->addWidget(textWidget2);
      textWidget2->setTextColor(QColor(Qt::red));
      // ** input some text, it'll stay black
      layout->addWidget(view);
      textWidget1->show();
      window.setLayout(layout);
      view->show();

      window.show();

      return a.exec();
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bjnilsen Bjørn Erik Nilsen
            xcm Martin Petersson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes