Qt5 - right way to change content - 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.

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

Build photo editor interface using 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.

Change behavior of mouse buttons - do I have to write a driver? (Sharkoon Drakonia)

I just bought a Sharkoon Drakonia (just for information). It has 11 buttons, but only two of them (except left, right and middle button of course) can be used as 4th and 5th mouse button (eg. in games), the other ones can only be modified to behave like a double click etc. via the configurator software shipped with the mouse. So I wondered if there is a way to completely change or remap (some of) the mouse buttons to be recognized in games as for example "Mouse 6" and "Mouse 7". I think I have to write a driver for it, am I right? Is there another way to achieve my aim?
Thank you in advance!
You don't necessarily have to write a new driver - you can use some input remapping software like GlovePie (google for it). It has its own scripting language to program how input works. Most people use it to make console controllers behave like a mouse, keyboard or combination of both... But I've used it to make things kinda like what you want.
There are other software like GlovePie that can also do the job, but it's the only one whose name I can remember right now.
edit: I've just read your question more carefully. You may not be able to make a software see a mouse6 or mouse7, but you can bind some action in a game to a key in the keyboard, and then map your extra mouse buttons to be seen as if they are those keys. It works just fine.

How to create Numeric KB interface with previous, next and done button

I was on website on my iPhone and I encounter websites' guestbook. with those textFields. my keyboard appearance was totally change as you can see in screen below.
I am having many text fields in my app, I am wondering if I can create anything like that.
As I am new to development, still unknown what are the limits.
Can anyone guide me to right direction or to right documentation.
Is there is some regular way or its just total customization over Keybard.
I have one more doubt, does it matter what kind of keyboard is popping up as my all fields have numeric keyboard.
Well I just wanted to be helpful to someone who is following the same learning curve as me.
To achieve the affect in screenshot in question. UIToolbar control can be used to make those buttons. after the you need to just make this toolbar appear and disappear with the keyboard.
To make previous and next button work, you can use the tag property of textfield. on clicking on previous or next you can focus to previous or next text field.
Sorry about not posting code as I have not coded it yet but wanted to give pointer to anyone, who is looking.

I do I get QDialog geometry to expand in fullscreen?

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.

Resources