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

Transparent background support for QX11EmbedWidget

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Out of scope
    • P3: Somewhat important
    • Some future release
    • 4.4.1
    • GUI: Painting
    • None

    Description

      When embedding a QX11EmbedWidget with a transparent background into a QX11EmbedContainer, the transparency does not work.

      // embedwidget.cpp code

      #include <QtGui>
      #include <QX11EmbedWidget>

      int main(int argc, char *argv[])
      {
      QApplication app(argc, argv);
      QX11EmbedWidget w;
      w.setStyleSheet("QX11EmbedWidget

      { background-color: transparent; }

      ");

      QVBoxLayout *vLayout = new QVBoxLayout(&w);
      w.setLayout(vLayout);
      QTextEdit *edit = new QTextEdit(&w);
      edit->setText("foobar");
      vLayout->addWidget(edit);

      qDebug() << "client id" << w.winId();

      w.resize(100, 100);
      w.show();
      return app.exec();
      }

      // embedcontainer code

      #include <QtGui>
      #include <QX11EmbedContainer>

      class X11EmbedContainer : public QX11EmbedContainer
      {
      Q_OBJECT
      public:
      X11EmbedContainer(QWidget *parent = NULL) : QX11EmbedContainer(parent)

      { connect(this, SIGNAL(clientIsEmbedded()), this, SLOT(onEmbedded())); }

      void paintEvent(QPaintEvent *event)

      { QPainter painter(this); painter.fillRect(event->rect(), Qt::cyan); QX11EmbedContainer::paintEvent(event); }

      public slots:
      void onEmbedded()

      { qDebug() << "embedded"; }

      };

      #include "embedcontainer.moc"

      int main(int argc, char *argv[])
      {
      QApplication app(argc, argv);

      X11EmbedContainer container;
      container.show();

      if (argc > 1) {
      bool ok;
      int id = QString(argv[1]).toInt(&ok);
      if (ok)

      { container.embedClient(id); }

      }

      return app.exec();
      }

      Update: This is not a bug; it's how the X11 embed support in Qt has always worked.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            mch Jervey Kong
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes