I am developing an application using Qt 4.5 (under Windows Vista, but I want it to be cross-platform). I am using C ++
I would like to create a popup containing a QLineEdit widget, with a function that when a user interacts with a QLineEdit widget, the popup does not activate (the main application window remains active).
Creating a window (widget) with Qt :: Popup | Qt :: Window flags give me exactly what I want, except that I do not want the shadow shadow border effect to be provided. I want a borderless window. Note that the Qt :: FramelessWindowHint flag does not achieve this.
Does anyone have any clues?
Further clarification: Below is a fragment of a simple test application in which a window with a button is created. When the button is pressed, a pop-up window is displayed, and the user can enter QLineEdit in the field. When the user does this, the main window remains activated:
http://howlettresearch.com/popup_img_1.png
However, pay attention to the shadow frame in the pop-up window (I could not get rid of this).
For comparison, creating a window, as in a numbered line, allows you to create a pop-up style window without a shadow, but when the user clicks on QLineEdit in the pop-up window, the main window is no longer active. You can say that the shadow in the main window has changed.
http://howlettresearch.com/popup_img_2.png
I'm really after a popup that behaves as if it is part of the main window. As a side note, the popup disappears when I click on it, but this is almost the behavior that I want, and I can work with this and grabMouse etc., to do what I want ... provided that I I can get rid of this shadow!
PopupTest::PopupTest(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { QPushButton* pb = new QPushButton("test button"); setCentralWidget(pb); QObject::connect(pb, SIGNAL(clicked()), this, SLOT(handleClick())); } void PopupTest::handleClick() { //QFrame* popup1 = new QFrame(this, Qt::Tool | Qt::Window | Qt::FramelessWindowHint); QFrame* popup1 = new QFrame(this, Qt::Popup | Qt::Window ); popup1->resize(150,100); QLineEdit *tmpE = new QLineEdit( popup1 ); connect( tmpE, SIGNAL( returnPressed() ), popup1, SLOT( hide() ) ); tmpE->setGeometry(10,10, 130, 30); tmpE->setFocus(); popup1->show(); } PopupTest::~PopupTest() { }