Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. How to have a different initial background color for popups shown with <select>?
Forum Updated to NodeBB v4.3 + New Features

How to have a different initial background color for popups shown with <select>?

Scheduled Pinned Locked Moved Unsolved QtWebEngine
2 Posts 2 Posters 779 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    deleted312
    wrote on last edited by
    #1

    I have an application using a QWebEngineView . In this QWebEngineView, I use a <select> to display a popup menu. The application itself and the popup are customized to have a black background color. However when the popup is shown, a white background is initially used: it seems to flash shortly white.

    0_1552477420705_WhiteBackground.png

    I tried to set an initial black background color to the popup with no success. I made a subclass of QWebEngineView to catch the childEvent events. I was able to get the QEvent::ChildAdded and QEvent::ChildPolished events. I can get the QWidget pointer, however have not been able to change the background color.

    void AAAAAAWebEngineView::childEvent(QChildEvent *e)
    {
    	QWebEngineView::childEvent(e);
    	
    	if (e->child()->isWidgetType())
    	{
    		if (e->type() == QEvent::ChildAdded || e->type() == QEvent::ChildPolished)
    		{
    			QObject *child = e->child();
    			QWidget *widget = dynamic_cast<QWidget *>(child);
    			if(widget != NULL)
    			{
    				widget->setStyleSheet("background-color: red;");
    			}
    		}
    	}
    }
    

    One of the QWidget I get is a RenderWidgetHostViewQtDelegateWidget with the property m_isPopup set to true, so I guess this is the right QWidget. Trying to change the background color using a style sheet has no effect.

    Does anyone know how to set a different initial background color for popups shown with <select>?

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hf81970
      wrote on last edited by
      #2

      Have you solved this issue? I am facing the same problem.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved