I am taking an existing UI component that we have based on QTableWidget and placing two of them inside QTabWidget pages. I want to allow the user to enter data into the table in the first tab and then when they press a button to move to the second tab and have the first cell in edit mode.
I am using the editItem method of QTableWidget to edit a given QTableWidgetItem. The trouble is that something is occurring to stop the edit (or maybe it never starts in the first place).
If I call editItem a second time then it fails, but if I click on the cell then it will enter the edit mode with the cell highlighted and the cursor blinking. I was just wondering if there is a way to do this programmatically that I may have missed?
One option would be to simulate a tab key press and then shift-tab but I have not been able to do this. I can simulate the tab but if I try to add the shift modifier then it jut produces a normal tab.
This is my tab code that works:
QApplication::postEvent(tableWidget, new QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier));
This is my shift-tab code that doesn't work:
QApplication::postEvent(tableWidget, new QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier));
Any suggestions would be appreciated.
It looks like shift-tab is actually reported as Qt::Key_Backtab rather than Qt::Key_Tab with the shift modifier as I had expected...
I think this will do the job for us but would welcome any better solutions.
Related
help please, I can not understand what the problem is. When you click on the drop-down menu, opens a completely different tab, which is located above.
The page itself opens correct.
But the menu unfolds is not correct.
What i want to see
Any thoughts? Maybe this is done in the settings?
To edit the Menu you go into Shared Components-Navigation Menu.
Not sure what your problem is, but it could be something to do with how those are sorted.
What you need is for all the top layer tobs(the ones you have w/o names) to have no parent, and each have its contained tabs marked with it as parent.
And maybe try changing their sequence so that all the second layer tabs are in sequence between the top layer tabs(say your first top layer tab is sequence 1000, and your second top layer tab is 2000, make sure all the second layer tabs belonging to the first top layer tab are marked with the correct parent entry, and are numbered between 1000 and 2000).
I hope this resolves whatever bug you have.
Disclaimer: I'm not a Qt programmer, I'm just asking in case someone could solve an issue about DB Browser for SQLite.
So, an EditDialog widget is extending the QDialog class. As described in the issue, in some scenarios this widget is readonly, but it would be great if its text content could still be selectable.
There are two use cases:
text selection with the mouse
blinking caret, text selection with keyboard Shift + arrows
The current solution fixes only the first case. There is no blinking caret and keyboard selection doesn't work. Could this be improved?
Assuming the textarea is a QTextEdit or QPlainTextEdit, you should be able to fix this by adjusting the text interaction flags. Try something like this:
ui->editorText->setTextInteractionFlags(
Qt.TextSelectableByMouse | Qt.TextSelectableByKeyboard)
i've a little comboBox, and i want to fill it with 6 entries... .
i wrote this code:
CComboBox* dropdownList = ((CComboBox*)GetDlgItem(IDC_PROGRAMDROPDOWN));
dropdownList->Clear();
dropdownList->AddString(L"test");
dropdownList->AddString(L"test2");
dropdownList->InsertString(2,L"test3");
dropdownList->InsertString(3,L"test4");
dropdownList->InsertString(4,L"test5");
As you can see I tried AddString(), and InsertString(). both with no effect. I also tried it just with AddString() which should be the correct way at initializing it.
But, my combobox is empty. I already debugged it, and this lines are hit but with no effect.
Do you have any idea?
In the dialog editor, make sure you resize the ComboBox item so that its height is big enough to contain all of the items when the ComboBox is expanded. By default, it'll only be the height of the "edit control" bit of the ComboBox, which limits the expanded height.
So, in the dialog editor, click on the dropdown button bit of the Combo Box and you should see the drag handles change a bit. Drag out the new size to account for all the items in the dropdown list.
thanks for all your answers. But it was an ugly Failure by my IDE -.-. I just recreated the UI-Element and it worked...
I recreated it with the same properties (Copy & Paste)
I have an UltraComboEditor (Infragistics control) and the user can input values on it. I used the AutoComplete property to do that.
But now I have a problem. I need to make sure that my user can delete a value that he wrote. I use the function canUndo but it not works.
How can I solve my problem?
Thank you.
I will try to add a ButtonLeft element, perhaps with a red cross image.
Let the user select an item from the combobox and then he/she will press the button element to trigger the action to delete the current selected element.
In the EditorButtonClick event you should ask for a confirm, search into your items collection and then remove the one selected.
If you want to indent several lines in Python IDLE you just mark the lines and hit Tab. But what if you want to remove the indent from several lines? Shift+Tab does not work for that in IDLE.
If you're using IDLE, you can use Ctrl+] to indent and Ctrl+[ to unindent.
If you're using IDLE, and the Norwegian keyboard makes Ctrl-[ a problem, you can change the key.
Go Options->Configure IDLE.
Click the Keys tab.
If necessary, click Save as New Custom Key Set.
With your custom key set, find "dedent-region" in the list.
Click Get New Keys for Selection.
etc
I tried putting in shift-Tab and that worked nicely.
Depends on your editor.
Have you tried Shift+Tab?
in pythonwin,
SHIFT + TAB works
For IDLE, select the lines, then open the "Format" menu. (Between "Edit" and "Run" if you're having trouble finding it.) This will also give you the keyboard shortcut, for me it turned out that dedent shortcut was "Ctrl+["
Shift-Tab
Ctrl-Tab
< key
depends on your editor.
In Jupyter Notebook,
SHIFT+ TAB(to move left) and TAB(to move right) movement is perfectly working.
By default, IDLE has it on Shift-Left Bracket. However, if you want, you can customise it to be Shift-Tab by clicking Options --> Configure IDLE --> Keys --> Use a Custom Key Set --> dedent-region --> Get New Keys for Selection
Then you can choose whatever combination you want. (Don't forget to click apply otherwise all the settings would not get affected.)