Solved Can we remove Dialog or Mainwindow written on the top of Application output.
-
-
@JonB
Hello Sir,Thanku so much and i really appreciate that u have speared your precious time to help and it really helpful for me and as a beginner i have a lot of thing to learn from you guys. And also looking forward for more help from you. And sorry that i missed the stuff some how as i saw the top reply and it solved the problem too.
Thanku once again for the help and looking toward to learn more from you.
-
@Ashutosh_Sachdeva
Sorry, you are right. I now see @jsulm postedIf using
setWindowFlags
you need to keep all other flags:setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
I truly never spotted that he had offered that! My bad! I get tetchy... ;-)
-
@JonB
I have one more doubt here as now i have deleted that main-window title and menu bar so if now i want to come back to my previous page then what will be the method to close current page and go back to previous.as this->hide will hide the previous page but i want to store the status of current page as if i want to go back i can go back to previous page or my main menu page.
I hope i'm able to explain my requirement
-
@Ashutosh_Sachdeva
Deleting title bars does not affect anything.While you are dealing with (modal) dialogs the "going back" does not apply, you don't leave the calling page.
If you have separate windows somewhere, and you want to display one at a time and navigate between them, use QStackedWidget. This will preserve state, and you won't be using hide/show yourself. (Having said that, it will use hide/show internally, using those on windows/widgets does not lose state.)
-
OK, But what i'm asking for ex. i have one menu page and there is one drop down menu, now if i click on one of the item from menu it will take me to that page and now if i want to back to menu page then how can i go as now we have a window without any cross button on the left corner to close the window.
"for ex. i saw somewhere if we click right button of the mouse then current page will be closed and it will take us to main menu page back and so on."
-
-
I don't understand your "menus" sometimes a menu seems to mean a dialog and sometimes it seems to mean some dropdown menu. Which is why I said you might wish to change your terminology, for precisely this reason.
-
As I said, if your "menu" is a "modal dialog" which you call
exec()
on, afterward you will be back in the calling page. -
Yes, if you choose to remove the title bar on a window/dialog which has the close button then you won't have a close button to press, as I mentioned earlier. You will have to provide some other means (button, key press, right-click, whatever you invent) to exit the dialog/window. Or, for a stacked widget, you would typically have links down the lefthand side to allow navigation between pages. I don't know what else to say.
"for ex. i saw somewhere if we click right button of the mouse then current page will be closed and it will take us to main menu page back and so on."
You would have to implement that yourself, it doesn't come "out-of-the-box".
If you really want more help on this, I suggest you clarify what you mean, because reading a post which talks about a "menu" being both a "dropdown" and a "page" makes it impossible (for me) to understand.
-
-
@JonB
Ok i will try to be more specific from next time.Now i have created a mouse event to close the current window. But now what where i got stuck is:
Suppose you have three pages from first page you triigered to second page and from second page you triggered to third page and now you want to come back to second page from the third page. So how can you hide/close the current page only
void Searchpage::mousePressEvent(QMouseEvent *event)
{
if(event->buttons()== Qt::RightButton)
{
hide();
}
}if i'm using the hide function its's hiding the all other pages.
-
@Ashutosh_Sachdeva
I don't know, you're presumably hiding the wrong page, or you need to reshow the second page (secondPage->show()
), or whatever is necessary.Did you look at
QStackedWidget
? If you can use that it will be better than your potentially-ugly-and-complex list of hides & shows. -
-
@Ashutosh_Sachdeva
Assuming you mean you have changed over toQStackedWidget
, isn't it nicer/cleaner than all those show/hides yourself? And it makes code easier to follow. :)