When you save a file on a Mac, the panel seems to go down from the top panel really cool. I want to create a class that does a similar thing using the Qt framework. There are a few things that I'm confused about:
When the panel goes down, the entrance to the parent window should be blocked. This is easy with QDialog, since it has a setModal () method, however QDialogs, by default pop-out. I am not sure how to get around this.
A new instance of the DescendingPanel QMenua class is created in QMainProject. How would you do this, assuming there are other widgets under the menu bar. DescendingPanel should appear above them.
I would really appreciate any help with this.
EDIT
I had the idea that instead of attaching a dialog box under the menu bar, just make it appear under it and delete the window frame. Thus, it would create the illusion that he jumped out from under it. Of course, Move events should also be handled in such a way that Dialog is always under the menu bar, but for a later one. Here, the code I used to get the DescendingDialog will appear on the menu bar.
class DescendingDialog : public QWidget { QMainWindow* Window; QWidget* Menu; QPoint GlobalLocationOfMenu; int DialogWidth; int DialogHeight; int X() { int XDistanceOfPanel = GlobalLocationOfMenu.x() + ((Menu->width()/2) - (this->DialogWidth/2)); //GlobalLocationOfMenu.x() returns 0; return XDistanceOfPanel; } int Y() { int YDistanceOfPanel = GlobalLocationOfMenu.y()+Menu->height(); //GlobalLocationOfMenu.y() returns 0; return YDistanceOfPanel; } void SetGeometry() { this->setGeometry(this->X(),this->Y(),this->DialogWidth,this->DialogHeight); } public: DescendingDialog(QMainWindow* Window,int DialogWidth,int DialogHeight):QWidget(NULL) { this->Window = Window; this->Menu = this->Window->menuWidget(); this->DialogWidth = DialogWidth; this->DialogHeight = DialogHeight; QPoint RelativeLocationOfMenu = this->Menu->pos(); this->GlobalLocationOfMenu = QWidget::mapToGlobal(RelativeLocationOfMenu); this->SetGeometry(); } };
This did not work because GlobalLocationOfMenu.x () and .y () returned 0, so the dialog does not appear where I want.
source share