I'm trying to get a fullscreen dialog to launch after clicking a button in my MainWindow using QT on Mac. I use showFullScreen() to display the dialog, and the whole screen does get taken up. The problem is that the widgets within the dialog are still constrained to the 1024px geometry set for the dialog in the designer, and positioned in the upper left corner of the screen. I can manually change the geometry in the ui file to match my desktop, but I can't get it to work programmatically. I have tried setting the geometry of the dialog to desktop()->geometry() and the running updateGeometry() and that did not work. I tried it both before and after running the showFullScreen() function.
I've tried setting the sizePolicy of the dialog to Expandable, Maximum, Preferred, and just about every other setting, and still no go. Right now it is an absolute bare bones project, show the only code to show would be the sessionscreen.showFullScreen() function in the button_clicked() slot.
I'm sure there is something I'm missing, but I have been at it for hours, scouring Google and Qt help forums and coming up empty. Hopefully someone can point out something very simple that I am missing.
Nevermind, I am indeed using layouts wrong, because the widgets don't move if i resize the layout in designer either. I thought I followed the tutorial videos exactly. This is why I prefer text based tutorials. Oh well, back to Youtube I go.
Related
I have an application, that is made for Full HD with Qt Creator. When now this application is opened on a screen with less resolution, the application is no more fully accessable and I'm not sure, what the best method would be to make still everything accessable.
So my first idea was to embed a scroll bar in the main window, but I don't like that and I would do this only, if no better method exists.
I would prefer to resize the whole application (all the fonts and buttons etc.) dynamically, but I found no way yet to do this. Is this even possible in Qt? If not, can I somehow move inside the application (for example drag the screen with the mouse) around, but without a scroll bar?
I have a small problem whit QScrollbar.
for example,
This is a one my project in C#
At left panel, the user loads a graphic image and can pick elements.
but I see in Qt don't exist Split Panel whit automatic Scrollbar.
I tried to use QScrollArea, but if user maximizes Window it's a problem.
anyone have a solution or a good way to make this in qt?
I'm new to Qt development and I'm facing a small problem.
At the start of my program, I'm showing a big window with two buttons, and I want those buttons to bring a new content into the window when I click on it, like a "next" button on some installers.
What I was doing for this is that I created another class, like SecondWindow, which inherited QWidget, and I loaded it when button was clicked, but even though it can work, I can tell it's not "the right thing to do" and I would like to know what that would be.
And also, if you happen to know a good book to learn all this, I would be quite happy about it.
PS: I'm not using Qt quick, but I'm not against the idea.
I'm trying to create a plugin using QT that is able to open a webpage, yet I only want the window to be focused on a 300x300 pixel area. The area is somewhere in the middle of a page.
I was able to load the page and then perform a scrolling operation, but that doesn't seem very clean.
Does anyone know if this is possible? I checked the QtWebFrame class reference:
http://doc.qt.io/archives/qt-4.7/qwebframe.html
but maybe I'm missing something. Thanks in advance!
If you don't need interaction with the page, you could call QWebFrame::render(QPainter* painter, const QRegion& clip) and draw it onto a widget, specifying clip to be the required area.
How do I switch between the two screens on the Qt?
For example, I have a button - static text plus a toolbar. Now I will add it to a frame and set it as a central widget. It works well for one window. What if I move it to the next window? Then I need to show some other stuff like another button, some images etc... and what if I come back to the first view again?
How do I show my old widgets back?
I'm not sure I got your problem right but, you could have different scenarios :
You could simply use groupboxes... Some widgets in groupbox1, otherWidget in groupbox2, and you display the groupbox you want to use, hiding the others...
You could use stackedWidget, which simulates "pages" of widgets stacked on top of eachothers... more informations here : http://qt.nokia.com/doc/4.6/qstackedwidget.html.
You could use other way like using tabs : http://doc.trolltech.com/4.6/qtabwidget.html
Maybe this example would be useful to you : http://qt.nokia.com/doc/4.6/dialogs-configdialog.html
Hope it helps a bit !
I'd recommend checking out Animation/States example (should be in /qt/examples/animation/states/ subdirectory of your Qt installation). It shows how to combine state machine representing application logic with presentation layer and get cool animation effects for free (of course if you don't need eye candy, you can set widgets properties without any animation).