Show a QT UI in another one - qt

I have a project including 3 UI files: win_main.ui, win_table.ui and win_table2.ui.
I want to show one of them inside of win_main.ui, and with a button, change them.
I mean, there is a Box containing win_table.ui, and when I clicked the button, the box will change to win_table2.ui.
Example
I tried using QWidget, QQuickWidget, but they didn't worked.
Is it possible ? If yes, how ?

Try using a QTabWidget. You can flip between tables using tabs.
If there is a specific reason why you wouldn't want win_table2.ui showing before a button is pressed, you can disable that tab programmatically until it is ready. You can also flip between which tab is currently showing using code as well.

Related

Code to select the PushButton using Tab Key

I have designed the UI screen which consist a lot of push-buttons and I want to select or can say want to control application using tab key. When I select any particular key, it should change the color of that push-button accordingly.
As far as I know, the focus on using the tab key should work by default and the color of the buttons changes according to focus.
I tried to create a project with several buttons on QMainWIndow and it worked without any additional effort. I'm using Qt 5.15 with KDE on arch linux.
If you want to change the order of the buttons traversal, you can use the button that changes the designer mode in Qt Creator.
And if you want to change colors of the button, you should change the stylesheet of the button with css like code. Here you can see examples of stylesheet customization.

How to make toolbar icons work like a tab?

I'm very new. Suppose I have a toolbar with 2 buttons: Foo and Bar. Is there a way to make each triggering a different "frame"? That is, the toolbar icons work like tabs. Should each trigger a new window by an on-click event?
Thanks
You can use QStackedWidget. It provides a way to have multiple widgets on each other where only one is displayed at a time (Like a QTabWidget). Here is an example :
self.stackedWidget = QtWidgets.QStackedWidget(self)
self.stackedWidget.addWidget(firstPageWidget)
self.stackedWidget.addWidget(secondPageWidget)
self.ayout = QtWidgets.QVBoxLayout(self)
layout.addWidget(stackedWidget)
setLayout(layout)
Now on each button click you can change the current page using setCurrentIndex.

QT strange GUI Components: Tabs?

I saw once someone making the GUI in QT and he had something I have never seen until now: They looked like big buttons one after another and when you clicked on them, the buttons below were going down, making space for the dialog or tab. It was like, if you click on the button "Draw", suddenly below the button a tab or a dialog or ??? appeared with all the GUI components (radio buttons, listboxes, ...) that you need for draw. When you clicked on another button, this GUI disappeared to make space for another GUI. Does anybody know what it is?
Qt does support tabs.
They are actually different widgets you can switch from in the same window.
Here you can find an example on how to use then: http://qt-project.org/doc/qt-4.8/declarative-ui-components-tabwidget.html
Inside a tab it's just like a normal widget.

How do create this gmail app effect on Honeycomb

Attached is the screenshot of the UI that I would like to have in my app. When I click on the listitems on the fragment on the left side I see a arrow pointing(question mark in red) on the list item which was clicked, I would like to know how can we achieve this in UI layout. Any special settings to be set?
I was looking at the same feature.
To implement similar, I'd suggest showing an image on the selected item in the list, this would require code rather than Layout XML, It would be controlled by the list fragment when an item is selected. That way you get the visual effect that the two fragments are related via the arrow image.
Did you end up giving it a go for yourself?

Qt:creating a dynamic button

I want to create an application in which i will create a button and by pressing that button as list of options will open and i can choose one of them.for example i will create a button named "searching algorithm" and by clicking this button a list will open at same place which display two options as linear search and binary search.can anyone give me an idea how to do that?
You want a QComboBox:
The QComboBox widget is a combined button and popup list.
I believe what you need is a popup window where you can have list of options, whenever your button is clicked show this window, hide it when user selects an item in the list or clicks outside of the working area. There is an example you can use as a reference:
QT 4.7 Google Suggest Example
hope this helps,
regards

Resources