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
Related
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.
When I add a drop-dialog to a list page, the drop dialog drops down when I click on it, but does not disappear when I click somewhere else.
I am trying to add my own drop-dialog, but I can reproduce this issue with standard Dynamics AX objects. I guess I am just missing some property on an object, but I just cannot figure out which one.
If you want to reproduce my problem in order to solve it, do the following:
Create a new Form. (Form 1)
Change the FormTemplate property to ListPage (Click on Yes)
Add the query MainAccountListPage to the DataSources
Create an ActionPanTab.
Add a Drop-dialog button with the menu item MainAccountListPageBalanceParameters.
Save and open the new List page by right clicking and choosing open. (or open the menu item)
In my case, when I click on Parameters, the drop dialog drops down. When I then click outside the drop-dialog, it disappears as it should.
Create a new display menu item. Set the object to the new list page (Form 1)
Drag the Menu item to any menu. I added mine to General ledger (Common)
Restore, open new workspace. Click on the new menu item in the general ledger menu.
Click on “parameters” and click outside the drop dialog.
When I do this the drop dialog does not disappear again. You can see this same drop dialog working fine on the Main Accounts list page. I have tried changing properties on both menu items, on the menu, on the form etc. I have tried different drop dialogs and different list pages. It always works on the details page and when opened from the AOT.
Am I missing a property? Is the entire way I am adding the drop dialog wrong?
The answer to the above example is.. add the MainAccountDetailPart Form part to the list page's (Form1) Parts.
With my other example, EcoResProductPerCompanyListPage, I had to add the EcoResProductVariantsPerCompanyFactBox to Parts.
I have no idea why this is, but adding a part to a list page fixes the drop dialogs. For example, adding MainAccountDetailPart Form part to a new list page not only fixes the MainAccountListPageBalanceParameters in my example, but it also fixes any other drop dialog that previously did not want to close. Removing the part the breaks all the drop dialogs in the list page again.
Thanks, FH-Inway, for the suggestion, I would have never have found the answer without your method. The solution really surprised me!
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.
I'm very new to pywinauto ans I love it already. But I have a problem:
I want to automate an old software program with pywinauto and can control most of the buttons. But there is a certain button when clicked, there appaers a menu with icons (not the windows style of menu but a custom menu). The button's name is "Toolbar2" so I guess it's not a normal button.
With this code I can click the button I want to. When I use "ctrl.Click(), the button doesn't get clicked, I need to use ClickInput(). With the normal buttons I do can use Click().
w_handle = pywinauto.findwindows.find_windows(title=u'P2-NLTlog013', class_name='TfrmDisplayFilteredData')[0]
window = pwa_app.window_(handle=w_handle)
window.Click()
ctrl = window['ToolBar2']
ctrl.ClickInput()
My question now is: How can I get the names of the items of the hidden menu And click them. I already used this code, but then he gives a 'MatchError'.
window = pwa_app.Window_(best_match='ToolBar2', top_level_only=True).ChildWindow(best_match='PopupMenu').Click()
window.Click()
I don't know what language the software was written in...
Thanks in advance,
Fred
You may get the menu object by window.Menu() and then try to access subitem by menu.Items()
Useful methods: menu_item.Index(), menu_item.SubMenu()
I'm trying to design a UI in Qt and I can't find anywhere in the designer a button which can be "droped down" like combobox. What I mean by that is that I would like to have this button with his "default" option choosen so if I like it I would have to just click on it but if I would like to choose different option I would be able to clik the little arrow on the right side of this button and then pick option suitable for me at that moment.
You're looking for a QToolButton that has a set of actions or a menu set on it. From the documentation, the QToolButton::ToolButtonPopupMode...
Describes how a menu should be popped up for tool buttons that has a menu set or contains a list of actions.
Of it's values, the two that I see most frequently are DelayedPopup:
After pressing and holding the tool button down for a certain amount of time (the timeout is style dependant, see QStyle::SH_ToolButton_PopupDelay), the menu is displayed. A typical application example is the "back" button in some web browsers's tool bars. If the user clicks it, the browser simply browses back to the previous page. If the user presses and holds the button down for a while, the tool button shows a menu containing the current history list
And MenuButtonPopup:
In this mode the tool button displays a special arrow to indicate that a menu is present. The menu is displayed when the arrow part of the button is pressed.