Build photo editor interface using Qt - qt

I would like to create an application using Qt (PyQt5 specifically) that has a photo editor like interface. More specifically, I would like it to have:
No main window
Free-floating toolbar
Free-floating context window
Startup dialog
Edit-windows
The idea is to have the toolbar and context window persist for as along as the application is running. The user then opens one or multiple documents (e.g. images in the photo editor example) and uses the options in the toolbar to modify the document(s).
My first question is; does this type of application interface have a specific name, something akin to MDI or SDI? I've been searching for "photo editor interface" and variations on that, but haven't been able to find a search string that seems to hit the mark. For instance, I've tried "build a photo editor type interface with Qt" but it doesn't yield anything useful.
The second question I have is, what is the best way to build a Qt application that doesn't spawn a main window? It seems like I could kludge an assortment of dialogs together to make this happen, but I would really like to use a lot of the functionality of QMainWindow (toolbars, menus, top-level management of the application). Is there a way to launch QMainWindow, display the menu and toolbar, but suppress the main window?
I plan to primarily use this application on OSX, but would also like it to perform well on Windows and Linux.

QMenuBar has explicit support for OSX to have the menu bar behave as expected: http://doc.qt.io/qt-5/qmenubar.html#qmenubar-on-os-x
I think it'll also work on Ubuntu's Unity, which tries to have similar style, but there may be some details you need to take care of. Other desktops should work as expected.
As to how to have individual windows: any Qt widget will be a top level window if it has no parent, so that is an easy way to create windows. If you want to have parent windows (for example to control window stacking order automatically), there's a window flag for that. So you don't need to use QDialog (not sure if you were implying that in your question).
You want to read QWidget documentation carefully to get an idea how all this works.

Related

Throughoutly though about some functionality of qt

I'm new to qt, and i have a simble (may be pretty dumb) question that needed to be answer:
As far as i acknowledge, qt could be use to made applications GUI (probaly its most well-knowed purpose), the program i'm trying to code work like this: you enter the program, its show three boxs: enter, setting, exit (like those main menus we see in videos game). when we click enter, it will show the main content, or when we click exit, it quit. i am able to code the layout at which show the content of those choices, but can someone explain to me, does qt support the transitions between layout, like, how to do it, a key work would be suffice
regards
which transitions?
qt have best docs about all things in that(except 1% of it)
QEventTransition Class
Event Transitions Example

How to resize the designer-space in qt-creator if needed when developing?

As I am putting more widgets on top of more layouts in my application, the space where I design the GUI is getting also bigger for the Qt-creator interface.
I have many buttons and frames which are out of reach. I cannot see them (or click them, of course). I don't know how they look until I run the whole application for debugging.
Is there is a way to zoom out/in the main frame (the whole playground) so that I can see my full GUI design on the UI of Qt IDE?
P.S.: I am working on macBook 13"
Zooming is not possible. You can use Tools -> Form Editor -> Preview.
If the viewport gets too small the QtCreator shows scrollbars which allow to move the part of interest into view.
Note, on some system configurations the scollbars may be very small and hard to handle.
You can use this steps
Tool-->options-> Text editor ->zoom
Text editor

QPrintDialog and setting up the printer

I am working on an application that uses the Qt library on Windows.
I want the user to be able to configure the printer where the application should print. So my main menu will contain the following entries:
Printer Setup...: should show a dialog where the user can select and configure the printer
Print...: perform the actual print
In other, non-Qt, applications I used the Windows function PrintDlg with the flag PD_PRINTSETUP. This showed the following dialog, which is exactly what I want:
However, the Qt function QPrintDialog uses the more recent PrintDlgEx function, which looks like this:
This dialog seems to be intended for actual printing. Not for setting and configuring the printer.
It shows a Print button instead of simply OK.
It contains a 'Page Range' group box, which isn't really useful when setting up the printer configuration.
The QPageSetupDialog isn't really useful in my case either. It looks like this:
So this only makes it useful for setting the page size, the orientation and the margins.
Is there a clean way in Qt to get a decent printer configuration dialog?
If I can't find a clean way, I need to revert to the native Windows PrintDlg function, which means patching or duplicating the code in the Qt source qprintdialog_win.cpp.
I'm afraid you'll need to revert to the native Windows PrintDlg function as Qt4 correctly uses the PageSetupDlg function for page setup.
In Windows, although the PrintDlg can use the PD_PRINTSETUP to make the dialog act as Print Setup Dialog box, that functionality is not reccomended for new applications.
Quoting from MS: "new applications should not use PrintDlg for this purpose. The Print Setup dialog box has been superseded by the Page Setup dialog box created by the PageSetupDlg function."

QScrollArea - how to enable touch interactions to scroll to next item?

I'm using the Nokia Qt SDK and designed a small banner carousel in the top area. It looks like this:
The hierarchy looks like:
After installing this in the emulator, I try to make it scrollable (flinging). It's a simple task I would guess (like ScrollView in Android, or UIScrollView in iOS), but so far no joy. All links in the internet point me of custom scroll implementations etc etc. which I don't want to do nor expect to do as Qt should be a higher level framework? What is the state of the art here? ;-)
Question in short: How can I make this QScrollArea respond to touch (fling, scroll, drag etc) events and reveal the other widgets in the queue? I'm not expecting it to be able to "snap" into a child widget (which is another requirement later ;)).
Take a look at Flickable (at http://blog.qt.io/blog/2009/07/19/kinetic-scrolling-on-any-widgets/) and FlickCharm (linked to from that first address ) either to have an idea on how to implement it on your own or use it as is.
Note that it might not be necessary if your target is Maemo, as its Qt port handles it.
Have you tried enabling gestures? I haven't used the gesture support yet, but it looks like it's as easy as
scrollEvents->grabGesture(Qt::SwipeGesture);
// or...
scrollEvents->grabGesture(Qt::PanGesture);
I don't know if QScrollArea already handles gestures, so if that doesn't work, you may need to sub-class QScrollArea and override the event method to handle gesture events, as described in the Gestures Programming Guide.

Qt switching between views

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).

Resources